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

    Associate a Device with a Device Group

    Use this API to add devices to a device group.

    URI

    https://[host]/api/juniper/servicenow/device-group-management/deviceGroup /{id}/associateDevices (HTTP method = POST)

    URI Parameters

    Parameter

    Type

    Required

    Description

    id

    Integer

    Yes

    ID of the device to be associated with the device group

    Consumes

    • application/vnd.juniper.servicenow.device-group-management.associatedevices+xml;version=1; charset=UTF-8
    • application/vnd.juniper.servicenow.device-group-management.associatedevices+json;version=1 ;charset=UTF-8

    Request Elements

    Element

    Type

    Description

    devices

    device

    Collection of devices

    device

    device

    A device to be associated with the device group

    href

    String

    Link to the device

    key

    Integer

    ID of the device

    Produces

    • application/vnd.juniper.servicenow.device-group-management.servicenowmsg+json;version=1
    • application/vnd.juniper.servicenow.device-group-management.servicenowmsg+json;version=1

    Response Elements

    Element

    Type

    Description

    desc

    String

    Description of the associate device with device group job status

    key

    Integer

    ID of the device

    exceptions

    exception

    Exceptions that might have occurred in the job

    severity

    String

    Severity of the exception

    code

    String

    Exception code

    desc

    String

    Description of the exception

    Key

    Integer

    ID of the exception

    Sample Input

    Sample XML Input

    <associatedevices>
            <devices>
                    <device href ="/api/juniper/servicenow/device-management/devices/99503"/>
                    <device href ="/api/juniper/servicenow/device-management/devices/99505"/>
                    <device href ="/api/juniper/servicenow/device-management/devices/100"/>
            </devices>
    </associatedevices>
    
    

    Sample JSON Input

    {
       "associatedevices": {
          "devices": {
             "device": [
                {
                   "@href": "/api/juniper/servicenow/device-management/devices/99503"
                },
                {
                   "@href": "/api/juniper/servicenow/device-management/devices/99505"
                },
                {
                   "@href": "/api/juniper/servicenow/device-management/devices/100"
                }
             ]
          }
       }

    Sample Output

    Sample XML Output

    <servicenowmsg>
            <deviceStatus>
                    <desc> 
                            Device successfully associated with device group
                    </desc>
                    <keys>
                            <key>99503</key>
                            <key>99505</key>
                    </keys>
            </deviceStatus>
            <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:{
            devicestatus:{
                desc:'Device successfully associated with device group',
                keys:{
                    key:[
                        99503,
                        99505
                    ]
                }
            },
            exceptions:{
                exception:{
                    severity:'ERROR',
                    code:'SN-1000',
                    desc:'Invalid Devices',
                    keys:{
                        key:100
                    }
                }
            }
        }
    

    Response Status Code

    Message

    Description

    404 Not Found

    Invalid device ID or invalid device group ID specified.

    Modified: 2016-08-11