com.atlassian.confluence.content.render.xhtml.migration.exceptions.UnknownMacroMigrationException: The macro 'next_previous_link3' is unknown.

User Management via the Console

This section provides the details of the REST APIs used to manage users via the EMM console:

Adding a User

Description

Add a new user to WSO2 EMM using the REST API given below.

Resource Path/
URL/mdm-admin/users/
HTTP MethodPOST
Request/Response Formatapplication/json
cURL command
curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer <EMM_API_TOKEN>" -d @'<JSON_PAYLOAD>' -k -v https://<EMM_HOST>:<EMM_HTTPS_PORT>/mdm-admin/users/
  • For more information on how to generate the <EMM_API_TOKEN>, see Generating the EMM API Token.
  • Define the path to the JSON file, which includes the required properties to add a user as the <JSON_PAYLOAD> value. For more information, see the Sample JSON Definition.
  • By default, <EMM_HOST> is localhost. However, if you are using a public IP, the respective IP address or domain needs to be specified.
  • By default, <EMM_HTTPS_PORT> has been set to 9443. However, if the port offset has been incremented by n, the default port value needs to be incremented by n.

Example:

curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer 33392fb365b3ac693b405b565ddc8a3a" -d @'user.json' -k -v https://localhost:9443/mdm-admin/users/
 Sample output
> POST /mdm-admin/users/ HTTP/1.1
> Host: localhost:9443
> User-Agent: curl/7.43.0
> Accept: */*
> Content-Type: application/json
> Authorization: Bearer 33392fb365b3ac693b405b565ddc8a3a
> Content-Length: 131
< HTTP/1.1 201 Created
< Date: Sat, 05 Mar 2016 09:12:23 GMT
< Content-Type: application/json
< Content-Length: 94
< Server: WSO2 Carbon Server
{"statusCode":201,"messageFromServer":"User by username: PRIMARY/kim was successfully added."}
Sample JSON Definition 
{  
   "username":"PRIMARY/kim",
   "firstname":"Kim",
   "lastname":"Bar",
   "emailAddress":"kim@gmail.com",
   "roles":[  
      "Marketing"
   ]
}
PropertyDefinitionData
Type 
username

Provide a preferred username for the user. The user name should be provided in the following format: <USER_STORE>/<USER_NAME>.

Example: Adding a user where the users are managed via a Primary user store.

PRIMARY/username123

String
firstnameProvide the first name of the user.String
lastnameProvide the last name of the user.String
emailAddress

Provide the email address of the user.

You need to ensure that you provide a valid email address as an email containing the URL to download the EMM mobile application will be sent to the user once the user is added successfully.

String
roles

Provide the user roles for the respective user. For more information on the roles you have created, see getting details of user roles.

All roles starting with  Application/  are created for Service Providers (i.e., Application/admin_emm ). These roles only have permission to subscribe to the respective Service-provider application. Therefore make sure not to assign users to the roles starting with Application/.

String

 

Getting details of users

Description

If you wish to get the details of all the user registered with WSO2 EMM, you can do so using the REST API.

Resource Path/
URL/mdm-admin/users/
HTTP MethodGET
Request/Response Formatapplication/json
cURL command
curl -X GET -H "Content-Type: application/json" -H "Authorization: Bearer <EMM_API_TOKEN>" -k -v https://<EMM_HOST>:<EMM_HTTPS_PORT>/mdm-admin/users/
  • For more information on how to generate the <EMM_API_TOKEN>, see Generating the EMM API Token.
  • By default, <EMM_HOST> is localhost. However, if you are using a public IP, the respective IP address or domain needs to be specified.
  • By default, <EMM_HTTPS_PORT> has been set to 9443. However, if the port offset has been incremented by n, the default port value needs to be incremented by n.

Example:

curl -X GET -H "Content-Type: application/json" -H "Authorization: Bearer 33392fb365b3ac693b405b565ddc8a3a" -k -v https://localhost:9443/mdm-admin/users/
 Sample output
> GET /mdm-admin/users/ HTTP/1.1
> Host: localhost:9443
> User-Agent: curl/7.43.0
> Accept: */*
> Content-Type: application/json
> Authorization: Bearer 9bc712cabb95bb1c7455274198e005b3
> 
< HTTP/1.1 200 OK
< Cache-Control: private
< Expires: Thu, 01 Jan 1970 05:30:00 IST
< Date: Fri, 04 Mar 2016 09:39:06 GMT
< Content-Type: application/json
< Content-Length: 313
< Server: WSO2 Carbon Server
< 
* Connection #0 to host localhost left intact
{"statusCode":200,"messageFromServer":"All users were successfully retrieved. Obtained user count: 3","responseContent":[{"username":"admin"},{"username":"foo","firstname":"foo","lastname":"bar","emailAddress":"foo@gmail.com"},{"username":"kim","firstname":"Kim","lastname":"Bar","emailAddress":"kim@gmail.com"}]}
Sample JSON Output Definition 
{  
   "username":"kim",
   "firstname":"Kim",
   "lastname":"Bar",
   "emailAddress":"kim@gmail.com"
}
PropertyDefinition
username

