Update User Information
/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
- application/json
-
username: string
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 theAuthorization
HTTP request header.
object
User Information
{
"anotherCustomField":"Value for the custom field",
"myCustomField":"Value for the custom field"
}
Response
- application/json
200 Response
-
Content-Type: string
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.
object
User Information
{
"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.
-
Content-Type: string
The media type of the error message, which is
application/json
.
object
Error
-
detail:
string
Message that provides the error details.
-
o:ecid:
string
Execution context ID, which is a unique identifier to correlate events or requests that are associated with the same transaction across several components.
-
o:errorCode:
string
Mobile Cloud Service error code.
-
o:errorDetails(optional):
array o:errorDetails
Minimum Number of Items:
0
List of the issues that cause the error. Included when the error is caused by multiple issues. -
o:errorPath:
string
The relative point in the API path where the error occurred.
-
status:
integer
HTTP status code. See http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html for more details.
-
title:
string
Summary of the problem.
-
type:
string
The URI to the link that provides details about the HTTP status code.
array
0
-
Array of:
object Error Detail
Title:
Error Detail
object
Error Detail
-
instance:
string
The URI to the link that provides more detailed information about the error.
-
o:errorCode:
string
Mobile Cloud Service error code.
-
o:errorPath:
string
The relative point in the API path where the error occurred.
-
title:
string
Summary of the problem.
-
type:
string
The URI to the link that provides details about the HTTP status code.
{
"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.
-
Content-Type: string
The media type of error message, which is
application/json
.
object
Error
-
detail:
string
Message that provides the error details.
-
o:ecid:
string
Execution context ID, which is a unique identifier to correlate events or requests that are associated with the same transaction across several components.
-
o:errorCode:
string
Mobile Cloud Service error code.
-
o:errorDetails(optional):
array o:errorDetails
Minimum Number of Items:
0
List of the issues that cause the error. Included when the error is caused by multiple issues. -
o:errorPath:
string
The relative point in the API path where the error occurred.
-
status:
integer
HTTP status code. See http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html for more details.
-
title:
string
Summary of the problem.
-
type:
string
The URI to the link that provides details about the HTTP status code.
array
0
-
Array of:
object Error Detail
Title:
Error Detail
object
Error Detail
-
instance:
string
The URI to the link that provides more detailed information about the error.
-
o:errorCode:
string
Mobile Cloud Service error code.
-
o:errorPath:
string
The relative point in the API path where the error occurred.
-
title:
string
Summary of the problem.
-
type:
string
The URI to the link that provides details about the HTTP status code.
{
"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 followsBasic
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
, andemail
.
404 Response
-
Content-Type: string
The media type of the error message, which is
application/json
.
object
Error
-
detail:
string
Message that provides the error details.
-
o:ecid:
string
Execution context ID, which is a unique identifier to correlate events or requests that are associated with the same transaction across several components.
-
o:errorCode:
string
Mobile Cloud Service error code.
-
o:errorDetails(optional):
array o:errorDetails
Minimum Number of Items:
0
List of the issues that cause the error. Included when the error is caused by multiple issues. -
o:errorPath:
string
The relative point in the API path where the error occurred.
-
status:
integer
HTTP status code. See http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html for more details.
-
title:
string
Summary of the problem.
-
type:
string
The URI to the link that provides details about the HTTP status code.
array
0
-
Array of:
object Error Detail
Title:
Error Detail
object
Error Detail
-
instance:
string
The URI to the link that provides more detailed information about the error.
-
o:errorCode:
string
Mobile Cloud Service error code.
-
o:errorPath:
string
The relative point in the API path where the error occurred.
-
title:
string
Summary of the problem.
-
type:
string
The URI to the link that provides details about the HTTP status code.
{
"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.
-
Content-Type: string
The media type of error message, which is
application/json
.
object
Error
-
detail:
string
Message that provides the error details.
-
o:ecid:
string
Execution context ID, which is a unique identifier to correlate events or requests that are associated with the same transaction across several components.
-
o:errorCode:
string
Mobile Cloud Service error code.
-
o:errorDetails(optional):
array o:errorDetails
Minimum Number of Items:
0
List of the issues that cause the error. Included when the error is caused by multiple issues. -
o:errorPath:
string
The relative point in the API path where the error occurred.
-
status:
integer
HTTP status code. See http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html for more details.
-
title:
string
Summary of the problem.
-
type:
string
The URI to the link that provides details about the HTTP status code.
array
0
-
Array of:
object Error Detail
Title:
Error Detail
object
Error Detail
-
instance:
string
The URI to the link that provides more detailed information about the error.
-
o:errorCode:
string
Mobile Cloud Service error code.
-
o:errorPath:
string
The relative point in the API path where the error occurred.
-
title:
string
Summary of the problem.
-
type:
string
The URI to the link that provides details about the HTTP status code.
{
"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.
-
Content-Type: string
The media type of the error message, which is
application/json
.
object
Error
-
detail:
string
Message that provides the error details.
-
o:ecid:
string
Execution context ID, which is a unique identifier to correlate events or requests that are associated with the same transaction across several components.
-
o:errorCode:
string
Mobile Cloud Service error code.
-
o:errorDetails(optional):
array o:errorDetails
Minimum Number of Items:
0
List of the issues that cause the error. Included when the error is caused by multiple issues. -
o:errorPath:
string
The relative point in the API path where the error occurred.
-
status:
integer
HTTP status code. See http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html for more details.
-
title:
string
Summary of the problem.
-
type:
string
The URI to the link that provides details about the HTTP status code.
array
0
-
Array of:
object Error Detail
Title:
Error Detail
object
Error Detail
-
instance:
string
The URI to the link that provides more detailed information about the error.
-
o:errorCode:
string
Mobile Cloud Service error code.
-
o:errorPath:
string
The relative point in the API path where the error occurred.
-
title:
string
Summary of the problem.
-
type:
string
The URI to the link that provides details about the HTTP status code.
{
"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"
}
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" } ] }