User
Authentication
HTTP Basic / Digest authentication is required. The user must have permission to configure system.
User Attributes
Name | Format | Description |
---|---|---|
id | Number | User ID |
name | Text | User Name |
password | Text | User Password |
description | Text | Description |
permission | Permission Object | Permission Information |
Permission Information
Name | Format | Description |
---|---|---|
systems | System Permissions | System Permission List |
cameras | Camera Permissions | Camera Permission List |
System Permissions:
configure
: System Settingsearch
: Recording Data Searchdevice
: Device Controlnetwork
: Connecting over a networkbackup
: Recording Data Backup
Camera Permissions:
camera
: Camera Number (1 ~ N)view
: View Permissioncontrol
: Device Control Permission
List Users
GET /api/users
The following is an example of getting a list of users.
Request:
GET /api/users HTTP/1.1
Host: demo.emstone.com
Authorization: [Basic Authentication]
Content-Type: application/json
Response:
HTTP/1.1 200 OK
Content-Type: application/json
{
"users": [
{
"id": 1,
"name": "admin",
"description": "Administrator",
"strict_password": 1,
"permission": {
"systems": [ "configure", "network", "device", "search", "backup" ],
"cameras": [
{ "camera": 1, "view": true, "control": true },
{ "camera": 2, "view": true, "control": true },
{ "camera": 3, "view": true, "control": true },
{ "camera": 4, "view": true, "control": true }
]
}
},
{
"id": 2,
"name": "guest",
"description": "Guest",
"strict_password": 1,
"permission": {
"systems": [ "network" ],
"cameras": [
{ "camera": 1, "view": true, "control": false },
{ "camera": 2, "view": true, "control": false },
{ "camera": 3, "view": true, "control": false },
{ "camera": 4, "view": true, "control": false }
]
}
}
]
}
Get User Information
GET /api/users/:id
The following is an example of getting information about a user whose id
is 1.
Request:
GET /api/users/1 HTTP/1.1
Host: demo.emstone.com
Authorization: [Basic Authentication]
Content-Type: application/json
Response:
HTTP/1.1 200 OK
Content-Type: application/json
{
"id": 1,
"name": "admin",
"description": "Administrator",
"strict_password": 1,
"permission": {
"systems": [ "configure", "network", "device", "search", "backup" ],
"cameras": [
{ "camera": 1, "view": true, "control": true },
{ "camera": 2, "view": true, "control": true },
{ "camera": 3, "view": true, "control": true },
{ "camera": 4, "view": true, "control": true }
]
}
}
Add User
POST /api/users HTTP/1.1
The following is an example of adding a user whose name
is dooly.
Request:
POST /api/users
Host: demo.emstone.com
Authorization: [Basic Authentication]
Content-Type: application/json
{
"name": "dooly",
"password": "passwordfordooly",
"description": "Danosaur Dooly",
"permission": {
"systems": [ "network" ],
"cameras": [
{ "camera": 1, "view": true, "control": false },
{ "camera": 2, "view": true, "control": false },
{ "camera": 3, "view": true, "control": false },
{ "camera": 4, "view": true, "control": false }
]
}
}
Response:
HTTP/1.1 201 Created
Content-Type: application/json
{
"name": "dooly",
"description": "Danosaur Dooly",
"strict_password": 1,
"permission": {
"systems": [ "network" ],
"cameras": [
{ "camera": 1, "view": true, "control": false },
{ "camera": 2, "view": true, "control": false },
{ "camera": 3, "view": true, "control": false },
{ "camera": 4, "view": true, "control": false }
]
}
}
Modify User
PUT /api/users/:id
The following example modifies the password and description for a user whose id
is 3.
Request:
PUT /api/users/3 HTTP/1.1
Host: demo.emstone.com
Authorization: [Basic Authentication]
Content-Type: application/json
{
"password": "newpassword"
"description": "Dooly"
}
Response:
HTTP/1.1 200 OK
Content-Type: application/json
{
"name": "dooly",
"description": "Dooly",
"strict_password": 1,
"permission": {
"systems": [ "network" ],
"cameras": [
{ "camera": 1, "view": true, "control": false },
{ "camera": 2, "view": true, "control": false },
{ "camera": 3, "view": true, "control": false },
{ "camera": 4, "view": true, "control": false }
]
}
}
Remove User
DELETE /api/users/:id
The following is an example of removing users with an id
of 3.
Request:
DELETE /api/users/3 HTTP/1.1
Host: demo.emstone.com
Authorization: [Basic Authentication]
Content-Type: application/json
Response:
HTTP/1.1 200 OK
Content-Type: application/json
{
"id": 3
}