Defines the username for the user.

firstnameDefines the first name of the user.
lastnameDefines the last name of the user.
emailAddress

Defines the email address of the user.

 

Getting details of a user

Description

If you wish to get the details of a specific user that is registered with WSO2 EMM, you can do so using the REST API.

Resource Path/
URL/mdm-admin/users/view?username={username}
HTTP MethodGET
Request/Response Formatapplication/json
cURL command
curl -X GET -H "Content-Type: application/json" -H "Authorization: Bearer <EMM_API_TOKEN>" -k -v https://<EMM_HOST>:<EMM_HTTPS_PORT>/mdm-admin/users/view?username={username}
  • For more information on how to generate the <EMM_API_TOKEN>, see Generating the EMM API Token.
  • By default, <EMM_HOST> is localhost. However, if you are using a public IP, the respective IP address or domain needs to be specified.
  • By default, <EMM_HTTPS_PORT> has been set to 9443. However, if the port offset has been incremented by n, the default port value needs to be incremented by n.
  • Provide the name of the user you wish to get the details of as the value for {username}. If you are unsure of the exact user name, run the REST API command to retrieve all the user details to find out the username.

Example:

curl -X GET -H "Content-Type: application/json" -H "Authorization: Bearer 33392fb365b3ac693b405b565ddc8a3a" -k -v https://localhost:9443/mdm-admin/users/view?username=kim
 Sample output
> GET /mdm-admin/users/view?username=kim HTTP/1.1
> Host: localhost:9443
> User-Agent: curl/7.43.0
> Accept: */*
> Content-Type: application/json
> Authorization: Bearer 33392fb365b3ac693b405b565ddc8a3a
> 
< HTTP/1.1 200 OK
< Cache-Control: private
< Expires: Thu, 01 Jan 1970 05:30:00 IST
< Date: Fri, 04 Mar 2016 09:35:51 GMT
< Content-Type: application/json
< Content-Length: 188
< Server: WSO2 Carbon Server
{"statusCode":200,"messageFromServer":"User information was retrieved successfully.","responseContent":{"username":"kim","firstname":"Kim","lastname":"Bar","emailAddress":"kim@gmail.com"}}
Sample JSON Output Definition 
{  
   "username":"kim",
   "firstname":"Kim",
   "lastname":"Bar",
   "emailAddress":"kim@gmail.com"
}
PropertyDefinition
username

Defines the username of the user.

firstnameDefines the first name of the user.
lastnameDefines the last name of the user.
emailAddress

Defines the email address of the user.

 

Updating user details

Description

There will be situations where you will want to update the user details. In such situation you can update the user details using the REST API given below.

URL/mdm-admin/users?username={username}
HTTP MethodPUT
Request/Response Formatapplication/json
cURL command
curl -X PUT -H "Content-Type: application/json" -H "Authorization: Bearer <EMM_API_TOKEN>" -d @'<JSON_PAYLOAD>' -k -v https://<EMM_HOST>:<EMM_HTTPS_PORT>/mdm-admin/users?username={username}
  • For more information on how to generate the <EMM_API_TOKEN>, see Generating the EMM API Token.
  • Define the path to the JSON file, which includes the updated user details as the <JSON_PAYLOAD> value. For more information, see the Sample JSON Definition.
  • By default, <EMM_HOST> is localhost. However, if you are using a public IP, the respective IP address or domain needs to be specified.
  • By default, <EMM_HTTPS_PORT> has been set to 9443. However, if the port offset has been incremented by n, the default port value needs to be incremented by n.
  • Provide the name of the user you wish to update as the {username}.

Example:

curl -X PUT -H "Content-Type: application/json" -H "Authorization: Bearer 33392fb365b3ac693b405b565ddc8a3a" -d @'user.json' -k -v https://localhost:9443/mdm-admin/users?username=kim
 Sample output
> PUT /mdm-admin/users?username=kim HTTP/1.1
> Host: localhost:9443
> User-Agent: curl/7.43.0
> Accept: */*
> Content-Type: application/json
> Authorization: Bearer 33392fb365b3ac693b405b565ddc8a3a
> Content-Length: 125
< HTTP/1.1 201 Created
< Cache-Control: private
< Expires: Thu, 01 Jan 1970 05:30:00 IST
< Date: Sat, 05 Mar 2016 09:17:09 GMT
< Content-Type: application/json
< Content-Length: 88
< Server: WSO2 Carbon Server
{"statusCode":201,"messageFromServer":"User by username: kim was successfully updated."}
Sample JSON Definition 
{  
   "username":"kim",
   "firstname":"Kim",
   "lastname":"Foo",
   "emailAddress":"kim@gmail.com",
   "roles":[  
      "admin"
   ]
}
PropertyDefinitionData
Type 
username

