-
Notifications
You must be signed in to change notification settings - Fork 16
User Management
This API handles Users
Create user - user is a prerequisite for all system usages. After creating user you will be able to perform actions like account creation, updating your user attributes and other.
User can be created only using Dashboard because of recaptcha requirements. Fill in form with email, password and accept Terms and Conditions. After user activation via link in email sent, you should be able to retrieve userId using /auth/me route.
Param | Type | Description | Value |
---|---|---|---|
Authorization | HTTP Header | Access Token | Authorization: Bearer eyJ0eX... |
userId | URL Slug | The ID of a user. This was returned when the user was created. If you don't have the userId but have user credentials, you can obtain an Authorization Token and then get the Authorization Token Info. The UserId will be the subject of the token payload. If the result body were converted to a JavaScript object, the userId would be at result["payload"]["sub"] | 53e95985c8406a147700b94d |
Request
GET /users/{userId}
Response* 200 OK (application/json)
{
"id":"53e95985c8406a147700b94d",
"accounts":{
"e5d969cd-e7fa-404e-a1e5-f4ce138f62c3":{
"name":"Group1_Account",
"role":"admin",
"healthTimePeriod":86400
}
},
"attributes":{
"phone":"123456789",
"another_attribute":"another_value"
},
"email":"[email protected]",
"termsAndConditions":true,
"verified":true
}
*Response won't contain "accounts" key if user did not create any account nor accept any invitation.
As an user, you can add attributes to your user data. Attributes can be any : pairs.
Param | Type | Description | Value |
---|---|---|---|
Authorization | HTTP Header | Access Token | Authorization: Bearer eyJ0eX... |
Content-Type | HTTP Header | Type of body content | application/json |
userId | URL Slug | The ID of an User | 53e95985c8406a147700b94d |
Request
PUT /users/{userId}
{
"attributes":{
"phone":"123456789",
"another_attribute":"another_value",
"new":"next_string_value"
}
}
Response 200
Delete a User. This action will result in deleting your user data, and also accounts if they do not have any other administrators. You will also no longer be able to use your old token.
Param | Type | Description | Value |
---|---|---|---|
Authorization | HTTP Header | Access Token | Authorization: Bearer eyJ0eX... |
userId | URL Slug | The ID of a User | 53e95985c8406a147700b94d |
Request
DELETE /users/{userId}
Response 204
In order to change password (for cases in which user do not remember the old one) you have to do following steps:
- Invoke POST /users/forgot_password. After this step user will receive email with a url, which can be used to set a new password via IoT Dashboard. In email there will be user's token as a part of resetPassword url. Token is required for successful completion of next steps. Token is unique for user and action.
- Invoke PUT /users/forgot_password, with token from email received by user after completion of point 1. In a request body you have to put new password and token.
Details of methods described above:
Methods generate and send email, which can be used to change password. User email has to be specified in request body.
Param | Type | Description | Value |
---|---|---|---|
Content-Type | HTTP Header | Type of body content | application/json |
Request
POST /users/forgot_password
{
"email":"[email protected]"
}
Response 200
Method set new password for the user. In request body you have put token received in a email (send after invoking POST /users/forgot_password) and the new password.
Param | Type | Description | Value |
---|---|---|---|
Content-Type | HTTP Header | Type of body content | application/json |
Request
PUT /users/forgot_password
{
"token":"ki2pc9RdnVVSKoN4",
"password":"Qwerty2"
}
Response 200
Methods set new password for a user (identified by email).
Param | Type | Description | Value |
---|---|---|---|
Authorization | HTTP Header | Access Token | Authorization: Bearer eyJ0eX... |
Content-Type | HTTP Header | Type of body content | application/json |
URL Slug | The email of an User | [email protected] |
Request
PUT /users/{email}/change_password
{
"currentpwd": "Qwerty1",
"password": "Qwerty2"
}
Response 200
Methods generate and send email, which can be used to activate user. User email has to be specified in request body.
Param | Type | Description | Value |
---|---|---|---|
Content-Type | HTTP Header | Type of body content | application/json |
Request
POST /users/request_user_verification
{
"email":"[email protected]"
}
Response 200
- Home
-
Overview
- Rule Engine
- Service Hub
- Dashboard
- Data Backend
- Integration of Analytics
- IoT Agent
- Using Docker
- Authentication and Authorization
- Rest API
- Configuration
- Build