Devices
Query Portax core device database
DESCRIPTION
Devices REST resource provides simple GET method to query Portax device database.
Devices REST API is available at $Portax::WebPath/rest/devices
METHODS
GET
Find devices.
- ip
- Limit query results to IP address
- mac
- Limit query results to MAC address
- limit
- Page size from 10 to 100, default is 10
- page
- Goto
page
, start from 0 - offset
- Skip offset rows in response
EXAMPLE
QUERY
curl -s --cert-type P12 \ --cert $CERT:$PASS \ $URL/rest/devices?mac=ec:1d:7f:0b:21:d5
RESPONSE
Anonymized
{ "results": [ { "id": 38, "uptime": 426042186, "model": "ZXC300", "mac": "ec:1d:7f:0b:21:d5", "uir_id":, "ident": null, "lat":, "hostname": "", "lng":, "community": "", "type": "PON", "ip": "", "path": { "impact": "2", "children": [ { "text": "gpon_1/3/1", "impact": "1", "children": [ { "text": "375, Ilene Sanford" } ] }, ], "text": "" }, "class": null } ] }
POST
Create device.
- ip
- device IP address
- type
- device type
L2 L3 PON WIRELESS CMTS OTHER
- hostname
- device hostname
- community
- SNMP community
- mac
- device MAC address
- uir_id
- UIR ID
- lat
- latitude
- lng
- longitude
- tags
- tags
- model
- device model
- description
- device description, aka note
- region_id
- region ID (query Regions API)
EXAMPLE
CREATE
data.json
{ "ip": "10.5.5.5", "community": "public", "ident": null, "model": "ATX90048FS", "mac": "02:00:cd:28:51:4b", "type": "L2", "lat": 49.576467, "lng": 17.252152, "hostname": "new-device", "uir_id": 23317451, "tags": [ "tag1", "tag2"] }
curl -s --cert-type P12 \ --cert $CERT:$PASS \ -X POST --data @data.json \ $URL/rest/devices
RESPONSE
{ "results": { "ident": null, "lat": 49.576467, "uir_id": 23317451, "ip": "10.5.5.5", "community": "public", "model": "ATX90048FS", "lng": 17.252152, "region_id": null, "type": "L2", "hostname": "new-device", "mac": "02:00:cd:28:51:4b", "id": 1327612, "tags": [ "tag1", "tag2" ] } }
PATCH
data.json
{ "hostname": "new-device-renamed", "meta": { "poll-interval": 30 } }
curl -s --cert-type P12 \ --cert $CERT:$PASS \ -X PATCH --data @data.json \ $URL/rest/devices/1327612
RESPONSE
{ "results": { "ident": null, "lat": 49.576467, "uir_id": 23317451, "ip": "10.5.5.5", "community": "public", "model": "ATX90048FS", "lng": 17.252152, "region_id": null, "type": "L2", "hostname": "new-device-renamed", "mac": "02:00:cd:28:51:4b", "id": 1327612 } }
Last modified
7 months ago
Last modified on Oct 10, 2023, 9:10:43 AM
Note:
See TracWiki
for help on using the wiki.