Provide a preferred username for the user.

Please note that you should not update the username.

String
firstnameProvide the first name of the user.String
lastnameProvide the last name of the user.String
emailAddress

Provide the email address of the user.

You need to ensure that you provide a valid email address as an email containing the URL to download the EMM mobile application will be sent to the user once the user is added successfully.

String
roles

Provide the user roles for the respective user. For more information on the roles you have created, see getting details of user roles.

All roles starting with  Application/  are created for Service Providers (i.e., Application/admin_emm ). These roles only have permission to subscribe to the respective Service-provider application. Therefore make sure not to assign users to the roles starting with Application/.

String

 

Sending enrollment invitations

Description

Send the users a mail inviting them to download the EMM mobile application on their devices using the REST API given below.

Before running the REST API command to send the enrollment invitations to users make sure to configure WSO2 EMM as explained under general server configurations.

Resource Path

/email-invitation

URL/mdm-admin/users/email-invitation
HTTP MethodPOST
Request/Response Formatapplication/json
cURL command
curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer <EMM_API_TOKEN>" -d @'<JSON_PAYLOAD>' -k -v https://<EMM_HOST>:<EMM_HTTPS_PORT>/mdm-admin/users/email-invitation
  • For more information on how to generate the <EMM_API_TOKEN>, see Generating the EMM API Token.
  • Define the path to the JSON file, which includes the required properties to invite a user as the <JSON_PAYLOAD> value. For more information, see the Sample JSON Definition.
  • By default, <EMM_HOST> is localhost. However, if you are using a public IP, the respective IP address or domain needs to be specified.
  • By default, <EMM_HTTPS_PORT> has been set to 9443. However, if the port offset has been incremented by n, the default port value needs to be incremented by n.

Example:

curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer 33392fb365b3ac693b405b565ddc8a3a" -d @'user.json' -k -v https://localhost:9443/mdm-admin/users/email-invitation
 Sample output
