Retrieve User Information

get

/mobile/platform/users/{username}

Retrieves information about the current user.

  • When the user is an MCS mobile user, this operation retrieves the user name, first name, last name, and email address as well as the custom properties that were added to the realm that the user belongs to.
  • When the user is a virtual user, this operation retrieves the user name.
  • When the user is a social user (that is, signed in using social identity), this operation retrieves the user's MCS ID, identity provider, and access token.

If you don't know the user name, then use ~ for the username path parameter to indicate the current user.

Permissions

To perform this operation, you must be an MCS mobile user that is a member of the realm that is associated with the mobile backend or you must be a virtual or social user.

Request

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.

Query Parameters
  • You can use this parameter to request a subset of the MCS mobile user properties. This parameter doesn't apply to virtual or social users.

    Example:

    To retrieve only the properties firstName and lastName for an MCS mobile user, the call would pass the following query parameter:

    /mobile/platform/users/~?fields=firstName,lastName

    The call returns a response like this:

    {
      "firstName": "Joe",
      "lastName": "Doe"
    }
    
Back to Top

Response

Supported Media Types

200 Response

The user information was retrieved successfully.
Body ()
Root Schema : User Information
Type: object
Title: User Information
Information about the current user.
Match One
Show Source
Nested Schema : Mobile User Information
Type: object
Title: Mobile User Information
Additional Properties Allowed
Show Source
Information that is returned when the current user is an MCS mobile user.
Show Source
Nested Schema : Virtual User Information
Type: object
Title: Virtual User Information
Information that is returned when the current user is a virtual user.
Show Source
  • Pattern: [a-zA-Z0-9][a-zA-Z0-9\-_\.\@]*
    The user name for the user.
Nested Schema : Social User Information
Type: object
Title: Social User Information
Additional Properties Allowed
Show Source
Information that is returned when the current user is a social user (that is, signed in using social identity).
Show Source
Nested Schema : Links that each reference a single object.
Type: array
Title: Links that each reference a single object.
Minimum Number of Items: 1
Unique Items Required: true
Show Source
Nested Schema : mobileExtended
Type: object
Show Source
Nested Schema : Identity Provider
Type: object
Title: Identity Provider
Additional Properties Allowed
Show Source
The provider through which the current social user signed in.
Show Source
Nested Schema : Facebook Social User Information
Type: object
Title: Facebook Social User Information
Additional Properties Allowed
Show Source
Facebook social user information.
Show Source
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"
}

400 Response

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

  • The Oracle-Mobile-Backend-ID HTTP request header was not specified.
  • The query parameter fields was specified and one of the properties given isn't defined for the realm that the user belongs to.
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's associated with the mobile backend.
  • The value of the Authorization HTTP request header that follows Basic or 'Bearer' is either missing or invalid.

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's 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"
}
Back to Top

Examples

The following example shows how to get the values of the firstName and lastName properties that are associated with the current MCS mobile user by submitting a GET request on the REST resource using cURL. These are some of the user object properties that are defined for the realm that the user is a member of. You can get properties for the current user only. 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 GET 
-u mobile.user@example.com:mypassword
-H "Oracle-Mobile-Backend-ID: ABCD9278-091f-41aa-9cb2-184bd0586fce"
https://fif.cloud.oracle.com/mobile/platform/users/~?fields=firstName,lastName

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

Example of Response Body for an MCS Mobile User

The following example shows, in JSON format, the contents of the response body, which lists the requested properties (or all properties if no path parameters were specified):

{
  "firstName": "mobile",
  "lastName": "user"
}

Example of Response Body for a Virtual User

The following example shows, in JSON format, the contents of the response body when the current user is a virtual user:

{
  "username": "joe"
}

Example of Response Body for a Social User

The following example shows, in JSON format, the contents of the response body when the current user is a social user:

{
  "username": "1 :623:165",
  "mobileExtended": {
      "identityProvider": {
          "facebook": {
              "accessToken":"CAAI...YZD"
          }
      }
  }
}
Back to Top