question

court avatar image
court asked

Tiny Bug: UpdatePlayerStatistic and invalid values

Hi -

This one's super tiny, and it was the result of an error on my part, but the error message sent me in the wrong direction. The values for UpdatePlayerStatistic are required to be integers -- I was incorrectly passing a floating point value for one of my stats.

{
"PlayFabId":"B951337287FA7DDA",
"Statistics":[
  {"StatisticName":"game.time","Value":22.785000133514405}
 ]
}

Response:

{
    "code": 400,
    "status": "BadRequest",
    "error": "InvalidParams",
    "errorCode": 1000,
    "errorMessage": "Invalid input parameters",
    "errorDetails": {
        "StatisticName": [
            "The StatisticName field is required."
        ]
    }
}

You can see the error is pointing to the StatisticName being incorrect, but it's the Value that's incorrect here. Super minor, but I thought it might be helpful to post anyway.

Cheers,

-Courtland

10 |1200

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

brendan avatar image
brendan answered

Apologies for the confusion - we'll make sure the docs are updated to clarify that only int values are allowed for stats, and we'll check on why the response is calling out the wrong parameter as being invalid.

2 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.

court avatar image court commented ·

No worries! I think the docs were clear enough -- I did know that the values were supposed to be integers, but I'm making the call from javascript, so a floating point value slipped through without me noticing (such is life in a typeless language). Thanks again! 100x easier than writing from scratch!

0 Likes 0 ·
brandon@uprootstudios.com avatar image brandon@uprootstudios.com commented ·

@Brendan Just wanted to let you know that I just stumbled across this bug myself. We tried to submit both 4000 and 4004.16666666 to our statistic "Main Rank" using the same cloudscript, and it fails with

"errorDetails": {
   "StatisticName": [
      "The StatisticName field is required."
   ]
}

if the Value is not an integer.

0 Likes 0 ·
Jon avatar image
Jon answered

It looks like this bug is still here. If you try to update statistic with a float, it will return an error that "The StatisticName field is required."

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.