Remove Devices from an Address Group
Use this API to you remove one or more devices from an address group.
URI
https://[host]/api/juniper/servicenow/address-group-management/addressGroups/{id} /deassociateDevices (HTTP method = POST)
URI Parameters
Parameter | Type | Required | Description |
---|---|---|---|
id | Integer | Yes | ID of the address group from which devices are to be removed |
Consumes
- application/vnd.juniper.servicenow.address-group-management.devices+xml;version=1; charset=UTF-8
- application/vnd.juniper.servicenow.address-group-management.devices+json;version=1; charset=UTF-8
Request Elements
Element | Type | Description |
---|---|---|
device | device | Device to be removed from the address group |
href | String | Link to the address group |
addressType | String | Type of address Possible values:
|
Produces
- application/vnd.juniper.servicenow.address-group-management.adddevicesmsg+xml;version=1
- application/vnd.juniper.servicenow.address-group-management.adddevicesmsg+json;version=1
Response Elements
Element | Type | Description |
---|---|---|
status | String | Status of the remove devices from address group job |
desc | String | Description of the job status |
keys | key | colleciton of device IDs |
key | Integer | ID of a device |
exceptions | exception | Collection of exceptions that occurred during the job |
exception | exception | An exception |
severity | String | Severity of the exception Possible values:
|
code | String | Code for the exception |
desc | String | Description of the exceptioni |
keys | key | Collection of device IDs for which the exception was raised |
key | Integer | ID of the device for which the exception was raised |
Sample Input
Sample XML Input
<devices> <device href="/api/juniper/servicenow/device-management/devices/1671168"> <addressType>1</addressType> </device> <device href="/api/juniper/servicenow/device-management/devices/1671181"> <addressType>2</addressType> </device> <device href="/api/juniper/servicenow/device-management/devices/1671197"> <addressType>0</addressType> </device> <device href="/api/juniper/servicenow/device-management/devices/1234"> <addressType>1</addressType> </device> <device href="/api/juniper/servicenow/device-management/devices/1671208"> <addressType>4</addressType> </device> </devices>
Sample JSON Input
{ "devices": { "device": [ { "@href": "/api/juniper/servicenow/device-management/devices/1671168", "addressType": "0" }, { "@href": "/api/juniper/servicenow/device-management/devices/1671181", "addressType": "1" }, { "@href": "/api/juniper/servicenow/device-management/devices/1671197", "addressType": "2" }, { "@href": "/api/juniper/servicenow/device-management/devices/1234", "addressType": "2" }, { "@href": "/api/juniper/servicenow/device-management/devices/1671208" } ] } }
Sample Output
Sample XML Output
<servicenowmsg> <status> <desc> Device successfully deassociated from address group </desc> <keys> <key>1671197</key> </keys> </status> <exceptions> <exception> <severity>ERROR</severity> <code>SN-1000</code> <desc>Invalid Devices</desc> <keys> <key>1234</key> </keys> </exception> <exception> <severity>ERROR</severity> <code>SN-1007</code> <desc>Address Type is not valid</desc> <keys> <key>1671208</key> </keys> </exception> <exception> <severity>WARN</severity> <code>SN-1008</code> <desc>Device is not associated to the address group</desc> <keys> <key>1671168</key> <key>1671181</key> </keys> </exception> </exceptions> </servicenowmsg>
Sample JSON Output
{ "servicenowmsg": { "status": { "desc": "Device successfully deassociated from address group", "keys": { "key": 1671168 } }, "exceptions": { "exception": [ { "severity": "ERROR", "code": "SN-1000", "desc": "Invalid Devices", "keys": { "key": 1234 } }, { "severity": "WARN", "code": "SN-1008", "desc": "Device is not associated to the address group", "keys": { "key": [ 1671208, 1671181, 1671197 ] } } ] } } }
Response Status Code
Message | Description |
---|---|
404 Not Found | Address group ID not found in Service Now. |
SN-1007 | Address type is not valid. |
SN-1000 | Specified devices are not valid. |
SN-1008 | Device is not associated with the address group. |