撤銷多個庫存物品
NOTE: This is a Legacy Economy API, and is in bugfix-only mode. All new Economy features are being developed only for version 2. Revokes access for up to 25 items across multiple users and characters.
Error codes
This operation may return the following PlayFab errors:
| Error | Code |
|---|---|
| ItemNotFound | 1047 |
| ProductDisabledForTitle | 1609 |
curl --request POST \
--url https://{titleId}.playfabapi.com/Server/RevokeInventoryItems \
--header 'Content-Type: application/json' \
--header 'X-SecretKey: <api-key>' \
--data '
{
"Items": [
{
"PlayFabId": "203945882",
"ItemInstanceId": "2048583045"
}
]
}
'import requests
url = "https://{titleId}.playfabapi.com/Server/RevokeInventoryItems"
payload = { "Items": [
{
"PlayFabId": "203945882",
"ItemInstanceId": "2048583045"
}
] }
headers = {
"X-SecretKey": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-SecretKey': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({Items: [{PlayFabId: '203945882', ItemInstanceId: '2048583045'}]})
};
fetch('https://{titleId}.playfabapi.com/Server/RevokeInventoryItems', 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/Server/RevokeInventoryItems",
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([
'Items' => [
[
'PlayFabId' => '203945882',
'ItemInstanceId' => '2048583045'
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-SecretKey: <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/Server/RevokeInventoryItems"
payload := strings.NewReader("{\n \"Items\": [\n {\n \"PlayFabId\": \"203945882\",\n \"ItemInstanceId\": \"2048583045\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-SecretKey", "<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/Server/RevokeInventoryItems")
.header("X-SecretKey", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"Items\": [\n {\n \"PlayFabId\": \"203945882\",\n \"ItemInstanceId\": \"2048583045\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{titleId}.playfabapi.com/Server/RevokeInventoryItems")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-SecretKey"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"Items\": [\n {\n \"PlayFabId\": \"203945882\",\n \"ItemInstanceId\": \"2048583045\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"code": 123,
"status": "<string>",
"data": {
"Errors": [
{
"Error": "Success",
"Item": {
"ItemInstanceId": "<string>",
"PlayFabId": "<string>",
"CharacterId": "<string>"
}
}
]
}
}{
"code": 123,
"errorCode": 123,
"status": "<string>",
"error": "<string>",
"errorMessage": "<string>",
"errorDetails": {}
}授權
This API requires a title secret key, available to title admins, from PlayFab Game Manager.
主體
In cases where the inventory item in question is a "crate", and the items it contained have already been dispensed, this will not revoke access or otherwise remove the items which were dispensed.
In cases where the inventory item in question is a "crate", and the items it contained have already been dispensed, this will not revoke access or otherwise remove the items which were dispensed.
Array of player items to revoke, between 1 and 25 items.
Show child attributes
Show child attributes
這個頁面有幫助嗎?
curl --request POST \
--url https://{titleId}.playfabapi.com/Server/RevokeInventoryItems \
--header 'Content-Type: application/json' \
--header 'X-SecretKey: <api-key>' \
--data '
{
"Items": [
{
"PlayFabId": "203945882",
"ItemInstanceId": "2048583045"
}
]
}
'import requests
url = "https://{titleId}.playfabapi.com/Server/RevokeInventoryItems"
payload = { "Items": [
{
"PlayFabId": "203945882",
"ItemInstanceId": "2048583045"
}
] }
headers = {
"X-SecretKey": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-SecretKey': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({Items: [{PlayFabId: '203945882', ItemInstanceId: '2048583045'}]})
};
fetch('https://{titleId}.playfabapi.com/Server/RevokeInventoryItems', 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/Server/RevokeInventoryItems",
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([
'Items' => [
[
'PlayFabId' => '203945882',
'ItemInstanceId' => '2048583045'
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-SecretKey: <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/Server/RevokeInventoryItems"
payload := strings.NewReader("{\n \"Items\": [\n {\n \"PlayFabId\": \"203945882\",\n \"ItemInstanceId\": \"2048583045\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-SecretKey", "<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/Server/RevokeInventoryItems")
.header("X-SecretKey", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"Items\": [\n {\n \"PlayFabId\": \"203945882\",\n \"ItemInstanceId\": \"2048583045\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{titleId}.playfabapi.com/Server/RevokeInventoryItems")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-SecretKey"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"Items\": [\n {\n \"PlayFabId\": \"203945882\",\n \"ItemInstanceId\": \"2048583045\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"code": 123,
"status": "<string>",
"data": {
"Errors": [
{
"Error": "Success",
"Item": {
"ItemInstanceId": "<string>",
"PlayFabId": "<string>",
"CharacterId": "<string>"
}
}
]
}
}{
"code": 123,
"errorCode": 123,
"status": "<string>",
"error": "<string>",
"errorMessage": "<string>",
"errorDetails": {}
}