> POST /mdm-admin/users/email-invitation HTTP/1.1
> Host: localhost:9443
> User-Agent: curl/7.43.0
> Accept: */*
> Content-Type: application/json
> Authorization: Bearer 15e588fd526efa07ce3b4825fd86cdc5
> Content-Length: 25
< HTTP/1.1 200 OK
< Date: Sun, 06 Mar 2016 17:10:20 GMT
< Content-Type: application/json
< Content-Length: 88
< Server: WSO2 Carbon Server
{"statusCode":200,"messageFromServer":"Email invitation was successfully sent to user."}
Sample JSON Definition 
[
  "jim",
  "tom",
  "kim"
]
PropertyDefinitionData
Type 
username

Name of the user. Multiple user names can be added by using comma separated values. 

String

 

Getting device details of a user

Description

If you wish to get the details of the devices enrolled by a specific user, you can do so using the REST API given below.

Resource Path/devices
URL/mdm-admin/users/devices?username={username}
HTTP MethodGET
Request/Response Formatapplication/json
cURL command
curl -X GET -H "Content-Type: application/json" -H "Authorization: Bearer <EMM_API_TOKEN>" -k -v https://<EMM_HOST>:<EMM_HTTPS_PORT>/mdm-admin/users/devices?username={username}
  • For more information on how to generate the <EMM_API_TOKEN>, see Generating the EMM API Token.
  • By default, <EMM_HOST> is localhost. However, if you are using a public IP, the respective IP address or domain needs to be specified.
  • By default, <EMM_HTTPS_PORT> has been set to 9443. However, if the port offset has been incremented by n, the default port value needs to be incremented by n.
  • Provide the name of the user you wish to get the details as the value for {username}. If you are unsure of the exact user name, run the REST API command to retrieve all the user details to find out the username.

Example:

curl -X GET -H "Content-Type: application/json" -H "Authorization: Bearer 33392fb365b3ac693b405b565ddc8a3a" -k -v https://localhost:9443/mdm-admin/users/devices?username=kim

You can filter the device details further, using the query parameters given below:

  • start - Provide the starting pagination index. Example 10

    A user will have many devices enrolled with the EMM. In a situation where you wish to view the all the registered devices it is not feasible to show all the details on one page therefore the details are paginated.

  • length - Provide how many device details you require from the starting pagination index. For example if you require the device details from the 10th pagination index to the 15th, you must define 10 as the value for start and 5 as the value for length.

    If you wish to get the device details within a predefined index range you need to define both the  start  and  length  fields.
    Example:  https://localhost:9443/mdm-admin/devices?start=10&length=5
    There will be situations were you will not have device details in the specified index range. In such situation all the details of the devices registered to the specified user is given.

Example:

curl -X GET -H "Content-Type: application/json" -H "Authorization: Bearer 33392fb365b3ac693b405b565ddc8a3a" -k -v https://localhost:9443/mdm-admin/users/view?username=kim&start=1&length=3
 Sample output
> GET /mdm-admin/users/devices?username=kim HTTP/1.1
> Host: localhost:9443
> User-Agent: curl/7.43.0
> Accept: */*
> Content-Type: application/json
> Authorization: Bearer 6171fbf32fd653c29f14f0acef1900ca
> 
< HTTP/1.1 200 OK
< Cache-Control: private
< Expires: Thu, 01 Jan 1970 05:30:00 IST
< Date: Sat, 05 Mar 2016 07:04:46 GMT
< Content-Type: application/json
< Content-Length: 1196
< Server: WSO2 Carbon Server
[{"id":1,"name":"titan_umts","type":"android","description":"titan_umts","deviceIdentifier":"359298055243973","enrolmentInfo":{"id":1,"dateOfEnrolment":1457160869352,"dateOfLastUpdate":1457160869352,"ownership":"BYOD","status":"ACTIVE","owner":"admin"},"properties":[{"name":"IMEI","value":"359298055243973"},{"name":"IMSI","value":"413025702363929"},{"name":"DEVICE_MODEL","value":"XT1064"},{"name":"OS_VERSION","value":"6.0"},{"name":"VENDOR","value":"motorola"},{"name":"SERIAL"},{"name":"DEVICE_INFO","value":"[{\"name\":\"IMEI\",\"value\":\"359298055243973\"},{\"name\":\"IMSI\",\"value\":\"413025702363929\"},{\"name\":\"DEVICE_MODEL\",\"value\":\"XT1064\"},{\"name\":\"VENDOR\",\"value\":\"motorola\"},{\"name\":\"OS_VERSION\",\"value\":\"6.0\"},{\"name\":\"DEVICE_NAME\",\"value\":\"titan_umts\"},{\"name\":\"BATTERY_LEVEL\",\"value\":\"88\"},{\"name\":\"INTERNAL_TOTAL_MEMORY\",\"value\":\"5.51\"},{\"name\":\"INTERNAL_AVAILABLE_MEMORY\",\"value\":\"0.43\"},{\"name\":\"EXTERNAL_TOTAL_MEMORY\",\"value\":\"0.0\"},{\"name\":\"EXTERNAL_AVAILABLE_MEMORY\",\"value\":\"0.0\"},{\"name\":\"OPERATOR\",\"value\":\"Dialog\"}]"},{"name":"DEVICE_NAME","value":"titan_umts"},{"name":"GCM_TOKEN"}]}]
Sample JSON Output Definition 
[
  {
    "id": 1,
    "name": "titan_umts",
    "type": "android",
    "description": "titan_umts",
    "deviceIdentifier": "359298055243973",
    "enrolmentInfo": {
      "id": 1,
      "dateOfEnrolment": 1457160869352,
      "dateOfLastUpdate": 1457160869352,
      "ownership": "BYOD",
      "status": "ACTIVE",
      "owner": "admin"
    },
    "properties": [
      {
        "name": "IMEI",
        "value": "359298055243973"
      },
      {
        "name": "IMSI",
        "value": "413025702363929"
      },
      {
        "name": "DEVICE_MODEL",
        "value": "XT1064"
      },
      {
        "name": "OS_VERSION",
        "value": "6.0"
      },
      {
        "name": "VENDOR",
        "value": "motorola"
      },
      {
        "name": "SERIAL"
      },
      {
        "name": "DEVICE_INFO",
        "value": "[{\"name\":\"IMEI\",\"value\":\"359298055243973\"},{\"name\":\"IMSI\",\"value\":\"413025702363929\"},{\"name\":\"DEVICE_MODEL\",\"value\":\"XT1064\"},{\"name\":\"VENDOR\",\"value\":\"motorola\"},{\"name\":\"OS_VERSION\",\"value\":\"6.0\"},{\"name\":\"DEVICE_NAME\",\"value\":\"titan_umts\"},{\"name\":\"BATTERY_LEVEL\",\"value\":\"88\"},{\"name\":\"INTERNAL_TOTAL_MEMORY\",\"value\":\"5.51\"},{\"name\":\"INTERNAL_AVAILABLE_MEMORY\",\"value\":\"0.43\"},{\"name\":\"EXTERNAL_TOTAL_MEMORY\",\"value\":\"0.0\"},{\"name\":\"EXTERNAL_AVAILABLE_MEMORY\",\"value\":\"0.0\"},{\"name\":\"OPERATOR\",\"value\":\"Dialog\"}]"
      },
      {
        "name": "DEVICE_NAME",
        "value": "titan_umts"
      },
      {
        "name": "GCM_TOKEN"
      }
    ]
  }
]
ParameterDefinition
idThe ID of the device.
nameThe name of the device. 
type

