question

Choi Yan Lok avatar image
Choi Yan Lok asked

Cannot update user inventory item custom data : "The value for key [key] is not valid JSON" error

Whenever I tried to call UpdateUserInventoryItemCustomData or GrantItemsToUsers, It always returns an "Invalid input parameters : The value for key [key] is not valid JSON" error.

However, I am sure that my input parameters are valid JSON data. I tried copy and pasting the example data from the API documentation, and they still return the same error.

This problem can be reproduced on Postman and cloud script

Example 1 - UpdateUserInventoryItemCustomData (string value)

Request

POST /Server/UpdateUserInventoryItemCustomData?sdk=PostmanCollection-0.85.190717 HTTP/1.1
Host: E62CC.playfabapi.com
X-PlayFabSDK: PostmanCollection-0.85.190717
Content-Type: application/json
X-SecretKey: {CENSORED}
Cache-Control: no-cache
Postman-Token: aa4ff17d-a754-f5d7-174e-b471cf73313e


{
  "PlayFabId": "E9BD228FBFDF111A",
  "ItemInstanceId": "CE128A3744FE8E7D",
  "Data": {
    "Equipped": "True",
    "Slot": "Head"
  }
}

Response

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

It returns a invalid JSON error.

Example 2 - GrantItemsToUsers

Please take a look.

Thank you!

3 comments
10 |1200

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

Choi Yan Lok avatar image Choi Yan Lok commented ·

Seems like it is only affecting one of my title (E62CC)
I wonder what cause it...?

0 Likes 0 ·
Citrus Yan avatar image Citrus Yan Choi Yan Lok commented ·

Hi, I tested in my title and it seems that my title wasn't affected. I will inform the engineering team to investigate, any updates will let you know, and sorry for this inconvenience.

1 Like 1 ·
Citrus Yan avatar image Citrus Yan Choi Yan Lok commented ·

I also found out that if I check “Require valid JSON for custom data values” in [Title settings] -> [API Feature], I can reproduce the "InvalidParams" error. It should work when you uncheck that.

1 Like 1 ·

0 Answers

·

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.