A unit must belong to a domain and one domain only. A unit can contain one or many (child) units, but a unit can only belong to one (parent) unit only. In other words, the relationship between units is one-many.
Attribute |
|
type |
|
values |
|
default |
|
mandate |
|
comment |
|
name |
|
string |
|
|
|
|
|
true |
|
|
|
description |
|
string |
|
|
|
|
|
false |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
domain |
|
object |
|
|
|
|
|
true |
|
the domain that the unit belongs to |
|
parent |
|
object |
|
|
|
|
|
true |
|
the parent unit |
|
hasChildren |
|
boolean |
|
|
|
|
|
|
|
|
|
children |
|
coll |
|
|
|
|
|
|
|
|
|
repository |
object |
|
|
|
|
|
|
|
|
|
|
radiusProfile |
object |
|
|
|
|
|
|
|
|
|
|
policies |
|
coll |
|
|
|
|
|
|
|
Assigned policies |
|
radiusProfile |
|
object |
|
|
|
|
|
|
|
|
|
radiusAttributes |
|
coll |
|
|
|
|
|
|
|
|
|
To create a new unit, we must specify the name of the unit and its parent: either a domain or a unit. On success, the method always returns the internal unit id of the newly created unit.
Parameters:
{
"attrs":{list of attribute value pairs}
}
Response:
{
"error":0,
"result":{"id":the id of the newly created unit}
}
Examples:
Method:/unit/create
Parameters:
{
"attrs":
{
"name":"sales",
"description":"sales dept.",
"domain.id":2
}
}
Response: {"error":0, "result":{"id":1}}
Method:/unit/create
Parameters:
{
"attrs":
{
"name":"sales - london",
"description":"sales team in London",
"parent.id":1
}
}
Response: {"error":0, "result":{"id":2}}
Examples:
Method:/unit/search Parameters: \{ "match": \[ \[domain.id", "=", 1\], \[name", "like", "sales%"\] \], "return":\["name", "id", "domain.id", "parent.id"\], "sort":"name", "order":"asc", "max": 20, "offset": 0 \} Response: \{ "error":0, "result": \[ \{ "name":"sales", "id":"1", "domain.id":1, "parent.id":null \}, \{ "name":"sales - london", "id":"2", "domain.id":1, "parent.id":1 \}, \{ ... \} \] \} |
Method:/unit/search Parameters: \{ "match": \[ \[domain.id", "=", 1\] \[parent.id", "=", null\] \], "return":\["name", "id"\], "sort":"name", "order":"asc", "max": 20, "offset": 0 \} Response: \{ "error":0, "result": \[ \{ "name":"sales", "id":1, \}, \{ ... \} \] \} \\ |
Method:/unit/search Parameters: \{ "match": \[ \[domain.id", "=", 1\], \[parent.id", "=", 2\] \], "return":\["name", "id"\], "sort":"name", "order":"asc", "max": 20, "offset": 0 \} Response: \{ "error":0, "result": \[ \{ "name":"sales - london", "id":2, \}, \{ ... \} \] \} \\ |
Method:/unit/get Parameters: \{ "match": \[ \["id", "=", 2\], \], "return":\["name", "id", "domain.id","parent.id"\], \} Response: \{ "error":0, "result": \{ "name":"sales - london", "id":"2", "domain.id":1, "parent.id":1 \} \} |
Method:/unit/set
Parameters:
{
"id":1,
"attrs":{"description":"new description"}
}
Response:
{
"error":0
}
Method:/unit/delete
Parameters:
{
"id":1
}
Response:
{
"error":0
}
Method:/unit/addUsers Parameters: \{ "id":unit_id, "users": \[ \{id:uid1\}, \{id:uid2\} \] \} Response: \{ "error":0 \} \\ |
Method:/unit/deployTokens
Parameters:
{
"attrs":
{
"unit.id":unit_id,
"product.id":product_id
}
}
Response:
{
"error":0
}
Other Methods: