API Create User

From IVS Wiki
Jump to: navigation, search

This API call will create a new user group.

Resource URL

http://valt.example.com/api/v3/admin/users

Resource Information

Method POST
Headers Content-Type:application/json
Response Type JSON
Authentication Required Yes

Parameters

The JSON body must be properly formatted. All fields and values should be enclosed in double quotes and separated by a colon.

Field Name Description Required Example
name User Name yes John
password User Name yes VALTisGR3@T
display_name If populated will display instead of the user name. no John Doe
user_group Primary group ID for the new user. no 7
card_number RFID Card Number or PIN Code for Keypad no 362504
rooms Array of rooms the new group will have access to. no [1,4,7]
video_access no {"users":[15],"user_groups":[1]}
users Array of user ids who's videos the new group will have access to. no [17,39,84]
user_groups Array of user group ids who's videos the new group will have access to. no [1,3,17]

Response

Code Reason
200 User Created Successfully
400 Invalid Request (See Response for Specific Error)
401 Unauthorized
500 User Name already exists.
JSON Response
data
id ID number for the new user.

Examples

Request

The sample JSON body below is formatted with line breaks and indentation to make it easier to read. This is not required.

https://ivstest1.ad.ipivs.com/api/v3/admin/users?access_token=e82632d19c523678fea3d1016c6df9e9
{
"name":"jdoe3",
"password":"apiuser",
  "display_name":"John Doe",
  "user_group":1,
  "card_number":"32650",
  "rooms":[37,39,43],
  "video_access":
  {
    "users":[15],
    "user_groups":[1]
  }
  
}

Successful Response

Sample response is shown with line breaks to make it more readable. Actual responses will not include line breaks.

{
"data":{
"id": 48
}
}

Failure Response

Sample response is shown with line breaks to make it more readable. Actual responses will not include line breaks.

{
"error":{
"code": 500,
"message": "Internal Server Error"
}
}