The mobile platform of the device. Example: android, ios or windows

descriptionA description of the registered device.

deviceIdentifier

The device ID.

enrolmentInfo

Provide the device enrollment information.

id

The device ID. 

dateOfEnrolment

The date the device was enrolled.

The date is given in the Epoch time format.

dateOfLastUpdate

The date the device was last updated.

The date is given in the Epoch time format.

ownership

Provides the ownership details. The ownership type can be any of the values given below:
  • BYOD - Bring your own device (BYOD).
  • COPE - Corporate owned personally enabled (COPE). 

status

The status of the device. A device can be in the active or inactive state.

owner

Provides the device owner's name.

properties

The properties provide the following information:

  • IMEI:

  • IMSI:

  • DEVICE_MODEL:

  • OS_VERSION:

  • VENDOR:

  • SERIAL:

  • DEVICE_INFO:

  • GCM_TOKEN:

  • DEVICE_NAME:

 

Getting the role details of a user

Description

A user can be assigned to one or more role in WSO2 EMM. Using the REST API given below you are able to get the role/roles a user is assigned to.

Resource Path/roles
URL/mdm-admin/users/roles?username={username}
HTTP MethodGET
Request/Response Formatapplication/json
cURL command
curl -X GET -H "Content-Type: application/json" -H "Authorization: Bearer <EMM_API_TOKEN>" -k -v https://<EMM_HOST>:<EMM_HTTPS_PORT>/mdm-admin/users/roles?username={username} 
  • For more information on how to generate the <EMM_API_TOKEN>, see Generating the EMM API Token.
  • Define the path to the JSON file, which includes the required properties to add a user as the <JSON_PAYLOAD> value. For more information, see the Sample JSON Definition.
  • By default, <EMM_HOST> is localhost. However, if you are using a public IP, the respective IP address or domain needs to be specified.
  • By default, <EMM_HTTPS_PORT> has been set to 9443. However, if the port offset has been incremented by n, the default port value needs to be incremented by n.
  • Provide the user name of the user you wish to get the role details of as the value for {username}.

Example:

curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer 33392fb365b3ac693b405b565ddc8a3a" -k -v https://localhost:9443/mdm-admin/users/roles?username=kim
 Sample output
 > GET /mdm-admin/users/roles?username=kim HTTP/1.1
