Sign In Register

How can we help you today?

Start a new topic

REST Config API - support partial update to Property value

The new REST API is awesome, but it's really limiting to not be able to update the individual fields of a property's value.

Simple example, let's say we have a property for storing info on some external asset database called "asset_db" with value: { "updated" : timestamp, "url" : url }

Now if I have a tool that updates the asset db and fires off a PUT to update the "updated" field of the property value, I will overwrite the whole value object unless I include the other fields (and values) as well (in this case the "url"). But then I have to either store those other values and make sure they haven't been changed, or fire off a GET first every time I want to change any anything.

The other alternative is to split the properties up into individual key/value pairs, but that really 

limits the power of properties, and it becomes untenable if you're using segments as they would multiplicatively increase the number of kvp's required.

I get that the API is what the Portal uses, and right now there's no partial property updates in the portal, but I'm hoping it's feasible to implement. Something like:

PUT :/config/~properties/tool_itemdb/value

and any fields present would be updated/set 

Hi Ryan,

Can you let me know the name of your game and the property in question ? I'll take a look at the config and test a similar one via REST for you.




gameId = 292297

property = settings_itemdb 

It's just a property with a string field and number field for right now, and I'd like to update one of the fields without having to set the other.

Hi Ryan,

From testing I don't think this is possible. You'll always need to update the full property value here when using the REST api. The best flow to do this would be to do a GET request to get the latest property config, make your changes and then submit the updated property via the PUT request. It sounds like this is what you are currently doing. This would be the optimal flow currently.



Okay this is what I suspected. Thanks for looking into it at any rate.

Can you not use "$set" ( ?


So, instead of using this Update JSON (which will replace the entire document):

{ "updated" : timestamp }


You would use this (which hopefully would set the one field, while leaving the rest of the document as-is):

{ "$set" : { "updated" : timestamp } }

Hi Walt, 

This is part of the game configuration so it can't be changed using mongo update queries. The REST Api or the portal are the only way to make changes to properties.



Ah, sorry for the intrusion then! :)

Login to post a comment