Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

Navigation
Guide That Contains This Content
[+] Expand All
[-] Collapse All

    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:

    • true—The device group is the default device group
    • false—The device group is not the default device group

    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

    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=1
    • application/vnd.juniper.servicenow.device-group-management.createdevicegroup. servicenowmsg+json;version=1

    Response Elements

    Element

    Type

    Description

    msg

    String

    Status message of the create device group job

    Sample Input

    Sample XML Input

    <createDeviceGroup>
    <deviceGroupName>Juniper Device Group</deviceGroupName>
    <defaultDeviceGroup>true</defaultDeviceGroup>
    <organization href = "/api/juniper/servicenow/organization-management/organization/229380"/>
    <devices>
         <device href= "/api/juniper/servicenow/device-management/devices/229382"/>
         <device href= "/api/juniper/servicenow/device-management/devices/229385"/>
         <device href= "/api/juniper/servicenow/device-management/devices/100"/>
    </devices>
    <domainId>10</domainId>
    </createDeviceGroup>
    

    Sample JSON Input

    {
       "createDeviceGroup":{
          "deviceGroupName":"Juniper Device Group",
          "defaultDeviceGroup":"true",
    	   "domainId":"10"
          "organization":{
             "@href":"/api/juniper/servicenow/organization-management/organization/229380"
          },
          "devices":{
             "device":[
                {
                   "@href":"/api/juniper/servicenow/device-management/devices/229382"
                },
                {
                   "@href":"/api/juniper/servicenow/device-management/devices/229385"
                },
                {
                   "@href":"/api/juniper/servicenow/device-management/devices/100"
                }
             ]
          }
       }
    }
    

    Sample Output

    Sample XML Output

    <servicenowmsg>
                   <status>
                 	  <desc>
                          Device group successfully created and devices are successfully associated with this device group.
                 	  </desc>
               	  <keys>
    				<key>229385</key>
    				<key>229382</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:

    • Invalid device group name is specified, device group name cannot be null or empty.
    • Invalid organization name, organization name cannot be null or empty.

    Modified: 2016-08-11