> Host: localhost:9443
> User-Agent: curl/7.43.0
> Accept: */*
> Content-Type: application/json
> Authorization: Bearer 1ef8b28e74073563fee5c96c526bfa6b
> 
< HTTP/1.1 200 OK
< Cache-Control: private
< Expires: Thu, 01 Jan 1970 05:30:00 IST
< Date: Fri, 04 Mar 2016 08:57:22 GMT
< Content-Type: application/json
< Content-Length: 107
< Server: WSO2 Carbon Server
< 
* Connection #0 to host localhost left intact
{"statusCode":200,"messageFromServer":"User roles obtained for user kim","responseContent":[["marketing"]]}

 

Getting the user count

DescriptionGet the number of users in WSO2 EMM.
Resource Path/count
URL/mdm-admin/users/count
HTTP MethodGET
Request/Response Formatapplication/json
cURL command
curl -X GET -H "Content-Type: application/json" -H "Authorization: Bearer <EMM_API_TOKEN>" -k -v https://<EMM_HOST>:<EMM_HTTPS_PORT>/mdm-admin/users/count
  • For more information on how to generate the <EMM_API_TOKEN>, see Generating the EMM API Token.
  • By default, <EMM_HOST> is localhost. However, if you are using a public IP, the respective IP address or domain needs to be specified.
  • By default, <EMM_HTTPS_PORT> has been set to 9443. However, if the port offset has been incremented by n, the default port value needs to be incremented by n.

Example:

curl -X GET -H "Content-Type: application/json" -H "Authorization: Bearer 33392fb365b3ac693b405b565ddc8a3a" -k -v https://localhost:9443/mdm-admin/users/count
 Sample output
> GET /mdm-admin/users/count HTTP/1.1
> Host: localhost:9443
> User-Agent: curl/7.43.0
> Accept: */*
> Content-Type: application/json
> Authorization: Bearer ba1a8c5203d79c0104b69d82f820f96d
> 
< HTTP/1.1 200 OK
< Cache-Control: private
< Expires: Thu, 01 Jan 1970 05:30:00 IST
< Date: Sat, 05 Mar 2016 07:17:24 GMT
< Content-Type: application/json
< Content-Length: 1
< Server: WSO2 Carbon Server
20
Sample JSON Output
Definition 

Provides the number of users in WSO2 EMM at the time of running the REST API command, as an integer value.

Example: As per the above sample output there are 20 users.

 

Getting user details by searching via the user name

Description

You will have 100+ users registered with WSO2 EMM. If you wish to retrieve the user details of a specific user, and you only remember part of the user's username, you are able to retrieve the user details by giving a character or a few characters in the username. 

Resource Path/view-users
URL/mdm-admin/users/view-users?username={username}
HTTP MethodGET
Request/Response Formatapplication/json
cURL command
curl -X GET -H "Content-Type: application/json" -H "Authorization: Bearer <EMM_API_TOKEN>" -k -v https://<EMM_HOST>:<EMM_HTTPS_PORT>/mdm-admin/users/view-users?username={username}
  • For more information on how to generate the <EMM_API_TOKEN>, see Generating the EMM API Token.
  • By default, <EMM_HOST> is localhost. However, if you are using a public IP, the respective IP address or domain needs to be specified.
  • By default, <EMM_HTTPS_PORT> has been set to 9443. However, if the port offset has been incremented by n, the default port value needs to be incremented by n.
  • Provide any user detail of the user as the value for {username} to retrieve the user details, such as email address, first name or last name.

Example:

curl -X GET -H "Content-Type: application/json" -H "Authorization: Bearer 33392fb365b3ac693b405b565ddc8a3a" -k -v https://localhost:9443/mdm-admin/users/view-users?username=i
 Sample output
> GET /mdm-admin/users/view-users?username=kim@gmail.com HTTP/1.1
> Host: localhost:9443
> User-Agent: curl/7.43.0
> Accept: */*
> Content-Type: application/json
> Authorization: Bearer 465488cd92c200d3203d138438e9f24d
> 
< HTTP/1.1 200 OK
< Cache-Control: private
< Expires: Thu, 01 Jan 1970 05:30:00 IST
< Date: Sat, 05 Mar 2016 08:28:07 GMT
< Content-Type: application/json
< Content-Length: 135
< Server: WSO2 Carbon Server
{"statusCode":200,"messageFromServer":"All users by username were successfully retrieved. Obtained user count: 3","responseContent":[{"username":"admin"},{"username":"jim","firstname":"Jim","lastname":"Bar","emailAddress":"jim@gmail.com"},{"username":"kim","firstname":"Kim","lastname":"Bar","emailAddress":"kim@gmail.com"}]}
Sample JSON Output
Definition 
{
      "username": "jim",
      "firstname": "Jim",
      "lastname": "Bar",
      "emailAddress": "jim@gmail.com"
    },
    {
      "username": "kim",
      "firstname": "Kim",
      "lastname": "Bar",
      "emailAddress": "kim@gmail.com"
    }

The user details of the users having the letter I in their user names is given as the output:

PropertyDefinition
usernameThe name of the user. In this sample all the users having the letter I in their user name are given.
firstnameThe first name of the user.
lastnameThe last name of the user.
emailaddressThe email address of the user.

 

Searching users via the user name

Description

You will have 100+ users registered with WSO2 EMM. Therefore if you are unsure of the user name of a user and need to retrieve the details of a specific user, you can search for that user by giving a character or a few characters in the username. You will be given a list of users having the user name with the exact order of the characters you provided.

Resource Path/users-by-username
URL/mdm-admin/users/users-by-username?username={username}
HTTP MethodGET
Request/Response Formatapplication/json
cURL command
curl -X GET -H "Content-Type: application/json" -H "Authorization: Bearer <EMM_API_TOKEN>" -k -v https://<EMM_HOST>:<EMM_HTTPS_PORT>/mdm-admin/users/users-by-username?username={username}
  • For more information on how to generate the <EMM_API_TOKEN>, see Generating the EMM API Token.
  • By default, <EMM_HOST> is localhost. However, if you are using a public IP, the respective IP address or domain needs to be specified.
  • By default, <EMM_HTTPS_PORT> has been set to 9443. However, if the port offset has been incremented by n, the default port value needs to be incremented by n.
  • Provide a character or a few character in the user name as the value for {username}

Example:

curl -X GET -H "Content-Type: application/json" -H "Authorization: Bearer 33392fb365b3ac693b405b565ddc8a3a" -k -v https://localhost:9443/mdm-admin/users/users-by-username?username=k
 Sample output
> GET /mdm-admin/users/userS-by-username?username=k HTTP/1.1
> Host: localhost:9443
> User-Agent: curl/7.43.0
> Accept: */*
> Content-Type: application/json
> Authorization: Bearer 465488cd92c200d3203d138438e9f24d
> 
< HTTP/1.1 200 OK
< Cache-Control: private
< Expires: Thu, 01 Jan 1970 05:30:00 IST
< Date: Sat, 05 Mar 2016 08:17:06 GMT
< Content-Type: application/json
< Content-Length: 123
< Server: WSO2 Carbon Server
{"statusCode":200,"messageFromServer":"All users by username were successfully retrieved. Obtained user count: 3","responseContent":["admin","jim","kim"]}
Sample JSON Output
Definition 
[
  "admin",
  "jim",
  "kim"
]
PropertyDescription
usersname

