Get Cloud Script Revision
Gets the contents and information of a specific Cloud Script revision.
Error codes
This operation may return the following PlayFab errors:
| Error | Code |
|---|---|
| ProductDisabledForTitle | 1609 |
| RevisionNotFound | 1125 |
| VersionNotFound | 1124 |
POST
/
Admin
/
GetCloudScriptRevision
Get Cloud Script Revision
curl --request POST \
--url https://{titleId}.playfabapi.com/Admin/GetCloudScriptRevision \
--header 'Content-Type: application/json' \
--header 'X-SecretKey: <api-key>' \
--data '
{
"Version": 1,
"Revision": 3
}
'import requests
url = "https://{titleId}.playfabapi.com/Admin/GetCloudScriptRevision"
payload = {
"Version": 1,
"Revision": 3
}
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({Version: 1, Revision: 3})
};
fetch('https://{titleId}.playfabapi.com/Admin/GetCloudScriptRevision', 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/Admin/GetCloudScriptRevision",
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([
'Version' => 1,
'Revision' => 3
]),
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/Admin/GetCloudScriptRevision"
payload := strings.NewReader("{\n \"Version\": 1,\n \"Revision\": 3\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/Admin/GetCloudScriptRevision")
.header("X-SecretKey", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"Version\": 1,\n \"Revision\": 3\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{titleId}.playfabapi.com/Admin/GetCloudScriptRevision")
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 \"Version\": 1,\n \"Revision\": 3\n}"
response = http.request(request)
puts response.read_body{
"code": 200,
"status": "OK",
"data": {
"Version": 1,
"Revision": 3,
"CreatedAt": "2015-01-03T17:44:21",
"Files": [
{
"Filename": "main.js",
"FileContents": "var LevelRewards =\r\n[\r\n\t[\"TestItem1\"],\r\n\t[\"TestItem2\"],\r\n\t[\"TestItem3\"],\r\n\t[\"TestItem1\", \"TestItem2\"],\r\n\t[\"TestItem2\", \"TestItem2\"],\r\n\t[\"TestItem3\", \"TestItem3\"]\r\n]\r\n\r\nhandlers.onLevelComplete = function(args)\r\n{\r\n\tvar levelNum = args.level;\r\n\t\r\n\t// Do some basic input validation\r\n\tif(levelNum < 0 || levelNum >= LevelRewards.length)\r\n\t{\r\n\t\tlog.info(\"Invalid level \"+levelNum+\" completed by \"+currentPlayerId);\r\n\t\treturn {};\r\n\t}\r\n\t\r\n\tvar levelCompleteKey = \"LevelCompleted\"+levelNum;\r\n\t\r\n\t// Get the user's internal data\r\n\tvar playerInternalData = server.GetUserInternalData(\r\n\t{\r\n\t\tPlayFabId: currentPlayerId,\r\n\t\tKeys: [levelCompleteKey]\r\n\t});\r\n\t\r\n\t// Did they already complete this level?\r\n\tif(playerInternalData.Data[levelCompleteKey])\r\n\t{\r\n\t\tlog.info(\"Player \"+currentPlayerId+\" already completed level \"+levelNum);\r\n\t\treturn {};\r\n\t}\r\n\t\r\n\tvar rewards = LevelRewards[levelNum];\r\n\t\r\n\tvar resultItems = null;\r\n\tif(rewards)\r\n\t{\r\n\t\t// Grant reward items to player for completing the level\r\n\t\tvar itemGrantResult = server.GrantItemsToUser(\r\n\t\t{\r\n\t\t\tPlayFabId: currentPlayerId,\r\n\t\t\tAnnotation: \"Given by completing level \"+levelNum,\r\n\t\t\tItemIds: rewards\r\n\t\t});\r\n\t\t\r\n\t\tresultItems = itemGrantResult.ItemGrantResults;\r\n\t}\r\n\t\r\n\t// Mark the level as being completed so they can't get the reward again\r\n\tvar saveData = {};\r\n\tsaveData[levelCompleteKey] = \"true\";\r\n\tserver.UpdateUserInternalData(\r\n\t{\r\n\t\tPlayFabId: currentPlayerId,\r\n\t\tData: saveData\r\n\t});\r\n\r\n\t// Return the results of the item grant so the client can see what they got\r\n\treturn {\r\n\t\trewards: resultItems\r\n\t};\r\n}\r\n\r\nvar monsterRewards =\r\n{\r\n\t\"skrill\" : { \"ChumpCoins\" : 100},\r\n\t\"lumpur\" : { \"ChumpCoins\" : 200}\r\n}\r\n\r\nvar killCoolDown = 60;\r\n\r\nfunction currTimeSeconds()\r\n{\r\n\tvar now = new Date();\r\n\treturn now.getTime() / 1000;\r\n}\r\n\r\nhandlers.monsterKilled = function(args)\r\n{\r\n\tvar monsterType = args.type;\r\n\t\r\n\tvar now = currTimeSeconds();\r\n\t\r\n\t// Get the user's internal data\r\n\tvar playerInternalData = server.GetUserInternalData(\r\n\t{\r\n\t\tPlayFabId: currentPlayerId,\r\n\t\tKeys: [\"lastKill\"]\r\n\t});\r\n\t\r\n\t// Check when the last time they killed a monster was \r\n\tvar lastKill = playerInternalData.Data[\"lastKill\"];\r\n\tif(lastKill)\r\n\t{\r\n\t\t// We have a value, see when it is\r\n\t\tvar lastKillTime = parseInt(lastKill.Value);\r\n\t\tif(now - lastKillTime < killCoolDown)\r\n\t\t{\r\n\t\t\t// In this particular game, it should not be possible to kill a monster more often than once a minute, so they might be cheating\r\n\t\t\tlog.info(\"Player \"+currentPlayerId+\" killed \"+monsterType+\" again too quickly!\");\r\n\t\t\treturn {};\r\n\t\t}\r\n\t}\r\n\t\r\n\tvar killReward = monsterRewards[monsterType];\r\n\t\r\n\tif(killReward)\r\n\t{\r\n\t\tfor(var currency in killReward)\r\n\t\t{\r\n\t\t\tvar amount = killReward[currency];\r\n\t\t\tserver.AddUserVirtualCurrency({ PlayFabId: currentPlayerId, VirtualCurrency: currency, Amount: amount });\r\n\t\t}\r\n\t}\r\n\t\r\n\t// Reset the kill timer\r\n\tserver.UpdateUserInternalData(\r\n\t{\r\n\t\tPlayFabId: currentPlayerId,\r\n\t\tData: {\r\n\t\t\t\"lastKill\" : String(now)\r\n\t\t}\r\n\t});\r\n\t\r\n\treturn {\r\n\t\trewards: killReward\r\n\t};\r\n}"
}
],
"IsPublished": true
}
}{
"code": 123,
"errorCode": 123,
"status": "<string>",
"error": "<string>",
"errorMessage": "<string>",
"errorDetails": {}
}Authorizations
This API requires a title secret key, available to title admins, from PlayFab Game Manager.
Body
application/json
Response
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
Example:
{
"Version": 1,
"Revision": 3,
"CreatedAt": "2015-01-03T17:44:21",
"Files": [
{
"Filename": "main.js",
"FileContents": "var LevelRewards =\r\n[\r\n\t[\"TestItem1\"],\r\n\t[\"TestItem2\"],\r\n\t[\"TestItem3\"],\r\n\t[\"TestItem1\", \"TestItem2\"],\r\n\t[\"TestItem2\", \"TestItem2\"],\r\n\t[\"TestItem3\", \"TestItem3\"]\r\n]\r\n\r\nhandlers.onLevelComplete = function(args)\r\n{\r\n\tvar levelNum = args.level;\r\n\t\r\n\t// Do some basic input validation\r\n\tif(levelNum < 0 || levelNum >= LevelRewards.length)\r\n\t{\r\n\t\tlog.info(\"Invalid level \"+levelNum+\" completed by \"+currentPlayerId);\r\n\t\treturn {};\r\n\t}\r\n\t\r\n\tvar levelCompleteKey = \"LevelCompleted\"+levelNum;\r\n\t\r\n\t// Get the user's internal data\r\n\tvar playerInternalData = server.GetUserInternalData(\r\n\t{\r\n\t\tPlayFabId: currentPlayerId,\r\n\t\tKeys: [levelCompleteKey]\r\n\t});\r\n\t\r\n\t// Did they already complete this level?\r\n\tif(playerInternalData.Data[levelCompleteKey])\r\n\t{\r\n\t\tlog.info(\"Player \"+currentPlayerId+\" already completed level \"+levelNum);\r\n\t\treturn {};\r\n\t}\r\n\t\r\n\tvar rewards = LevelRewards[levelNum];\r\n\t\r\n\tvar resultItems = null;\r\n\tif(rewards)\r\n\t{\r\n\t\t// Grant reward items to player for completing the level\r\n\t\tvar itemGrantResult = server.GrantItemsToUser(\r\n\t\t{\r\n\t\t\tPlayFabId: currentPlayerId,\r\n\t\t\tAnnotation: \"Given by completing level \"+levelNum,\r\n\t\t\tItemIds: rewards\r\n\t\t});\r\n\t\t\r\n\t\tresultItems = itemGrantResult.ItemGrantResults;\r\n\t}\r\n\t\r\n\t// Mark the level as being completed so they can't get the reward again\r\n\tvar saveData = {};\r\n\tsaveData[levelCompleteKey] = \"true\";\r\n\tserver.UpdateUserInternalData(\r\n\t{\r\n\t\tPlayFabId: currentPlayerId,\r\n\t\tData: saveData\r\n\t});\r\n\r\n\t// Return the results of the item grant so the client can see what they got\r\n\treturn {\r\n\t\trewards: resultItems\r\n\t};\r\n}\r\n\r\nvar monsterRewards =\r\n{\r\n\t\"skrill\" : { \"ChumpCoins\" : 100},\r\n\t\"lumpur\" : { \"ChumpCoins\" : 200}\r\n}\r\n\r\nvar killCoolDown = 60;\r\n\r\nfunction currTimeSeconds()\r\n{\r\n\tvar now = new Date();\r\n\treturn now.getTime() / 1000;\r\n}\r\n\r\nhandlers.monsterKilled = function(args)\r\n{\r\n\tvar monsterType = args.type;\r\n\t\r\n\tvar now = currTimeSeconds();\r\n\t\r\n\t// Get the user's internal data\r\n\tvar playerInternalData = server.GetUserInternalData(\r\n\t{\r\n\t\tPlayFabId: currentPlayerId,\r\n\t\tKeys: [\"lastKill\"]\r\n\t});\r\n\t\r\n\t// Check when the last time they killed a monster was \r\n\tvar lastKill = playerInternalData.Data[\"lastKill\"];\r\n\tif(lastKill)\r\n\t{\r\n\t\t// We have a value, see when it is\r\n\t\tvar lastKillTime = parseInt(lastKill.Value);\r\n\t\tif(now - lastKillTime < killCoolDown)\r\n\t\t{\r\n\t\t\t// In this particular game, it should not be possible to kill a monster more often than once a minute, so they might be cheating\r\n\t\t\tlog.info(\"Player \"+currentPlayerId+\" killed \"+monsterType+\" again too quickly!\");\r\n\t\t\treturn {};\r\n\t\t}\r\n\t}\r\n\t\r\n\tvar killReward = monsterRewards[monsterType];\r\n\t\r\n\tif(killReward)\r\n\t{\r\n\t\tfor(var currency in killReward)\r\n\t\t{\r\n\t\t\tvar amount = killReward[currency];\r\n\t\t\tserver.AddUserVirtualCurrency({ PlayFabId: currentPlayerId, VirtualCurrency: currency, Amount: amount });\r\n\t\t}\r\n\t}\r\n\t\r\n\t// Reset the kill timer\r\n\tserver.UpdateUserInternalData(\r\n\t{\r\n\t\tPlayFabId: currentPlayerId,\r\n\t\tData: {\r\n\t\t\t\"lastKill\" : String(now)\r\n\t\t}\r\n\t});\r\n\t\r\n\treturn {\r\n\t\trewards: killReward\r\n\t};\r\n}"
}
],
"IsPublished": true
}
Last modified on October 1, 2026
Was this page helpful?
⌘I
Get Cloud Script Revision
curl --request POST \
--url https://{titleId}.playfabapi.com/Admin/GetCloudScriptRevision \
--header 'Content-Type: application/json' \
--header 'X-SecretKey: <api-key>' \
--data '
{
"Version": 1,
"Revision": 3
}
'import requests
url = "https://{titleId}.playfabapi.com/Admin/GetCloudScriptRevision"
payload = {
"Version": 1,
"Revision": 3
}
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({Version: 1, Revision: 3})
};
fetch('https://{titleId}.playfabapi.com/Admin/GetCloudScriptRevision', 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/Admin/GetCloudScriptRevision",
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([
'Version' => 1,
'Revision' => 3
]),
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/Admin/GetCloudScriptRevision"
payload := strings.NewReader("{\n \"Version\": 1,\n \"Revision\": 3\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/Admin/GetCloudScriptRevision")
.header("X-SecretKey", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"Version\": 1,\n \"Revision\": 3\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{titleId}.playfabapi.com/Admin/GetCloudScriptRevision")
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 \"Version\": 1,\n \"Revision\": 3\n}"
response = http.request(request)
puts response.read_body{
"code": 200,
"status": "OK",
"data": {
"Version": 1,
"Revision": 3,
"CreatedAt": "2015-01-03T17:44:21",
"Files": [
{
"Filename": "main.js",
"FileContents": "var LevelRewards =\r\n[\r\n\t[\"TestItem1\"],\r\n\t[\"TestItem2\"],\r\n\t[\"TestItem3\"],\r\n\t[\"TestItem1\", \"TestItem2\"],\r\n\t[\"TestItem2\", \"TestItem2\"],\r\n\t[\"TestItem3\", \"TestItem3\"]\r\n]\r\n\r\nhandlers.onLevelComplete = function(args)\r\n{\r\n\tvar levelNum = args.level;\r\n\t\r\n\t// Do some basic input validation\r\n\tif(levelNum < 0 || levelNum >= LevelRewards.length)\r\n\t{\r\n\t\tlog.info(\"Invalid level \"+levelNum+\" completed by \"+currentPlayerId);\r\n\t\treturn {};\r\n\t}\r\n\t\r\n\tvar levelCompleteKey = \"LevelCompleted\"+levelNum;\r\n\t\r\n\t// Get the user's internal data\r\n\tvar playerInternalData = server.GetUserInternalData(\r\n\t{\r\n\t\tPlayFabId: currentPlayerId,\r\n\t\tKeys: [levelCompleteKey]\r\n\t});\r\n\t\r\n\t// Did they already complete this level?\r\n\tif(playerInternalData.Data[levelCompleteKey])\r\n\t{\r\n\t\tlog.info(\"Player \"+currentPlayerId+\" already completed level \"+levelNum);\r\n\t\treturn {};\r\n\t}\r\n\t\r\n\tvar rewards = LevelRewards[levelNum];\r\n\t\r\n\tvar resultItems = null;\r\n\tif(rewards)\r\n\t{\r\n\t\t// Grant reward items to player for completing the level\r\n\t\tvar itemGrantResult = server.GrantItemsToUser(\r\n\t\t{\r\n\t\t\tPlayFabId: currentPlayerId,\r\n\t\t\tAnnotation: \"Given by completing level \"+levelNum,\r\n\t\t\tItemIds: rewards\r\n\t\t});\r\n\t\t\r\n\t\tresultItems = itemGrantResult.ItemGrantResults;\r\n\t}\r\n\t\r\n\t// Mark the level as being completed so they can't get the reward again\r\n\tvar saveData = {};\r\n\tsaveData[levelCompleteKey] = \"true\";\r\n\tserver.UpdateUserInternalData(\r\n\t{\r\n\t\tPlayFabId: currentPlayerId,\r\n\t\tData: saveData\r\n\t});\r\n\r\n\t// Return the results of the item grant so the client can see what they got\r\n\treturn {\r\n\t\trewards: resultItems\r\n\t};\r\n}\r\n\r\nvar monsterRewards =\r\n{\r\n\t\"skrill\" : { \"ChumpCoins\" : 100},\r\n\t\"lumpur\" : { \"ChumpCoins\" : 200}\r\n}\r\n\r\nvar killCoolDown = 60;\r\n\r\nfunction currTimeSeconds()\r\n{\r\n\tvar now = new Date();\r\n\treturn now.getTime() / 1000;\r\n}\r\n\r\nhandlers.monsterKilled = function(args)\r\n{\r\n\tvar monsterType = args.type;\r\n\t\r\n\tvar now = currTimeSeconds();\r\n\t\r\n\t// Get the user's internal data\r\n\tvar playerInternalData = server.GetUserInternalData(\r\n\t{\r\n\t\tPlayFabId: currentPlayerId,\r\n\t\tKeys: [\"lastKill\"]\r\n\t});\r\n\t\r\n\t// Check when the last time they killed a monster was \r\n\tvar lastKill = playerInternalData.Data[\"lastKill\"];\r\n\tif(lastKill)\r\n\t{\r\n\t\t// We have a value, see when it is\r\n\t\tvar lastKillTime = parseInt(lastKill.Value);\r\n\t\tif(now - lastKillTime < killCoolDown)\r\n\t\t{\r\n\t\t\t// In this particular game, it should not be possible to kill a monster more often than once a minute, so they might be cheating\r\n\t\t\tlog.info(\"Player \"+currentPlayerId+\" killed \"+monsterType+\" again too quickly!\");\r\n\t\t\treturn {};\r\n\t\t}\r\n\t}\r\n\t\r\n\tvar killReward = monsterRewards[monsterType];\r\n\t\r\n\tif(killReward)\r\n\t{\r\n\t\tfor(var currency in killReward)\r\n\t\t{\r\n\t\t\tvar amount = killReward[currency];\r\n\t\t\tserver.AddUserVirtualCurrency({ PlayFabId: currentPlayerId, VirtualCurrency: currency, Amount: amount });\r\n\t\t}\r\n\t}\r\n\t\r\n\t// Reset the kill timer\r\n\tserver.UpdateUserInternalData(\r\n\t{\r\n\t\tPlayFabId: currentPlayerId,\r\n\t\tData: {\r\n\t\t\t\"lastKill\" : String(now)\r\n\t\t}\r\n\t});\r\n\t\r\n\treturn {\r\n\t\trewards: killReward\r\n\t};\r\n}"
}
],
"IsPublished": true
}
}{
"code": 123,
"errorCode": 123,
"status": "<string>",
"error": "<string>",
"errorMessage": "<string>",
"errorDetails": {}
}