Create a Device Group
The create Device Group operation creates a device group in Service Now.
URI
https://[host]/api/juniper/servicenow/device-group-management/deviceGroup /createDeviceGroup (HTTP method = POST)
URI Parameters
None
Consumes
application/vnd.juniper.servicenow.device-group-management.createdevicegroup+xml; version=1;charset=UTF-8
application/vnd.juniper.servicenow.device-group-management.createdevicegroup+json; version=1;charset=UTF-8
Request Elements
Element | Type | Description |
---|---|---|
deviceGroupName | String | Name of the device group This is a mandatory element. |
defaultDeviceGroup | String | Flag to specify if the device group is the default device group Possible values:
|
organization | String | Organization to which the device group is to be assigned |
href | String | Link to the organization |
devices | device | Collection of devices to be assigned to the device group |
device | String | Link to a device to be included in the device group |
policies | policy | Collection of auto submit policies associated with the device group |
policy | String | Link to the auto submit policy associated with the device group |
domainId | Integer | ID of the domain in which the device group should be created. This is an optional element. If no domain ID is provided, the device group is created in the Global domain. Note: The create request fails if a user does not have access to the Global domain and if no domain ID is provided with the create request. |
Produces
application/vnd.juniper.servicenow.device-group-management.createdevicegroup. servicenowmsg+xml;version=2
application/vnd.juniper.servicenow.device-group-management.createdevicegroup. servicenowmsg+json;version=2
Response Elements
Element | Type | Description |
---|---|---|
msg | String | Status message of the create device group job |
Sample Input
Sample XML Input
<createDeviceGroup> <deviceGroupName>Juniper Device Group2</deviceGroupName> <defaultDeviceGroup>true</defaultDeviceGroup> <organization href ="/api/juniper/servicenow/organization-management/organization/65546"/> <devices> <device href= "/api/juniper/servicenow/device-management/devices/65548"/> <device href= "/api/juniper/servicenow/device-management/devices/100"/> </devices> <policies> <policy href="/api/juniper/servicenow/autosubmit-policy-management/autosubmitpolicies/68597"/> <policy href="/api/juniper/servicenow/autosubmit-policy-management/autosubmitpolicies/201"/> </policies> <domainId>102</domainId> </createDeviceGroup>
Sample JSON Input
{ "createDeviceGroup":{ "deviceGroupName":"Juniper Device Group", "defaultDeviceGroup":"true", "domainId":"10" "organization":{ "@href":"/api/juniper/servicenow/organization-management/organization/65546" }, "devices":{ "device":[ { "@href":"/api/juniper/servicenow/device-management/devices/65548" }, { "@href":"/api/juniper/servicenow/device-management/devices/100" } ] } "policies":{ "policy":[ { "@href":"/api/juniper/servicenow/autosubmit-policy-management/autosubmitpolicies/68597" }, { "@href":"/api/juniper/servicenow/autosubmit-policy-management/autosubmitpolicies/201" } ] } } }
Sample Output
Sample XML Output
<servicenowmsg> <status> <desc> Device group successfully created and devices are successfully associated with this device group. </desc> <keys> <key>65548</key> <key>100</key> </keys> </status> <exceptions> <exception> <severity>ERROR</severity> <code>SN-1000</code> <desc>Invalid Devices</desc> <keys> <key>100</key> </keys> </exception> </exceptions> </servicenowmsg>
Sample JSON Output
{ "servicenowmsg": { "status": { "desc": "Device group successfully created. and Devices are successfully associated with this device group", "keys": { "key": [ 229385, 229382 ] } }, "exceptions": { "exception": { "severity": "ERROR", "code": "SN-1000", "desc": "Invalid Devices", "keys": { "key": 100 } } } } }
Response Status Code
Message | Description |
---|---|
SN-1000 | Invalid device ID, device not found |
404 Not Found | Invalid organization ID, organization not found |
400 Bad Request | One of the following:
|