The user names in WSO2 EMM that match the search are given as comma separated string values.

For example: Using the REST API command you filter the user names having the letter I. Therefore a list of users having the letter I is given to you.

 

Changing the user password

Description

A user is able to change the password to secure their EMM profile via the REST API given below.

Resource Path/change-password
URL/mdm-admin/users/change-password
HTTP MethodPOST
Request/Response Formatapplication/json
cURL command
curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer <EMM_API_TOKEN>" -d @'<JSON_PAYLOAD>' -k -v https://<EMM_HOST>:<EMM_HTTPS_PORT>/mdm-admin/users/change-password
  • For more information on how to generate the <EMM_API_TOKEN>, see Generating the EMM API Token.
  • Define the path to the JSON file, which includes the required properties to change a user password as <JSON_PAYLOAD> value. For more information, see the Sample JSON Definition.
  • By default, <EMM_HOST> is localhost. However, if you are using a public IP, the respective IP address or domain needs to be specified.
  • By default, <EMM_HTTPS_PORT> has been set to 9443. However, if the port offset has been incremented by n, the default port value needs to be incremented by n.

Example:

curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer 33392fb365b3ac693b405b565ddc8a3a" -d @'user.json' -k -v https://localhost:9443/mdm-admin/users/change-password
 Sample output
 > POST /mdm-admin/users/change-password HTTP/1.1
