Spent a while wondering why the heck my code isn't working.
Docs show result.data.Data.preferences.Value as the example
However, the actual result returned result.Data.preferences.Value
This example was pulled from server.GetUserData but I'm sure this isn't the only one. Super confusing~
Answer by Brendan · Jul 21, 2017 at 11:38 PM
In the response to any API call, if there's anything in the response, that will always be in the section "data", like so:
{ "code": 200, "status": "OK", "data": { // response properties go here } }
In the case of some API calls, like all the Get...Data ones, there's a specific property in the response named "Data" (ex: https://api.playfab.com/documentation/server/method/GetUserData). So the response for those will always have something like this:
{ "code": 200, "status": "OK", "data": { "Data": { // contents of the property Data go here } } }
Now, in Cloud Script, what you're specifically getting back is the contents of the "data" section of the response - not the whole response body with the code and status (in the case of errors, you get the complete body of the response back in the apiError).
If you're seeing anywhere there's an inconsistency in this, can you please provide specifics?
Ahhhh so cloudscript skips that root parent level completely? That's with all calls eh? This helped, thanks!