question

ignoma avatar image
ignoma asked

Either I'm really missing something or UpdateUserData is broken?

I'm testing UploadUserData-request
The manual says the body data should look something like this:

{
  "Data": {
    "Class": "Fighter",
    "Gender": "Female",
    "Icon": "Guard 3",
    "Theme": "Colorful"
  },
  "Permission": "Public"
}

I am using my own custom API for GameMaker and try the request with identical body I get a response:

{
    "code": 400,
    "status": "BadRequest",
    "error": "InvalidParams",
    "errorCode": 1000,
    "errorMessage": "Invalid input parameters",
    "errorDetails": {
        "Data": [
            "The value for key Class was not valid JSON."
        ]
    }
}

I expected that the problem would be with my API but I tested the same with Postman and got identical results (also tried to switch to UpdateUserPublisherData with the same result)

The weird thing is that if I send only real values instead of strings everything works perfectly and values update in game manager. Also if I send non-escaped JSON as a value I get the same success message, but nothing updates in backend.

Also changing user had no effect.

EDIT: After a bit of testing I found out this only happens on one of my games "568C" but not on other ones.

Feel free to fiddle with the game profile with corresponding title id, it's just a test game.

playfab-error.png (75.0 KiB)
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
Seth Du avatar image
Seth Du answered

It can be caused by your API feature settings in your Game manager. Please navigate to [Game manager] -> [Settings] -> [API features] -> uncheck Require valid JSON for custom data values and see if it helps.

In case you want to enable Require valid JSON for custom data values. Here is some hits that can help you solve this issue. You may first call the GetUserData and as you can see from the response:

The value of TestData is a string with JSON format and be aware that quotation marks need to be escaped。

So, when calling UpdateUserData, you should also use the same format:


10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.