Profile API

When a user is created, a profile is also automatically generated. The application can store user specific information in the profile.

Query a user profile

sdk.profile.getMyProfile()
    .then(function (profile) {
        console.log("getMyProfile() succeeded", profile);
    })
    .catch(function (error) {
        console.error("getMyProfile() failed", error);
    });

Update a user profile

sdk.services.profile.updateMyProfile(profile)
    .then(function (updatedProfile) {
        console.error("updateMyProfile() succeeded", updatedProfile);
    })
    .catch(function (error) {
        console.error("updateMyProfile() failed", error);
    });

eTags

The SDK internally uses eTags to prevent simultaneous updates of the profile from overwriting each other.

If you want to update a profile, you must query it first, make the appropriate changes to it and then update it.

When the profile is queried, an eTag is internally stored and passed back in the update. If they don't match, an error is returned. This means that the state of the profile has changed since it was queried and what we tried to update is now stale.