Users

A user is a person associated with a customer account with access to one or more geozones associated with at least one SmartServer IoT license.

URI Definition

Method

URI and Fields

GET

/iap/users

Returns different results based on passed parameters. Returns the user with the specified ID if the Id parameter is not equal to null. Returns the user with the specified name if the Id parameter is null and userName parameter is not null. If both Id and userName parameters are null, then all users are returned. Returns the specific user or NOT_FOUND, if either Id or userName is specified. Returns all users otherwise.

Query Parameters

  • id - User ID
  • name - UserName (i.e. login)

Success Response

Specific user or NOT_FOUND if either id or userName specified. Returns all users otherwise.

Example

https://localhost/iap/users


Response

[
   {
       "id": 44,
       "userName": "admin",
       "firstName": "System",
      "lastName": "Administrator",
       "emailAddress": "fake_email@localhost.net",
       "locale": null,
       "customerId": null,
       "userType": "ADMIN",
       "licenseAgreementAccepted": true,
       "demoMode": "GLOBAL",
       "googleApiKey": "AIzaSyBPoKM5jk-m4DZk1F_4armlUCXXyHfi6Bo",
       "blocked": false
   },
   {
       "id": 486,
       "userName": "user",
       "firstName": "User",
       "lastName": "User",
       "emailAddress": "user@user.com",
       "locale": null,
     "customerId": 81,
       "userType": "USER",
       "licenseAgreementAccepted": true,
       "demoMode": "GLOBAL",
       "googleApiKey": "33",
       "blocked": false
   },
   {
       "id": 485,
       "userName": "owner",
       "firstName": "Owner",
       "lastName": "Owner",
       "emailAddress": "owner@owner.com",
       "locale": null,
       "customerId": 81,
       "userType": "OWNER",
       "licenseAgreementAccepted": true,
       "demoMode": "GLOBAL",
       "googleApiKey": "33",
       "blocked": false
   }
]                                                                                                                                                   

/iap/users/count

Returns the number of users that the current user has the permission to see.

Success Response

Number of users.

Example

https://localhost/iap/users/count


Response

{
   "value": 3
}                                                                                                                                                   

/iap/users/current

Returns the user associated with the current session.

Success Response

Current user.

Example

https://localhost/iap/users/current


Response

{
   "id": 44,
   "userName": "admin",
   "firstName": "System",
   "lastName": "Administrator",
   "emailAddress": "fake_email@localhost.net",
   "locale": null,
   "customerId": null,
   "userType": "ADMIN",
   "licenseAgreementAccepted": true,
   "demoMode": "NO",
   "googleApiKey": "AIzaSyBPoKM5jk-m4DZk1F_4armlUCXXyHfi6Bo",
   "blocked": false
}                                                                                                                                                   


/iap/users/list

Returns the supported locales.

Success Response

Collection of locales.

Example

https://localhost/iap/users/list


Response

{
   "value": "[en-us, es-mx]"
}                                                                                                                                                   

/iap/users/locale

Returns the locale of the current user session.

Success Response

Current locale.

Example

https://localhost/iap/users/locale


Response

{
   "value": "en-us"
}                                                                                                                                                   

/iap/users/{Id}/customer

Returns the parent customer to which the user belongs. The currently logged in user must be a member of the same customer, or the currently logged-in user must be the administrator.

Note, this is ONLY useful if the currently logged-in user is the administrator, which can see all users of all customers.

Parameter

  • id – ID of the user

Success Response

Customer information for a scpecified user.

Example

https://localhost/iap/users/485/customer


Response

{
   "id": 81,
   "name": "Customer 1",
   "shortName": "cst",
   "cid": 1,
   "encryptionKey": "7ff91b86c75942e44c0055a724c7353c",
   "deviceSearchingRange": 50,
   "deviceNumberLimitation": 255,
   "licensingEnhancement": "PREMIUM",
   "googleApiKey": "33",
   "licenseTill": 1868874911262
}                                                                                                                                                   

PUT

/iap/users

Updates an existing user with the specified properties.

Request Payload

The request payload must contain the user properties to update.

Success Response

Returns updated user.

Example

https://localhost/iap/users


Request Payload

{
  "id":1393,
  "userName":"api_user",
  "firstName":"UPDATED USER",
  "lastName":"UPDATED USER",
  "emailAddress":"api_user@user.com",
  "locale":null,
  "customerId":81,
  "userType":"USER",
  "licenseAgreementAccepted":true,
  "demoMode":"GLOBAL",
  "googleApiKey":"33",
  "blocked":false
}


Response

{
   "id": 1393,
   "userName": "api_user",
   "firstName": "UPDATED USER",
   "lastName": "UPDATED USER",
   "emailAddress": "api_user@user.com",
   "locale": null,
   "customerId": 81,
   "userType": "USER",
   "licenseAgreementAccepted": true,
   "demoMode": "GLOBAL",
   "googleApiKey": "33",
   "blocked": false
}                                                                                                                                                   


/iap/users/count

Accepts license for current user. This operation is need to be done only to following user types: user manager, owner, admin. All other types of users doesn't need to accept license agreement. User is prohibited to use any other restful API methods before he accepts license agreement except for login and logout methods.

Success Response

Empty.

Example

https://localhost/iap/users/acceptlicense


Response

Empty.                                                                                                                                                   

/iap/users/cp

Changes a user's password.

Request Payload

The request payload must contain the user name, current password and the new password.

Success Response

Empty.


Example

https://localhost/iap/users/cp


Request Payload

{
  "userName":"admin",
  "currentPassword":"admin",
  "newPassword":"Qwerty12345$"
}


Response

Empty.                                                                                                                                                 



/iap/users/acceptlicense

Accepts the license for the current user. This operation is required only for the following user types: user manager, owner, and admin.

For all other types of users, you do not need to accept the license agreement. Any attempt to use other REST API methods before accepting the license agreement will result in an error (such as a 404 or 500, etc.), except for login and logout methods.


POST

/iap/users

Creates a new user with the specified properties.

Request Payload

The request payload must contain the userDTO with the password provided

Success Response

Successfully created user.

Example

https://localhost/iap/users


Request Payload

{
  "userName":"api_user",
  "demoMode":"GLOBAL",
  "firstName":"API USER",
  "lastName":"API USER",
  "emailAddress":"api_user@user.com",
  "userType":"USER",
  "customerId":81,
  "password":"Qwerty12345$"
}


Response

{
   "id": 1393,
   "userName": "api_user",
   "firstName": "API USER",
   "lastName": "API USER",
   "emailAddress": "api_user@user.com",
   "locale": null,
   "customerId": 81,
   "userType": "USER",
   "licenseAgreementAccepted": true,
   "demoMode": "GLOBAL",
   "googleApiKey": "33",
   "blocked": false
}                                                                                                                                                  


/iap/users/locale

Changes the locale of the current user session.

Success Response

Empty.

Example

https://localhost/iap/users/locale

Request Payload

es-mx

Response

Empty.                                                                                                                                                 

DELETE

/iap/users/{id}

Deletes from the CMS, the user with the specified ID.

Parameters

  • id – ID of the user to delete

Success Response

Empty.

Example

https://localhost/iap/users/1393


Response

Empty.                                                                                                                                                   

Query Parameters

Optional query parameters can be used with your REST request.  Specifying queries is described under Queries and ParametersPath Parameters, and Query Parameters.