Exécuter des opérations de transfert
Transfer a list of inventory items. A maximum list of 50 operations can be performed by a single request. When the response code is 202, one or more operations did not complete within the timeframe of the request. You can identify the pending operations by looking for OperationStatus = ‘InProgress’. You can check on the operation status at anytime within 1 day of the request by passing the TransactionToken to the GetInventoryOperationStatus API.
Allowed entity token types: title, master_player_account, title_player_account
Error codes
This operation may return the following PlayFab errors:
| Error | Code |
|---|---|
| DatabaseThroughputExceeded | 1113 |
| InsufficientFunds | 1059 |
| ItemNotFound | 1047 |
| PreconditionFailed | 1610 |
curl --request POST \
--url https://{titleId}.playfabapi.com/Inventory/ExecuteTransferOperations \
--header 'Content-Type: application/json' \
--header 'X-EntityToken: <api-key>' \
--data '
{
"Operations": [
{
"GivingItem": {
"Id": "11111111-1111-1111-1111-111111111111",
"StackId": "default"
},
"ReceivingItem": {
"Id": "11111111-1111-1111-1111-111111111111",
"StackId": "default"
},
"Amount": 1
}
],
"GivingEntity": {
"Id": "someId1",
"Type": "title_player_account",
"TypeString": "title_player_account"
},
"ReceivingEntity": {
"Id": "someId2",
"Type": "title_player_account",
"TypeString": "title_player_account"
},
"GivingCollectionId": "default",
"ReceivingCollectionId": "backpack"
}
'import requests
url = "https://{titleId}.playfabapi.com/Inventory/ExecuteTransferOperations"
payload = {
"Operations": [
{
"GivingItem": {
"Id": "11111111-1111-1111-1111-111111111111",
"StackId": "default"
},
"ReceivingItem": {
"Id": "11111111-1111-1111-1111-111111111111",
"StackId": "default"
},
"Amount": 1
}
],
"GivingEntity": {
"Id": "someId1",
"Type": "title_player_account",
"TypeString": "title_player_account"
},
"ReceivingEntity": {
"Id": "someId2",
"Type": "title_player_account",
"TypeString": "title_player_account"
},
"GivingCollectionId": "default",
"ReceivingCollectionId": "backpack"
}
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({
Operations: [
{
GivingItem: {Id: '11111111-1111-1111-1111-111111111111', StackId: 'default'},
ReceivingItem: {Id: '11111111-1111-1111-1111-111111111111', StackId: 'default'},
Amount: 1
}
],
GivingEntity: {
Id: 'someId1',
Type: 'title_player_account',
TypeString: 'title_player_account'
},
ReceivingEntity: {
Id: 'someId2',
Type: 'title_player_account',
TypeString: 'title_player_account'
},
GivingCollectionId: 'default',
ReceivingCollectionId: 'backpack'
})
};
fetch('https://{titleId}.playfabapi.com/Inventory/ExecuteTransferOperations', 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/Inventory/ExecuteTransferOperations",
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([
'Operations' => [
[
'GivingItem' => [
'Id' => '11111111-1111-1111-1111-111111111111',
'StackId' => 'default'
],
'ReceivingItem' => [
'Id' => '11111111-1111-1111-1111-111111111111',
'StackId' => 'default'
],
'Amount' => 1
]
],
'GivingEntity' => [
'Id' => 'someId1',
'Type' => 'title_player_account',
'TypeString' => 'title_player_account'
],
'ReceivingEntity' => [
'Id' => 'someId2',
'Type' => 'title_player_account',
'TypeString' => 'title_player_account'
],
'GivingCollectionId' => 'default',
'ReceivingCollectionId' => 'backpack'
]),
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/Inventory/ExecuteTransferOperations"
payload := strings.NewReader("{\n \"Operations\": [\n {\n \"GivingItem\": {\n \"Id\": \"11111111-1111-1111-1111-111111111111\",\n \"StackId\": \"default\"\n },\n \"ReceivingItem\": {\n \"Id\": \"11111111-1111-1111-1111-111111111111\",\n \"StackId\": \"default\"\n },\n \"Amount\": 1\n }\n ],\n \"GivingEntity\": {\n \"Id\": \"someId1\",\n \"Type\": \"title_player_account\",\n \"TypeString\": \"title_player_account\"\n },\n \"ReceivingEntity\": {\n \"Id\": \"someId2\",\n \"Type\": \"title_player_account\",\n \"TypeString\": \"title_player_account\"\n },\n \"GivingCollectionId\": \"default\",\n \"ReceivingCollectionId\": \"backpack\"\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/Inventory/ExecuteTransferOperations")
.header("X-EntityToken", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"Operations\": [\n {\n \"GivingItem\": {\n \"Id\": \"11111111-1111-1111-1111-111111111111\",\n \"StackId\": \"default\"\n },\n \"ReceivingItem\": {\n \"Id\": \"11111111-1111-1111-1111-111111111111\",\n \"StackId\": \"default\"\n },\n \"Amount\": 1\n }\n ],\n \"GivingEntity\": {\n \"Id\": \"someId1\",\n \"Type\": \"title_player_account\",\n \"TypeString\": \"title_player_account\"\n },\n \"ReceivingEntity\": {\n \"Id\": \"someId2\",\n \"Type\": \"title_player_account\",\n \"TypeString\": \"title_player_account\"\n },\n \"GivingCollectionId\": \"default\",\n \"ReceivingCollectionId\": \"backpack\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{titleId}.playfabapi.com/Inventory/ExecuteTransferOperations")
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 \"Operations\": [\n {\n \"GivingItem\": {\n \"Id\": \"11111111-1111-1111-1111-111111111111\",\n \"StackId\": \"default\"\n },\n \"ReceivingItem\": {\n \"Id\": \"11111111-1111-1111-1111-111111111111\",\n \"StackId\": \"default\"\n },\n \"Amount\": 1\n }\n ],\n \"GivingEntity\": {\n \"Id\": \"someId1\",\n \"Type\": \"title_player_account\",\n \"TypeString\": \"title_player_account\"\n },\n \"ReceivingEntity\": {\n \"Id\": \"someId2\",\n \"Type\": \"title_player_account\",\n \"TypeString\": \"title_player_account\"\n },\n \"GivingCollectionId\": \"default\",\n \"ReceivingCollectionId\": \"backpack\"\n}"
response = http.request(request)
puts response.read_body{
"code": 123,
"status": "<string>",
"data": {
"GivingETag": "<string>",
"GivingTransactionIds": [
"<string>"
],
"IdempotencyId": "<string>",
"OperationStatus": "<string>",
"OperationToken": "<string>",
"ReceivingETag": "<string>",
"ReceivingTransactionIds": [
"<string>"
]
}
}{
"code": 123,
"errorCode": 123,
"status": "<string>",
"error": "<string>",
"errorMessage": "<string>",
"errorDetails": {}
}Autorisations
This API requires an Entity Session Token, available from the Entity GetEntityToken method.
Corps
Transfer the specified list of inventory items of an entity's container Id to another entity's container Id.
Transfer the specified list of inventory items of an entity's container Id to another entity's container Id.
The optional custom tags associated with the request (e.g. build number, external trace identifiers, etc.).
The inventory collection id the request is transferring from. (Default="default")
The entity the request is transferring from. Set to the caller by default.
Show child attributes
Show child attributes
ETags are used for concurrency checking when updating resources. More information about using ETags can be found here: https://learn.microsoft.com/en-us/gaming/playfab/features/economy-v2/catalog/etags
The idempotency id for the request.
The transfer operations to run transactionally. The operations will be executed in-order sequentially and will succeed or fail as a batch. Up to 50 operations can be added.
Show child attributes
Show child attributes
The inventory collection id the request is transferring to. (Default="default")
The entity the request is transferring to. Set to the caller by default.
Show child attributes
Show child attributes
Sujets connexes
Exécuter des opérations d'inventairePFInventoryExecuteTransferOperationsRequestService de protocole de transfert (XbtpLinkSvc.exe)PFInventoryExecuteTransferOperationsResponsePFInventoryTransferInventoryItemsAsyncCette page vous a-t-elle été utile ?
curl --request POST \
--url https://{titleId}.playfabapi.com/Inventory/ExecuteTransferOperations \
--header 'Content-Type: application/json' \
--header 'X-EntityToken: <api-key>' \
--data '
{
"Operations": [
{
"GivingItem": {
"Id": "11111111-1111-1111-1111-111111111111",
"StackId": "default"
},
"ReceivingItem": {
"Id": "11111111-1111-1111-1111-111111111111",
"StackId": "default"
},
"Amount": 1
}
],
"GivingEntity": {
"Id": "someId1",
"Type": "title_player_account",
"TypeString": "title_player_account"
},
"ReceivingEntity": {
"Id": "someId2",
"Type": "title_player_account",
"TypeString": "title_player_account"
},
"GivingCollectionId": "default",
"ReceivingCollectionId": "backpack"
}
'import requests
url = "https://{titleId}.playfabapi.com/Inventory/ExecuteTransferOperations"
payload = {
"Operations": [
{
"GivingItem": {
"Id": "11111111-1111-1111-1111-111111111111",
"StackId": "default"
},
"ReceivingItem": {
"Id": "11111111-1111-1111-1111-111111111111",
"StackId": "default"
},
"Amount": 1
}
],
"GivingEntity": {
"Id": "someId1",
"Type": "title_player_account",
"TypeString": "title_player_account"
},
"ReceivingEntity": {
"Id": "someId2",
"Type": "title_player_account",
"TypeString": "title_player_account"
},
"GivingCollectionId": "default",
"ReceivingCollectionId": "backpack"
}
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({
Operations: [
{
GivingItem: {Id: '11111111-1111-1111-1111-111111111111', StackId: 'default'},
ReceivingItem: {Id: '11111111-1111-1111-1111-111111111111', StackId: 'default'},
Amount: 1
}
],
GivingEntity: {
Id: 'someId1',
Type: 'title_player_account',
TypeString: 'title_player_account'
},
ReceivingEntity: {
Id: 'someId2',
Type: 'title_player_account',
TypeString: 'title_player_account'
},
GivingCollectionId: 'default',
ReceivingCollectionId: 'backpack'
})
};
fetch('https://{titleId}.playfabapi.com/Inventory/ExecuteTransferOperations', 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/Inventory/ExecuteTransferOperations",
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([
'Operations' => [
[
'GivingItem' => [
'Id' => '11111111-1111-1111-1111-111111111111',
'StackId' => 'default'
],
'ReceivingItem' => [
'Id' => '11111111-1111-1111-1111-111111111111',
'StackId' => 'default'
],
'Amount' => 1
]
],
'GivingEntity' => [
'Id' => 'someId1',
'Type' => 'title_player_account',
'TypeString' => 'title_player_account'
],
'ReceivingEntity' => [
'Id' => 'someId2',
'Type' => 'title_player_account',
'TypeString' => 'title_player_account'
],
'GivingCollectionId' => 'default',
'ReceivingCollectionId' => 'backpack'
]),
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/Inventory/ExecuteTransferOperations"
payload := strings.NewReader("{\n \"Operations\": [\n {\n \"GivingItem\": {\n \"Id\": \"11111111-1111-1111-1111-111111111111\",\n \"StackId\": \"default\"\n },\n \"ReceivingItem\": {\n \"Id\": \"11111111-1111-1111-1111-111111111111\",\n \"StackId\": \"default\"\n },\n \"Amount\": 1\n }\n ],\n \"GivingEntity\": {\n \"Id\": \"someId1\",\n \"Type\": \"title_player_account\",\n \"TypeString\": \"title_player_account\"\n },\n \"ReceivingEntity\": {\n \"Id\": \"someId2\",\n \"Type\": \"title_player_account\",\n \"TypeString\": \"title_player_account\"\n },\n \"GivingCollectionId\": \"default\",\n \"ReceivingCollectionId\": \"backpack\"\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/Inventory/ExecuteTransferOperations")
.header("X-EntityToken", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"Operations\": [\n {\n \"GivingItem\": {\n \"Id\": \"11111111-1111-1111-1111-111111111111\",\n \"StackId\": \"default\"\n },\n \"ReceivingItem\": {\n \"Id\": \"11111111-1111-1111-1111-111111111111\",\n \"StackId\": \"default\"\n },\n \"Amount\": 1\n }\n ],\n \"GivingEntity\": {\n \"Id\": \"someId1\",\n \"Type\": \"title_player_account\",\n \"TypeString\": \"title_player_account\"\n },\n \"ReceivingEntity\": {\n \"Id\": \"someId2\",\n \"Type\": \"title_player_account\",\n \"TypeString\": \"title_player_account\"\n },\n \"GivingCollectionId\": \"default\",\n \"ReceivingCollectionId\": \"backpack\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{titleId}.playfabapi.com/Inventory/ExecuteTransferOperations")
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 \"Operations\": [\n {\n \"GivingItem\": {\n \"Id\": \"11111111-1111-1111-1111-111111111111\",\n \"StackId\": \"default\"\n },\n \"ReceivingItem\": {\n \"Id\": \"11111111-1111-1111-1111-111111111111\",\n \"StackId\": \"default\"\n },\n \"Amount\": 1\n }\n ],\n \"GivingEntity\": {\n \"Id\": \"someId1\",\n \"Type\": \"title_player_account\",\n \"TypeString\": \"title_player_account\"\n },\n \"ReceivingEntity\": {\n \"Id\": \"someId2\",\n \"Type\": \"title_player_account\",\n \"TypeString\": \"title_player_account\"\n },\n \"GivingCollectionId\": \"default\",\n \"ReceivingCollectionId\": \"backpack\"\n}"
response = http.request(request)
puts response.read_body{
"code": 123,
"status": "<string>",
"data": {
"GivingETag": "<string>",
"GivingTransactionIds": [
"<string>"
],
"IdempotencyId": "<string>",
"OperationStatus": "<string>",
"OperationToken": "<string>",
"ReceivingETag": "<string>",
"ReceivingTransactionIds": [
"<string>"
]
}
}{
"code": 123,
"errorCode": 123,
"status": "<string>",
"error": "<string>",
"errorMessage": "<string>",
"errorDetails": {}
}