Started looking at/playing with the new REST game API today...
Am I correct is stating that if I want to send in a Leaderboard (for example) entry, I need to know whether it exists already in the current game configuration (because of the POST vs PUT url format differences) ?
If I try to POST it again, it will tell me that it's name is not unique
If I try to PUT it (without it existing already), it will tell me that the id does not exist.
So essentially, I need to try a GET (or pull the whole game config ahead of time) and determine if game element is already present (for that id) first ....keerect?
thanks in advance!!
Best Answer
C
Customer Support
said
over 6 years ago
Hi Jeff,
Yes you would use a POST request to insert a new piece of configuration, a PUT request would be used to update an existing piece of game configuration. To answer your last question yes you would need to GET the game configuration or have prior knowledge of what is already in place in the game. When getting the game config through the REST API you can set "full" to false to return a summarized version of the game configuration. For example the events array would look like this.
With "full" set to true it would include , name, description, shortCode etc... I hope this helps, if you have any further questions just let us know.
Thanks,
Liam
1 Comment
Customer Support
said
over 6 years ago
Answer
Hi Jeff,
Yes you would use a POST request to insert a new piece of configuration, a PUT request would be used to update an existing piece of game configuration. To answer your last question yes you would need to GET the game configuration or have prior knowledge of what is already in place in the game. When getting the game config through the REST API you can set "full" to false to return a summarized version of the game configuration. For example the events array would look like this.
Jeff Amiel
Started looking at/playing with the new REST game API today...
Am I correct is stating that if I want to send in a Leaderboard (for example) entry, I need to know whether it exists already in the current game configuration (because of the POST vs PUT url format differences) ?
If I try to POST it again, it will tell me that it's name is not unique
If I try to PUT it (without it existing already), it will tell me that the id does not exist.
So essentially, I need to try a GET (or pull the whole game config ahead of time) and determine if game element is already present (for that id) first ....keerect?
thanks in advance!!
Hi Jeff,
Yes you would use a POST request to insert a new piece of configuration, a PUT request would be used to update an existing piece of game configuration. To answer your last question yes you would need to GET the game configuration or have prior knowledge of what is already in place in the game. When getting the game config through the REST API you can set "full" to false to return a summarized version of the game configuration. For example the events array would look like this.
With "full" set to true it would include , name, description, shortCode etc... I hope this helps, if you have any further questions just let us know.
Thanks,
Liam
Customer Support
Hi Jeff,
Yes you would use a POST request to insert a new piece of configuration, a PUT request would be used to update an existing piece of game configuration. To answer your last question yes you would need to GET the game configuration or have prior knowledge of what is already in place in the game. When getting the game config through the REST API you can set "full" to false to return a summarized version of the game configuration. For example the events array would look like this.
With "full" set to true it would include , name, description, shortCode etc... I hope this helps, if you have any further questions just let us know.
Thanks,
Liam
-
Documentation Notes
-
Design issues with user events
-
Using NoSQL
-
Runtime Collections vs Metadata Collections
-
Anonymous authentication from browser app
-
Modules
-
Movement With Unity
-
Problem with url parameters for downloadables
-
Querying NoSql GameSparks database
-
Challenge accesType
See all 2487 topics