> Host: localhost:9443
> User-Agent: curl/7.43.0
> Accept: */*
> Content-Type: application/json
> Authorization: Bearer 9ffd50a15654de12e677ebaac9767597
> Content-Length: 83
< HTTP/1.1 201 Created
< Date: Mon, 21 Mar 2016 12:22:20 GMT
< Content-Type: application/json
< Content-Length: 97
< Server: WSO2 Carbon Server
{"statusCode":201,"messageFromServer":"User password by username: kim was successfully changed."}
Sample JSON Definition 
{  
   "username":"kim",
   "oldPassword":"a2ltJDEyMzQ=",
   "newPassword":"a2ltJDEyYmFy"
}
PropertyDefinitionData
Type 
username

Provide the name of the user you wish to change the password.

String
oldPassword

Provide the current password in the base64 encoded format.

 Click here for more information on how to encode the password
  1. Access any base64 encoder. 
    For example: https://www.base64encode.org/
  2. Enter the current password.
    For example:
    kim$1234
  3. Click Encode to generate the encoded key.
    The following is an example of an encoded key:
    a2ltJDEyMzQ=
String
newPassword

Provide the new password in the base64 encoded format.

 Click here for more information on how to encode the passwword
  1. Access any base64 encoder. 
    For example: https://www.base64encode.org/
  2. Enter the current password.
    For example:
    barKim$5467
  3. Click Encode to generate the encoded key.
    The following is an example of an encoded key:
    YmFyS2ltJDU0Njc=
String

 

Resetting the user password

Description

In a situation where you need to block a user from accessing their EMM profile, the EMM administrator is able to reset the password. This will change the user's password and the user will not be able to able to login to the account as he/she is not aware of the new password.

Resource Path/reset-password
URL/mdm-admin/users/reset-password
HTTP MethodPOST
Request/Response Formatapplication/json
cURL command
curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer <EMM_API_TOKEN>" -d @'<JSON_PAYLOAD>' -k -v https://<EMM_HOST>:<EMM_HTTPS_PORT>/mdm-admin/users/reset-password
  • For more information on how to generate the <EMM_API_TOKEN>, see Generating the EMM API Token.
  • Define the path to the JSON file, which includes the required properties to change a user password as <JSON_PAYLOAD> value. For more information, see the Sample JSON Definition.
  • By default, <EMM_HOST> is localhost. However, if you are using a public IP, the respective IP address or domain needs to be specified.
  • By default, <EMM_HTTPS_PORT> has been set to 9443. However, if the port offset has been incremented by n, the default port value needs to be incremented by n.

Example:

curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer 33392fb365b3ac693b405b565ddc8a3a" -d @'user.json' -k -v https://localhost:9443/mdm-admin/users/reset-password
 Sample output
> POST /mdm-admin/users/reset-password HTTP/1.1
> Host: localhost:9443
> User-Agent: curl/7.43.0
> Accept: */*
> Content-Type: application/json
> Authorization: Bearer 0fd1000b683015149711949919c2ce24
> Content-Length: 65
< HTTP/1.1 201 Created
< Date: Tue, 08 Mar 2016 06:43:54 GMT
< Content-Type: application/json
< Content-Length: 99
< Server: WSO2 Carbon Server
{"statusCode":201,"messageFromServer":"User password by username: kim was successfully changed."} 
Sample JSON Definition 
{
  username: "kim",
  oldPassword: "",
  newPassword: "aGVsbG8="
}
PropertyDefinitionData
Type 
username

Provide the name of the user you wish to change the password.

String
newPassword

Provide the new password in the base64 encoded format.

 Click here for more information on how to encode the passwword
  1. Access any base64 encoder. 
    For example: https://www.base64encode.org/
  2. Enter the current password.
    For example:
    barKim$5467
  3. Click Encode to generate the encoded key.
    The following is an example of an encoded key:
    YmFyS2ltJDU0Njc=


String

 

Deleting a user

Description

In a situation where an employee leaves the organization you will need to remove the user details from WSO2 EMM. In such situations you can use the the REST API given below to remove a user.

URL/mdm-admin/users?username={username}
HTTP MethodDELETE
Request/Response Formatapplication/json
cURL command
curl -X DELETE -H "Content-Type: application/json" -H "Authorization: Bearer <EMM_API_TOKEN>" -k -v https://<EMM_HOST>:<EMM_HTTPS_PORT>/mdm-admin/users?username={username} 
  • For more information on how to generate the <EMM_API_TOKEN>, see Generating the EMM API Token.
  • By default, <EMM_HOST> is localhost. However, if you are using a public IP, the respective IP address or domain needs to be specified.
  • By default, <EMM_HTTPS_PORT> has been set to 9443. However, if the port offset has been incremented by n, the default port value needs to be incremented by n.
  • Provide the name of the user you wish to delete as the value for {username}.

Example:

curl -X DELETE -H "Content-Type: application/json" -H "Authorization: Bearer 33392fb365b3ac693b405b565ddc8a3a" -k -v https://localhost:9443/mdm-admin/users?username=kim
 Sample output
> DELETE /mdm-admin/users?username=kim HTTP/1.1
> Host: localhost:9443
> User-Agent: curl/7.43.0
> Accept: */*
> Content-Type: application/json
> Authorization: Bearer 33392fb365b3ac693b405b565ddc8a3a
> 
< HTTP/1.1 200 OK
< Cache-Control: private
< Expires: Thu, 01 Jan 1970 05:30:00 IST
< Date: Sat, 05 Mar 2016 09:22:19 GMT
< Content-Type: application/json
< Content-Length: 90
< Server: WSO2 Carbon Server
< 
{"statusCode":200,"messageFromServer":"User by username: kim was successfully removed."}

 

 

 

com.atlassian.confluence.content.render.xhtml.migration.exceptions.UnknownMacroMigrationException: The macro 'next_previous_links2' is unknown.