REST API update_user_object returns ENTIRE user object?

So i’m testing out my project and i’m updating one field of the user with this…

def update_user_object(self, data):
    """
    Updates a field for the logged in user.

    :param data: dictionary with format {"field":"value","field2":"value2"}
    :type data: dict

    :return: Json response
    :rtype : dict
    """
    if self.activeLogin:
        headers = self.userHeaders
        requestUrl = self.baseUrl + "/users/" + str(self.objectId)
        response = self.put_request(requestUrl, headers, json.dumps(data))
        if type(response) == requests.models.Response:
            response = response.json()
        return response
    else:
        return {'error': "Must log in before updating user objects"}

with data parameter set as:
data = {}
data[“golden”] = new_amount

all works okay… but the response takes a while and is really long…

a simple update of one user field results in a response of:

{‘character_data’: {‘hat_type’: 3, ‘hair_type’: 6, ‘head_type’: 21, ‘legs_type’: 0, ‘hair_color’: 16725881, ‘legs_color’: 2050295, ‘torso_type’: 16, ‘torso_color’: 1531647, ‘character_name’: ‘JesterOC’}, ‘lastLogin’: 1624336806000, ‘userStatus’: ‘ENABLED’, ‘created’: 1615400957000, ‘displayName’: ‘JesterOC’, ‘init_user_upon_login’: True, ‘accountType’: ‘BACKENDLESS’, ‘avatar’: None, ‘ownerId’: ‘B7A24F67-7D8C-4E91-9647-057871EB48E0’, ‘socialAccount’: ‘BACKENDLESS’, ‘oAuthIdentities’: None, ‘WAXaddress’: ‘5n3sg.wam’, ‘ETHaddress’: ‘0xe5ae6e6826b27d064c59a1d161a97e2c29057985’, ‘nickname’: None, ‘golden’: 25, ‘___class’: ‘Users’, ‘blUserLocale’: ‘en’, ‘updated’: 1624336819000, ‘objectId’: ‘B7A24F67-7D8C-4E91-9647-057871EB48E0’, ‘email’: ‘ocey92@gmail.com’}

Am i missing something in my code that I need to add to have a response with only updated field(s) in the response?

Thanks in advance, JesterOC

Hi JesterOC,

This is by design, the update operation returns the entire object back.

Regards,
Mark

Awww, shucks… Any chance of adding something so only specified fields are returned?

Maybe something like:

‘?return_all_fields=false’

Tacked on the end of the rest url?

Hi @JesterOC ,

Unfortunatelly no, we are not planning to add this feature.
In your case object is not big and can’t cause big impact on request execution time.

Regards, Andriy

Yeh. Okay…
i’ll have to invest more time in research PYTHON + Backendless REST functions…
And do some coding… (I was planning on using user data table to hold the user’s item inventory data)
I haven’t got database functions yet. (
excluding read_user_object() and update_user_object()
)