question

sudhakerraon avatar image
sudhakerraon asked

Having trouble with UpdatePlayerStatistics Call Api

I'm trying the UpdatePlayerStatistics API (https://api.playfab.com/documentation/client/method/UpdatePlayerStatistics) via the "Try It" option in the documentation. how do i give input for Statistics(Required). this takes in json format. writing in that format always results in "Invalid input parameters" error.

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

·
brendan avatar image
brendan answered

What, specifically, are you entering for the Statistics parameter?

For example, this would return a 200 (OK):

[ { "StatisticName": "HeadShots", "Value": 1 } ]

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.

agittm avatar image agittm commented ·

Hi @Brendan I tried that line on Try It feature and works fine, but when I POST it using AJAX, it always return :

{
	"code": 400,
	"status": "BadRequest",
	"error": "InvalidParams",
	"errorCode": 1000,
	"errorMessage": "Invalid input parameters",
	"errorDetails": {
		"Statistics": ["The Statistics field is required."]
	}
}
0 Likes 0 ·
brendan avatar image brendan agittm commented ·

That tells me that the formatting of the body of your call doesn't have Statistics in there correctly, since the service can't find it. If you try the call in Postman, you'll see that it does work using the documented format. Can you post the specifics of the Ajax call you're making?

0 Likes 0 ·
agittm avatar image agittm brendan commented ·

Ah I got it, so there is a different between AJAX call and the Try It feature. Thanks, man!

0 Likes 0 ·

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.