请求 Party 服务
Request a party session.
Allowed entity token types: title, game_server
Error codes
This operation may return the following PlayFab errors:
| Error | Code |
|---|---|
| PartyBadRequest | 1434 |
| PartyInternalServerError | 1439 |
| PartyNotFound | 1437 |
| PartyRequestsThrottledFromRateLimiter | 1504 |
| PartyTooManyRequests | 1441 |
| PartyUnauthorized | 1435 |
| PartyUnavailable | 1440 |
curl --request POST \
--url https://{titleId}.playfabapi.com/Party/RequestPartyService \
--header 'Content-Type: application/json' \
--header 'X-EntityToken: <api-key>' \
--data '
{
"TitleId": "12345",
"PartyId": "23781fa9-e01e-4b29-4f0b-dd9f37a06a1e",
"PreferredRegions": [
"EastUs",
"WestUs"
],
"NetworkConfiguration": {
"MaxUsers": 1024,
"MaxDevices": 128,
"MaxUsersPerDevice": 8,
"MaxDevicesPerUser": 128,
"MaxEndpointsPerDevice": 32,
"DirectPeerConnectivityOptions": "None",
"PartyInvitationConfiguration": {
"Identifier": "f8b73a15-6ec2-48f8-b5fb-6c5946dc10be",
"Revocability": "Anyone",
"EntityKeys": []
}
}
}
'import requests
url = "https://{titleId}.playfabapi.com/Party/RequestPartyService"
payload = {
"TitleId": "12345",
"PartyId": "23781fa9-e01e-4b29-4f0b-dd9f37a06a1e",
"PreferredRegions": ["EastUs", "WestUs"],
"NetworkConfiguration": {
"MaxUsers": 1024,
"MaxDevices": 128,
"MaxUsersPerDevice": 8,
"MaxDevicesPerUser": 128,
"MaxEndpointsPerDevice": 32,
"DirectPeerConnectivityOptions": "None",
"PartyInvitationConfiguration": {
"Identifier": "f8b73a15-6ec2-48f8-b5fb-6c5946dc10be",
"Revocability": "Anyone",
"EntityKeys": []
}
}
}
headers = {
"X-EntityToken": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-EntityToken': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
TitleId: '12345',
PartyId: '23781fa9-e01e-4b29-4f0b-dd9f37a06a1e',
PreferredRegions: ['EastUs', 'WestUs'],
NetworkConfiguration: {
MaxUsers: 1024,
MaxDevices: 128,
MaxUsersPerDevice: 8,
MaxDevicesPerUser: 128,
MaxEndpointsPerDevice: 32,
DirectPeerConnectivityOptions: 'None',
PartyInvitationConfiguration: {
Identifier: 'f8b73a15-6ec2-48f8-b5fb-6c5946dc10be',
Revocability: 'Anyone',
EntityKeys: []
}
}
})
};
fetch('https://{titleId}.playfabapi.com/Party/RequestPartyService', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{titleId}.playfabapi.com/Party/RequestPartyService",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'TitleId' => '12345',
'PartyId' => '23781fa9-e01e-4b29-4f0b-dd9f37a06a1e',
'PreferredRegions' => [
'EastUs',
'WestUs'
],
'NetworkConfiguration' => [
'MaxUsers' => 1024,
'MaxDevices' => 128,
'MaxUsersPerDevice' => 8,
'MaxDevicesPerUser' => 128,
'MaxEndpointsPerDevice' => 32,
'DirectPeerConnectivityOptions' => 'None',
'PartyInvitationConfiguration' => [
'Identifier' => 'f8b73a15-6ec2-48f8-b5fb-6c5946dc10be',
'Revocability' => 'Anyone',
'EntityKeys' => [
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-EntityToken: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://{titleId}.playfabapi.com/Party/RequestPartyService"
payload := strings.NewReader("{\n \"TitleId\": \"12345\",\n \"PartyId\": \"23781fa9-e01e-4b29-4f0b-dd9f37a06a1e\",\n \"PreferredRegions\": [\n \"EastUs\",\n \"WestUs\"\n ],\n \"NetworkConfiguration\": {\n \"MaxUsers\": 1024,\n \"MaxDevices\": 128,\n \"MaxUsersPerDevice\": 8,\n \"MaxDevicesPerUser\": 128,\n \"MaxEndpointsPerDevice\": 32,\n \"DirectPeerConnectivityOptions\": \"None\",\n \"PartyInvitationConfiguration\": {\n \"Identifier\": \"f8b73a15-6ec2-48f8-b5fb-6c5946dc10be\",\n \"Revocability\": \"Anyone\",\n \"EntityKeys\": []\n }\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-EntityToken", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://{titleId}.playfabapi.com/Party/RequestPartyService")
.header("X-EntityToken", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"TitleId\": \"12345\",\n \"PartyId\": \"23781fa9-e01e-4b29-4f0b-dd9f37a06a1e\",\n \"PreferredRegions\": [\n \"EastUs\",\n \"WestUs\"\n ],\n \"NetworkConfiguration\": {\n \"MaxUsers\": 1024,\n \"MaxDevices\": 128,\n \"MaxUsersPerDevice\": 8,\n \"MaxDevicesPerUser\": 128,\n \"MaxEndpointsPerDevice\": 32,\n \"DirectPeerConnectivityOptions\": \"None\",\n \"PartyInvitationConfiguration\": {\n \"Identifier\": \"f8b73a15-6ec2-48f8-b5fb-6c5946dc10be\",\n \"Revocability\": \"Anyone\",\n \"EntityKeys\": []\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{titleId}.playfabapi.com/Party/RequestPartyService")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-EntityToken"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"TitleId\": \"12345\",\n \"PartyId\": \"23781fa9-e01e-4b29-4f0b-dd9f37a06a1e\",\n \"PreferredRegions\": [\n \"EastUs\",\n \"WestUs\"\n ],\n \"NetworkConfiguration\": {\n \"MaxUsers\": 1024,\n \"MaxDevices\": 128,\n \"MaxUsersPerDevice\": 8,\n \"MaxDevicesPerUser\": 128,\n \"MaxEndpointsPerDevice\": 32,\n \"DirectPeerConnectivityOptions\": \"None\",\n \"PartyInvitationConfiguration\": {\n \"Identifier\": \"f8b73a15-6ec2-48f8-b5fb-6c5946dc10be\",\n \"Revocability\": \"Anyone\",\n \"EntityKeys\": []\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"code": 200,
"status": "OK",
"data": {
"SerializedNetworkDescriptor": "AwCzm+YyPYt1XCGGCkeIv588A1Gon1VTV0VTVAAAAAAAAAAAAAAAAAAAt3qFc4+Pmn8bBLUynFkOvLnkJZJcbQmECJxDoCLeTxnCgRBmYWtlaG9zdG5hbWUuYml6",
"InvitationId": "01234567-89ab-cdef-0123-456789abcdef"
}
}{
"code": 123,
"errorCode": 123,
"status": "<string>",
"error": "<string>",
"errorMessage": "<string>",
"errorDetails": {}
}授权
This API requires an Entity Session Token, available from the Entity GetEntityToken method.
请求体
Requests a party session from a particular set of builds if build alias params is provided, in any of the given preferred regions.
Requests a party session from a particular set of builds if build alias params is provided, in any of the given preferred regions.
The network configuration for this request.
Show child attributes
Show child attributes
The preferred regions to request a party session from. The party service will iterate through the regions in the specified order and allocate a party session from the first one that is available.
AustraliaEast, AustraliaSoutheast, BrazilSouth, CentralUs, EastAsia, EastUs, EastUs2, JapanEast, JapanWest, NorthCentralUs, NorthEurope, SouthCentralUs, SoutheastAsia, WestEurope, WestUs, SouthAfricaNorth, WestCentralUs, KoreaCentral, FranceCentral, WestUs2, CentralIndia, UaeNorth, UkSouth, SwedenCentral, CanadaCentral, MexicoCentral, WestUs3, CanadaEast, UkWest, FranceSouth, SouthIndia, SpainCentral, GermanyWestCentral, ItalyNorth, IndonesiaCentral, ChileCentral, PolandCentral, NewZealandNorth, BrazilSoutheast, NorwayEast, SwitzerlandNorth, MalaysiaWest, IsraelCentral, QatarCentral, UaeCentral, GermanyNorth, AustriaEast, BelgiumCentral, DenmarkEast, SwitzerlandWest, SwedenSouth, NorwayWest, SouthAfricaWest, MalaysiaSouth The optional custom tags associated with the request (e.g. build number, external trace identifiers, etc.).
A guid string party ID created track the party session over its life.
A player entity Id on behalf of whom the request is being made.
响应
The Http status code. If X-ReportErrorAsSuccess header is set to true, this will report the actual http error code.
The Http status code as a string.
Show child attributes
Show child attributes
{
"SerializedNetworkDescriptor": "AwCzm+YyPYt1XCGGCkeIv588A1Gon1VTV0VTVAAAAAAAAAAAAAAAAAAAt3qFc4+Pmn8bBLUynFkOvLnkJZJcbQmECJxDoCLeTxnCgRBmYWtlaG9zdG5hbWUuYml6",
"InvitationId": "01234567-89ab-cdef-0123-456789abcdef"
}
此页面对您有帮助吗?
curl --request POST \
--url https://{titleId}.playfabapi.com/Party/RequestPartyService \
--header 'Content-Type: application/json' \
--header 'X-EntityToken: <api-key>' \
--data '
{
"TitleId": "12345",
"PartyId": "23781fa9-e01e-4b29-4f0b-dd9f37a06a1e",
"PreferredRegions": [
"EastUs",
"WestUs"
],
"NetworkConfiguration": {
"MaxUsers": 1024,
"MaxDevices": 128,
"MaxUsersPerDevice": 8,
"MaxDevicesPerUser": 128,
"MaxEndpointsPerDevice": 32,
"DirectPeerConnectivityOptions": "None",
"PartyInvitationConfiguration": {
"Identifier": "f8b73a15-6ec2-48f8-b5fb-6c5946dc10be",
"Revocability": "Anyone",
"EntityKeys": []
}
}
}
'import requests
url = "https://{titleId}.playfabapi.com/Party/RequestPartyService"
payload = {
"TitleId": "12345",
"PartyId": "23781fa9-e01e-4b29-4f0b-dd9f37a06a1e",
"PreferredRegions": ["EastUs", "WestUs"],
"NetworkConfiguration": {
"MaxUsers": 1024,
"MaxDevices": 128,
"MaxUsersPerDevice": 8,
"MaxDevicesPerUser": 128,
"MaxEndpointsPerDevice": 32,
"DirectPeerConnectivityOptions": "None",
"PartyInvitationConfiguration": {
"Identifier": "f8b73a15-6ec2-48f8-b5fb-6c5946dc10be",
"Revocability": "Anyone",
"EntityKeys": []
}
}
}
headers = {
"X-EntityToken": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-EntityToken': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
TitleId: '12345',
PartyId: '23781fa9-e01e-4b29-4f0b-dd9f37a06a1e',
PreferredRegions: ['EastUs', 'WestUs'],
NetworkConfiguration: {
MaxUsers: 1024,
MaxDevices: 128,
MaxUsersPerDevice: 8,
MaxDevicesPerUser: 128,
MaxEndpointsPerDevice: 32,
DirectPeerConnectivityOptions: 'None',
PartyInvitationConfiguration: {
Identifier: 'f8b73a15-6ec2-48f8-b5fb-6c5946dc10be',
Revocability: 'Anyone',
EntityKeys: []
}
}
})
};
fetch('https://{titleId}.playfabapi.com/Party/RequestPartyService', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{titleId}.playfabapi.com/Party/RequestPartyService",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'TitleId' => '12345',
'PartyId' => '23781fa9-e01e-4b29-4f0b-dd9f37a06a1e',
'PreferredRegions' => [
'EastUs',
'WestUs'
],
'NetworkConfiguration' => [
'MaxUsers' => 1024,
'MaxDevices' => 128,
'MaxUsersPerDevice' => 8,
'MaxDevicesPerUser' => 128,
'MaxEndpointsPerDevice' => 32,
'DirectPeerConnectivityOptions' => 'None',
'PartyInvitationConfiguration' => [
'Identifier' => 'f8b73a15-6ec2-48f8-b5fb-6c5946dc10be',
'Revocability' => 'Anyone',
'EntityKeys' => [
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-EntityToken: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://{titleId}.playfabapi.com/Party/RequestPartyService"
payload := strings.NewReader("{\n \"TitleId\": \"12345\",\n \"PartyId\": \"23781fa9-e01e-4b29-4f0b-dd9f37a06a1e\",\n \"PreferredRegions\": [\n \"EastUs\",\n \"WestUs\"\n ],\n \"NetworkConfiguration\": {\n \"MaxUsers\": 1024,\n \"MaxDevices\": 128,\n \"MaxUsersPerDevice\": 8,\n \"MaxDevicesPerUser\": 128,\n \"MaxEndpointsPerDevice\": 32,\n \"DirectPeerConnectivityOptions\": \"None\",\n \"PartyInvitationConfiguration\": {\n \"Identifier\": \"f8b73a15-6ec2-48f8-b5fb-6c5946dc10be\",\n \"Revocability\": \"Anyone\",\n \"EntityKeys\": []\n }\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-EntityToken", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://{titleId}.playfabapi.com/Party/RequestPartyService")
.header("X-EntityToken", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"TitleId\": \"12345\",\n \"PartyId\": \"23781fa9-e01e-4b29-4f0b-dd9f37a06a1e\",\n \"PreferredRegions\": [\n \"EastUs\",\n \"WestUs\"\n ],\n \"NetworkConfiguration\": {\n \"MaxUsers\": 1024,\n \"MaxDevices\": 128,\n \"MaxUsersPerDevice\": 8,\n \"MaxDevicesPerUser\": 128,\n \"MaxEndpointsPerDevice\": 32,\n \"DirectPeerConnectivityOptions\": \"None\",\n \"PartyInvitationConfiguration\": {\n \"Identifier\": \"f8b73a15-6ec2-48f8-b5fb-6c5946dc10be\",\n \"Revocability\": \"Anyone\",\n \"EntityKeys\": []\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{titleId}.playfabapi.com/Party/RequestPartyService")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-EntityToken"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"TitleId\": \"12345\",\n \"PartyId\": \"23781fa9-e01e-4b29-4f0b-dd9f37a06a1e\",\n \"PreferredRegions\": [\n \"EastUs\",\n \"WestUs\"\n ],\n \"NetworkConfiguration\": {\n \"MaxUsers\": 1024,\n \"MaxDevices\": 128,\n \"MaxUsersPerDevice\": 8,\n \"MaxDevicesPerUser\": 128,\n \"MaxEndpointsPerDevice\": 32,\n \"DirectPeerConnectivityOptions\": \"None\",\n \"PartyInvitationConfiguration\": {\n \"Identifier\": \"f8b73a15-6ec2-48f8-b5fb-6c5946dc10be\",\n \"Revocability\": \"Anyone\",\n \"EntityKeys\": []\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"code": 200,
"status": "OK",
"data": {
"SerializedNetworkDescriptor": "AwCzm+YyPYt1XCGGCkeIv588A1Gon1VTV0VTVAAAAAAAAAAAAAAAAAAAt3qFc4+Pmn8bBLUynFkOvLnkJZJcbQmECJxDoCLeTxnCgRBmYWtlaG9zdG5hbWUuYml6",
"InvitationId": "01234567-89ab-cdef-0123-456789abcdef"
}
}{
"code": 123,
"errorCode": 123,
"status": "<string>",
"error": "<string>",
"errorMessage": "<string>",
"errorDetails": {}
}