GET

Use the HTTP GET method with the login resource to request information about the user that is authenticated with the REST API.

Resource URL

https://host:port/ibmmq/rest/v2/login

Optional query parameters

None.

Request headers

The following headers must be sent with the request:
Authorization
This header must be sent if you are using basic authentication. For more information, see Using HTTP basic authentication with the REST API.

Request body format

None.

Security requirements

The request must be authenticated by using one of the following authentication mechanisms:

Response status codes

200
User queried successfully.
400
Invalid data provided.
401
Not authenticated.
An invalid credential was provided.
404
Resource was not found.
500
Server issue or error code from IBM® MQ.

Response headers

The following headers are returned with the response:
Content-Type
This header is returned with a value of application/json;charset=utf-8.

Response body format

The response is in JSON format in UTF-8 encoding. The response contains an outer JSON object that contains a single JSON array called user. This array contains the following attributes:
name
String.
Specifies the name of the user that is used to check for authorization.
This name might be different from the credentials that are specified using, for example, LDAP user mapping or client certificate user mapping.
role
JSON array.
Specifies which roles the user is granted.
The value is one or more of the following values:
  • MQWebAdmin
  • MQWebAdminRO
  • MQWebUser

Examples

The following example queries the user. The following URL is used with the HTTP GET method:
https://localhost:9443/ibmmq/rest/v2/login
The following JSON response is returned:
{
    "user" : 
    [{
       "name" : "reader",
       "role" : [
           "MQWebAdminRO", 
           "MQWebUser"
       ]
    }]
}
In cURL, the log in query might look like the following Windows example that uses token based authentication. The LTPA token is retrieved from the cookiejar.txt file by using the -b flag:
curl -k "https://localhost:9443/ibmmq/rest/v2/login" -X GET 
-b c:\cookiejar.txt