question

omar avatar image
omar asked

UpdateUserData not working

I tried to use UpdateUserData from postman on a new user and using the example provided.

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

It always returns this error:

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

Is there a setup on the game that I'm missing ?

I want to add data to each user I'm creating.

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

I just ran that exact call in Postman on my own title (literally copying the body of the call above), and it worked fine. Can you send me the Postman Collection containing your exact call, so that I can reproduce this locally?

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

omar avatar image omar commented ·

It's exactly the one in the Playfab Postman SDK 0.37.170223 Collection, I didn't edit anything in the first call (I did edit after though trying to figure out what was wrong).

I'll send the postman collection with just that call to the support email.

0 Likes 0 ·
omar avatar image omar commented ·

brendanexamplepostman-collectionjson.txt

Ok, there it is (it was small), I had to rename it to txt to be able to upload it here.

0 Likes 0 ·
brendan avatar image brendan omar commented ·

So, I just imported that collection into my Postman, signed into my test title, and ran your example UpdateUserData call. It worked fine, returning an OK, and the player data was updated. Can you get a Wireshark capture (https://wiki.wireshark.org/SSL) so that we can have a look at what you're specifically sending to the service that's being rejected?

0 Likes 0 ·
omar avatar image omar commented ·

Hey Brendan,

First, I just found out the solution.

Instead of sending this:

{
  "Data": {
      "Class": "Fighter"
      },
  "Permission": "Public"
}

I encoded the value like this:

{
  "Data": {
      "Class": "\"Fighter\""
      },
  "Permission": "Public"
}

And now no problem.

What it's interesting to me is that for you, the first one worked fine (as it's the one I sent you before). Can you explain to me why is this ?

Second, installed Wireshark and got lots of packets, I could find the ones related to playfab but there was no json to be found in the calls.

0 Likes 0 ·
brendan avatar image brendan omar commented ·

For Wireshark, you need to follow the steps in the SSL guide (linked above) to have the packets be un-encrypted.

For the actual call you're making, and why your Postman install and mine don't act the same, I'm afraid I don't have a way to validate that. The version that works for you should result in the string being in user data with the quote marks in the string. And if I try it locally, that's exactly what I get.

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.