question

chorustempo avatar image
chorustempo asked

Updating values with DataSetObjects request?

I wanted to clarify how the data is stored/updated on an object on the player's profile. Specifically, if the object already exists with several field names/values on it and I want to update only one of the field name values, do I need to include all the existing values on the request?

For example:

I have an object on the player's profile called 'Profile' that is created when the player first registers. It is set up with the following: Field 'A' with value 'Default', Field 'B' with value 'Default', Field 'C' with value 'Default', Field 'D' with value 'Default', and Field 'E' with value 'Default'.


Then during the game, I want to update the value in Field 'C' to '23'.

In the SetObjects request, can I just include Field 'C' with value '23'. And all the other field names/values will remain the same?


OR do I have to include Field 'A' with value 'Default', Field 'B' with value 'Default', Field 'C' with value '23', Field 'D' with value 'Default', and Field 'E' with value 'Default'?


The same goes for adding a new field and value. Can I send a SetObjects request with just 'Field 'F' with value '10' and it will add the extra field to the end of the json list already stored in that object? Or do I have to include all of the current field names and values as well?

data
1 comment
10 |1200

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

chorustempo avatar image chorustempo commented ·

I'm just concerned about hitting limits if I'm going to be essentially updating every field and value each time I send a SetObject request.

0 Likes 0 ·

1 Answer

·
Gosen Gao avatar image
Gosen Gao answered

Object - Set Objects - REST API (PlayFab Data) | Microsoft Learn will overwrite the original Object with the current data. So, you need to include all the fields even they are not changed.

If you're concerned about hitting the limit, then depending on your scenario, you could convert your frequently updated fields to Objects, so you don't need to update other fields.

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

chorustempo avatar image chorustempo commented ·

So does a SetObject request for an object on the player account count as a single update if only one of the field values is being changed? Or does it count every single field and value that is included in the request as a unique update, even if those other field values are staying the same? The limit for 'Player data updates per request' says 10, but if the object has 11+ fields then would this be refused as it's over the 10 update per request limit?

0 Likes 0 ·
Gosen Gao avatar image Gosen Gao chorustempo commented ·

'Player data updates per request' is a limit for updating Player Data - PlayFab | Microsoft Learn not for Objects. Since each player can have up to 5 Objects, you can update 5 Objects per request no matter how many fields in those Objects.

1 Like 1 ·
chorustempo avatar image chorustempo Gosen Gao commented ·

Ok, that's perfect then. Thank you! : )

0 Likes 0 ·
chorustempo avatar image chorustempo commented ·

@Gosen Gao Sorry if this is a noob question. I just want to make sure I can actually do what I'm trying to do before spending days plugging in all of the fields / values. I had a read through the descriptions on the limits page, but couldn't find an answer to this.

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.