Was this helpful?

See all application entities

You can update data about users through cURL or one of the SDKs.

Note that in with some SDKs, you update user data in the same way you update other entities.

See Default Data Entities for a list of the system-defined properties for User entities. In addition, you can create User properties specifically for your application.

Use the PUT method to update a user with new or changed property values.

Request URI

PUT /<org_id>/<app_id>/users/<uuid | username> <request body>

Parameters

Parameter Description
uuid | org_id Organization UUID or organization name
uuid | app_id Application UUID or application name
uuid | username User UUID or username. The alias /users/me can be used in place of the current user’s uuid or username. Note: The /users/me endpoint is accessible only if you provide an access token with the request (see Authenticating users and application clients). If you make an anonymous ("guest") call, the system will not be able to determine which user to return as /users/me.
request body

A JSON object with one or more sets of user properties:

{
    "email" : "john.doe@mail.com",
    "city" : "san francisco"
}

Example - Request

curl -X PUT "https://api.usergrid.com/my-org/my-app/users/john.doe" -d '{"email":"john.doe@mail.com", "city":"san francisco"}'

Example - Response

{
    "action" : "put",
    "application" : "1c8f60e4-da67-11e0-b93d-12313f0204bb8",
    "params" : {
    },
    "path" : "/users",
    "uri" : "https://api.usergrid.com/005056c00008-4353136f-e978-11e0-8264/4353136f-e978-11e0-8264-005056c00008/users",
    "entities" : [ {
        "uuid" : "7d1aa429-e978-11e0-8264-005056c00008",
        "type" : "user",
        "created" : 1317176452536016,
        "modified" : 1317176452536016,
        "activated" : true,
        "city" : "san francisco",
        "email" : "john.doe@mail.com",
        "metadata" : {
            "path" : "/users/7d1aa429-e978-11e0-8264-005056c00008",
            "sets" : {
                "rolenames" : "/users/7d1aa429-e978-11e0-8264-005056c00008/rolenames",
                "permissions" : "/users/7d1aa429-e978-11e0-8264-005056c00008/permissions"
            },
            "collections" : {
                "activities" : "/users/7d1aa429-e978-11e0-8264-005056c00008/activities",
                "devices" : "/users/7d1aa429-e978-11e0-8264-005056c00008/devices",
                "feed" : "/users/7d1aa429-e978-11e0-8264-005056c00008/feed",
                "groups" : "/users/7d1aa429-e978-11e0-8264-005056c00008/groups",
                "roles" : "/users/7d1aa429-e978-11e0-8264-005056c00008/roles",
                "following" : "/users/7d1aa429-e978-11e0-8264-005056c00008/following",
                "followers" : "/users/7d1aa429-e978-11e0-8264-005056c00008/followers"
            }
        },
        "name" : "John Doe",
        "username" : "john.doe"
    } ],
    "timestamp" : 1317176452528,
    "duration" : 52,
    "organization" : "my-org",
    "applicationName": "my-app"
}

Update user data as you would update data for an entity generically. For more information, see Updating Data Entities.

Update user data as you would update data for an entity generically. For more information, see Updating Data Entities.

Update user data as you would update data for an entity generically. For more information, see Updating Data Entities.

The example assumes use of the Ruby SDK.

app = Usergrid::Application.new 'https://api.usergrid.com/my-org/my-app/'
john_doe = app['users/john.doe'].entity
john_doe.email = 'john.doe@mail.com'
john_doe.city = 'san francisco'
john_doe.save

The example assumes use of the Node.js module.

var options = {
    method:'PUT',
    endpoint:'users/john.doe',
    body:{ email:'john.doe@mail.com', city:'san francisco' }
};
client.request(options, function (err, data) {
    if (err) {
        //error — PUT failed
    } else {
        //success — data will contain raw results from API call        
    }
});

 

Add new comment

Provide your email address if you wish to be contacted offline about your comment.
We will not display your email address as part of your comment.

We'd love your feedback and perspective! Please be as specific as possible.
Type the characters you see in this picture. (verify using audio)

Type the characters you see in the picture above; if you can't read them, submit the form and a new image will be generated. Not case sensitive.