Sign In Register

How can we help you today?

Start a new topic

DateTime REST API trouble

I am implementing a system that allows me to upload my cloud code scripts from my own machine without going through Bitbucket or Zip upload (which became impossible now that my scripts have become larger).


[POST] /restv2/game/{apiKey}/config/~scripts 


This is the one that is giving me trouble. I am testing the online version with the provided schema (see below). My goal is to pass the modification time of each file into lastSaved so I can sync them by comparing the times.

{
  "@id": "string",
  "lastSaved": "2018-11-25T17:11:18.276Z",
  "name": "string",
  "script": "string",
  "type": "callbacks"
}

 This is the example from your documentation and when I try to run it online it fails with  

{
  "errorCode": "bad_request",
  "message": "java.text.ParseException: Unparseable date: \"2018-11-25T17:11:18.276Z\" (through reference chain: com.wagerz.devportal.domain.EventProcessor[\"lastSaved\"])"
}

It would be easy for me to pass in any another datetime format to fullfil the requirements of the API, but I would need to know which one is expected and my Java knowledge is basically nil.


[GET] /restv2/game/{apiKey}/config/~scripts 

 

I also have a bonus question about the get API: Is it possible to get a list of scripts without the actual script content being included. The request above tends provides a large response when I just want to know if a file exists in cloud code and when it was last changed.


Any help or pointers are appreciated!


Patrick


I got it to work. Thank you. The only caveat is that that provided LastSaved date is being ignored and apparently replaced with the given server time. I am now doing a round trip after the update to re-get the remote scripts and then simply set my local timestamp to that one on the server. That works well enough. 


Retrieving the game config will however not work, since that one only returns the script id, but no information about the time it was last saved. I will open up a ticket with a request for a new parameter on that API endpoint that allows as to specify if we want the full dataset or a shortened one just like the game config API endpoint does.


Thanks again for the help.

Hi Vinnie,


that is awesome intel, thank you. I will try it out today and let you know.


Thank you very much.


Patrick

Hi Patrick,


There is an issue with the provided date format in the documentation (thanks for raising this with us, I'll let our documentation team know). If you send the date with minute precision it should resolve this error for you; for example:


"lastSaved":"2018-11-25T17:11Z"


Let me know if this resolves the issue for you. Regarding your other question; I think your best bet here would be to perform a get request on the config specifying full = false (https://docs.gamesparks.com/api-documentation/rest-apis/game-configuration.html#!/game/get_restv2_game_apiKey_config). This will return an overview of everything that's in your game, with just an identifier for each.


Regards,

Vinnie

Login to post a comment