Devices Management¶
Get the Device Manager¶
The device manager links to the following resources:
- The
dev.synchronize
relation links to the device synchronization service. - The
dev.reconfigure
relation links to the device reconfiguration service. - The
dev.dhcpinfo
relation links to the device DHCP information service. - The
dev.devices
relation links to the list of devices.
Query¶
GET /provd/dev_mgr HTTP/1.1
Example request¶
GET /provd/dev_mgr HTTP/1.1
Host: xivoserver
Accept: application/vnd.proformatique.provd+json
Example response¶
HTTP/1.1 200 OK
Content-Type: application/vnd.proformatique.provd+json
{
"links": [
{
"href": "/provd/dev_mgr/synchronize",
"rel": "dev.synchronize"
},
{
"href": "/provd/dev_mgr/reconfigure",
"rel": "dev.reconfigure"
},
{
"href": "/provd/dev_mgr/dhcpinfo",
"rel": "dev.dhcpinfo"
},
{
"href": "/provd/dev_mgr/devices",
"rel": "dev.devices"
}
]
}
List Devices¶
Query¶
GET /provd/dev_mgr/devices HTTP/1.1
Query Parameters¶
Field | Description |
---|---|
q | A selector, encoded in JSON, describing which device should be returned. All devices are
returned if not specified. Example: q={"ip":"10.34.1.119"} |
fields | A list of fields, separated by comma. Example: fields=mac,ip |
skip | An integer specifing the number of devices to skip. Example: skip=10 |
sort | The key on which to sort the results. Example: sort=id |
sort_ord | The order of sort; either ASC or DESC . |
Example request¶
GET /provd/dev_mgr/devices HTTP/1.1
Host: xivoserver
Accept: application/vnd.proformatique.provd+json
Example response¶
HTTP/1.1 200 OK
Content-Type: application/vnd.proformatique.provd+json
{
"devices": [
{
"added": "auto",
"config": "38e5e08ffe804b468f5aa53b9536bb25",
"configured": true,
"description": "",
"id": "38e5e08ffe804b468f5aa53b9536bb25",
"ip": "10.34.1.122",
"mac": "00:08:5d:33:e5:76",
"model": "6731i",
"plugin": "xivo-aastra-3.3.1-SP2",
"remote_state_sip_username": "je5qtq",
"vendor": "Aastra",
"version": "3.3.1.2235"
}
]
}
Create a Device¶
Query¶
POST /provd/dev_mgr/devices HTTP/1.1
Example request¶
POST /provd/dev_mgr/devices HTTP/1.1
Host: xivoserver
Content-Type: application/vnd.proformatique.provd+json
{
"device": {
"ip": "192.168.1.1",
"mac": "00:11:22:33:44:55",
"plugin": "xivo-aastra-3.3.1-SP2"
}
}
Example response¶
HTTP/1.1 201 Created
Content-Type: application/vnd.proformatique.provd+json
Location: /provd/dev_mgr/devices/68b10c99945b4fb889f22a7559fc3271
{"id": "68b10c99945b4fb889f22a7559fc3271"}
If the id
field is not given, then an ID is automatically generated by the server.
Get a Device¶
Query¶
GET /provd/dev_mgr/devices/<device_id> HTTP/1.1
Example request¶
GET /provd/dev_mgr/devices/68b10c99945b4fb889f22a7559fc3271 HTTP/1.1
Host: xivoserver
Accept: application/vnd.proformatique.provd+json
Example response¶
HTTP/1.1 200 OK
Content-Type: application/vnd.proformatique.provd+json
{
"device": {
"added": "auto",
"config": "38e5e08ffe804b468f5aa53b9536bb25",
"configured": true,
"description": "",
"id": "38e5e08ffe804b468f5aa53b9536bb25",
"ip": "10.34.1.122",
"mac": "00:08:5d:33:e5:76",
"model": "6731i",
"plugin": "xivo-aastra-3.3.1-SP2",
"remote_state_sip_username": "je5qtq",
"vendor": "Aastra",
"version": "3.3.1.2235"
}
}
Update a Device¶
Query¶
PUT /provd/dev_mgr/devices/<device_id> HTTP/1.1
Example request¶
PUT /provd/dev_mgr/devices/68b10c99945b4fb889f22a7559fc3271 HTTP/1.1
Host: xivoserver
Content-Type: application/vnd.proformatique.provd+json
{
"device": {
"added": "auto",
"config": "38e5e08ffe804b468f5aa53b9536bb25",
"configured": true,
"description": "",
"id": "38e5e08ffe804b468f5aa53b9536bb25",
"ip": "10.34.1.122",
"mac": "00:08:5d:33:e5:76",
"model": "6731i",
"plugin": "xivo-aastra-3.4",
"remote_state_sip_username": "je5qtq",
"vendor": "Aastra",
"version": "3.3.1.2235"
}
}
Example response¶
HTTP/1.1 204 No Content
Delete a Device¶
Query¶
DELETE /provd/dev_mgr/devices/<device_id> HTTP/1.1
Example request¶
DELETE /provd/dev_mgr/devices/68b10c99945b4fb889f22a7559fc3271 HTTP/1.1
Host: xivoserver
Example response¶
HTTP/1.1 204 No Content
Synchronize a Device¶
Query¶
POST /provd/dev_mgr/synchronize HTTP/1.1
Example request¶
POST /provd/dev_mgr/synchronize HTTP/1.1
Host: xivoserver
Content-Type: application/vnd.proformatique.provd+json
{
"id": "d035bccaf0dd4a8396fc57a3329ca0a4"
}
Example response¶
HTTP/1.1 201 Created
Location: /provd/dev_mgr/synchronize/42
The URI returned in the Location
header points to an operation in progress resource.
Reconfigure a Device¶
Query¶
POST /provd/dev_mgr/reconfigure HTTP/1.1
Errors¶
Error code | Error message | Description |
---|---|---|
400 | invalid device ID |
Example request¶
POST /provd/dev_mgr/reconfigure HTTP/1.1
Host: xivoserver
Content-Type: application/vnd.proformatique.provd+json
{
"id": "d035bccaf0dd4a8396fc57a3329ca0a4"
}
Example response¶
HTTP/1.1 204 No Content
Push DHCP Request Information¶
Query¶
POST /provd/dev_mgr/dhcpinfo HTTP/1.1
Example request¶
POST /provd/dev_mgr/dhcpinfo HTTP/1.1
Host: xivoserver
Content-Type: application/vnd.proformatique.provd+json
{
"dhcp_info": {
"ip": "192.168.1.100",
"mac": "00:11:22:33:44:55",
"op": "commit",
"options": [
"06066.6f.6f.62.61.72.a"
]
}
}
Example response¶
HTTP/1.1 204 No Content