Update User Information

patch

/mobile/platform/users/{username}

Updates the currently authorized mobile user's information. You can update only the custom properties that were added to the realm that the user is a member of. For example, you can't change the username, firstName, lastName, and email properties.

Permissions

To perform this operation, you must be a member of the realm that is associated with the mobile backend.

Request

Supported Media Types
Path Parameters
  • The user name of the current user, which is the user in the Authorization HTTP request header. Use ~ to indicate the current user. If you specify the user name, it must match the user name that is in the Authorization HTTP request header.

Body ()
Root Schema : User Information
Type: object
Title: User Information
Additional Properties Allowed
Show Source
The MCS mobile user data to modify. Use key/value pairs to specify the custom user object properties to update. The properties `firstName`, `lastName`, `username`, and `email` can't be modified.
Example Request (application/json)
{
    "anotherCustomField":"Value for the custom field",
    "myCustomField":"Value for the custom field"
}
Back to Top

Response

Supported Media Types

200 Response

The user properties were updated successfully.
Headers
  • The media type of the object, which is application/json. This is the same media type that will be returned when the object is requested.

Body ()
Root Schema : User Information
Type: object
Title: User Information
Additional Properties Allowed
Show Source
The MCS mobile user data to modify. Use key/value pairs to specify the custom user object properties to update. The properties `firstName`, `lastName`, `username`, and `email` can't be modified.
Example Response (application/json)
{
    "id":"295e450a-63f0-41fa-be43-cd2dbcb21598",
    "lastName":"Doe",
    "username":"joe",
    "email":"joe@example.com",
    "links":[
        {
            "rel":"canonical",
            "href":"/mobile/platform/users/joe"
        },
        {
            "rel":"self",
            "href":"/mobile/platform/users/joe"
        }
    ],
    "firstName":"Joe",
    "myCustomField2":"fr",
    "myCustomField1":"165421"
}

400 Response

The operation can't be performed due to one of the following reasons:

  • The user doesn't exist.
  • The content isn't a correctly formed JSON object.
  • A property was not found, meaning that it isn't a custom property for the realm that the user belongs to.
  • The property type doesn't match the type for the custom property.
  • The Oracle-Mobile-Backend-ID HTTP request header wasn't specified.
Headers
Body ()
Root Schema : Error
Type: object
Title: Error
The error JSON object returned by Mobile Cloud Service.
Show Source
Nested Schema : o:errorDetails
Type: array
Minimum Number of Items: 0
List of the issues that cause the error. Included when the error is caused by multiple issues.
Show Source
Nested Schema : Error Detail
Type: object
Title: Error Detail
Show Source
Example Response (application/json)
{
    "title":"Cannot call API",
    "detail":"Unable to use API virtualization for calls without any Mobile Backend context.",
    "status":400,
    "o:errorCode":"MOBILE-58060",
    "o:errorPath":"/mobile/platform/users/joe",
    "o:ecid":"cde040005cd5983e:4372d958:14c8c4c2d6c:-8000-000000000032b9d5, 0",
    "type":"http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.1"
}

401 Response

The operation can't be performed due to one of the following reasons:

  • The user doesn't exist.
  • The password is incorrect.
  • The Authorization HTTP request header wasn't specified.
  • The user name doesn't match the user name in the Authorization HTTP request header.
Headers
Body ()
Root Schema : Error
Type: object
Title: Error
The error JSON object returned by Mobile Cloud Service.
Show Source
Nested Schema : o:errorDetails
Type: array
Minimum Number of Items: 0
List of the issues that cause the error. Included when the error is caused by multiple issues.
Show Source
Nested Schema : Error Detail
Type: object
Title: Error Detail
Show Source
Example Response (application/json)
{
    "title":"Unauthorized",
    "detail":"401 - Unauthorized",
    "status":401,
    "o:errorCode":"MOBILE-15209",
    "o:errorPath":"/mobile/platform/users/joe",
    "o:ecid":"cde040005cd5983e:4372d958:14c8c4c2d6c:-8000-000000000033b51c, 0",
    "type":"http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.1"
}

403 Response

The operation can't be performed due to one of the following reasons:

  • The user doesn't belong to the realm that is associated with the mobile backend.
  • The value of the Authorization HTTP request header that follows Basic is either missing or invalid.
  • The property can't be changed because it's not a custom property. For example, you can't change username, firstName, lastName, and email.

404 Response

The operation can't be performed because we can't find the mobile backend.
Headers
Body ()
Root Schema : Error
Type: object
Title: Error
The error JSON object returned by Mobile Cloud Service.
Show Source
Nested Schema : o:errorDetails
Type: array
Minimum Number of Items: 0
List of the issues that cause the error. Included when the error is caused by multiple issues.
Show Source
Nested Schema : Error Detail
Type: object
Title: Error Detail
Show Source
Example Response (application/json)
{
    "title":"Mobile Backend not found",
    "detail":"We cannot find the active mobile backend for the given clientId fd4cc0cf-0a72-4ed6-aab6-295133b8904e and BASIC schema. Specify a valid clientId and try again.",
    "status":404,
    "o:errorCode":"MOBILE-58026",
    "o:errorPath":"/mobile/platform/users/joe",
    "o:ecid":"cde040005cd5983e:4372d958:14c8c4c2d6c:-8000-000000000033b529, 0",
    "type":"http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.1"
}

406 Response

The MIME media type isn't supported, only application/json is supported. Either remove the Accept header or specify a media type that is supported.

Headers
Body ()
Root Schema : Error
Type: object
Title: Error
The error JSON object returned by Mobile Cloud Service.
Show Source
Nested Schema : o:errorDetails
Type: array
Minimum Number of Items: 0
List of the issues that cause the error. Included when the error is caused by multiple issues.
Show Source
Nested Schema : Error Detail
Type: object
Title: Error Detail
Show Source
Example Response (application/json)
{
    "title":"Unsupported media type",
    "detail":"The MIME media type isn't supported, only application/json is supported. Either remove the Accept header or specify a media type that is supported.",
    "status":406,
    "o:errorCode":"MOBILE-92516",
    "o:errorPath":"/mobile/platform/users/joe",
    "o:ecid":"cde040005cd5983e:4372d958:14c8c4c2d6c:-8000-000000000033ddba, 0",
    "type":"http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.1"
}

415 Response

The MIME media type isn't supported or wasn't specified. Only application/json is supported.

Headers
Body ()
Root Schema : Error
Type: object
Title: Error
The error JSON object returned by Mobile Cloud Service.
Show Source
Nested Schema : o:errorDetails
Type: array
Minimum Number of Items: 0
List of the issues that cause the error. Included when the error is caused by multiple issues.
Show Source
Nested Schema : Error Detail
Type: object
Title: Error Detail
Show Source
Example Response (application/json)
{
    "title":"Unsupported media type",
    "detail":"The MIME media type isn't supported, only application/json is supported. Specify a media type that is supported.",
    "status":415,
    "o:errorCode":"MOBILE-92515",
    "o:errorPath":"/mobile/platform/users/joe",
    "o:ecid":"cde040005cd5983e:4372d958:14c8c4c2d6c:-8000-000000000033ba73, 0",
    "type":"http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.1"
}
Back to Top

Examples

The following example shows how to update the values of custom properties that are associated with the current user by submitting a PATCH request on the REST resource using cURL. These are custom user object properties that were added to the realm that the user is a member of. You can update only custom properties and only for the current user. The ~ (tilde) gets the user name for the current user from the Authorization header. For more information about cURL, see Use cURL.

curl -i
-X PATCH 
-u mobile.user@example.com:mypassword
-d users.json
-H "Content-Type: application/json; charset=utf-8"
-H "Oracle-Mobile-Backend-ID: ABCD9278-091f-41aa-9cb2-184bd0586fce"
https://fif.cloud.oracle.com/mobile/platform/users/~

Example of Request Body

The following example shows the contents of the request body. It will update the custom property named key.

{
  "key": "Ab1578"
}

Example of Response Header

The following shows an example of the response header.

200 OK
Content-Type: application/json
Date: Thu, 18 Jun 2015 00:26:10 GMT
Oracle-Mobile-Runtime-Version: 15.4.1-201506162222

Example of Response Body

The following example shows, in JSON format, the contents of the response body, which lists all the basic property values for the user:

{
  "id": "23e77f1d-0def-483f-bc77-a7742cd155b6",
  "username": "mobile.user",
  "email": "mobile.user@example.com",
  "firstName": "Mobile",
  "key": "Ab1578",
  "lastName": "User",
  "links": [
    {
      "rel": "canonical",
      "href": "/mobile/platform/users/mobile.user"
    }
  ]
}
Back to Top