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

    Add a Device to Service Now

    Use this API to add a device from Junos Space Network Management platform to Junos Space Service Now.

    URI

    https://[host]/api/juniper/servicenow/device-management/devices/add (HTTP method = POST)

    URI Parameters

    None.

    Consumes

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

    Request Elements

    Element

    Type

    Description

    devices

    device

    Collection of devices to be added to Service Now

    device

    device

    A device to be added to Service Now

    href

    String

    Link to the device

    Produces

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

    Response

    Element

    Type

    Description

    deviceStatus

    deviceStatus

    Status message of the add device to Service Now job

    desc

    String

    Status message of the add device job

    key

    Integer

    ID of the device added to Service Now

    exceptions

    exception

    Collection of exceptions that occur during the add device job

    exception

    exception

    An exceptionC

    severity

    String

    Severity of the operation.

    Possible values:

    • WARN
    • ERROR

    code

    String

    Service Now-specific error code.

    desc

    String

    Description of the exception

    key

    Integer

    ID of the device for which the eXception was raised

    Sample Input

    Sample XML Input

    <adddevices>
            <devices>
                    <device href="/api/space/device-management/devices/262256"/>
                    <device href="/api/space/device-management/devices/100"/>
                    <device href="/api/space/device-management/devices/262220"/>
            </devices>
    </adddevices>
    

    Sample JSON Input

    {
    "adddevices":{
            "devices":{
                "device":[
                    {
                        "@href":"/api/space/device-management/devices/131098"
                    },
                    {
                        "@href":"/api/space/device-management/devices/950279"
                    },
                    {
                        "@href":"/api/space/device-management/devices/262220"
                    }
                ]
            }
        }
    }

    Sample Output

    Sample XML Output

    <servicenowmsg>
            <deviceStatus>
                    <desc>Devices successfully added</desc>
                    <keys>
                            <key>262256</key>
                    </keys>
            </deviceStatus>
            <exceptions>
                     <exception>
                            <severity>ERROR</severity>
                            <code>SN-1000</code>
                            <desc>Invalid devices</desc>
                            < keys >
                                    <key>100</key>
                             </ keys >
                    </exception>
                    <exception>
                            <severity>WARN</severity>
                            <code>SN-1001</code>
                            <desc> Devices already added/present in Service Now </desc>
                            <keys>
                                     <key>262220</key>
                            </keys>
                     </exception>
            </exceptions>
    </servicenowmsg>
    

    Sample JSON Output

    servicenowmsg:{
            devicestatus:{
                desc:'Device Successfully Added to Service Now',
                keys:{
                    key: 262256
                }
            },
            exceptions:{
                exception:[
                    {
                        severity:'WARN',
                        code:'SN-1001',
                        desc:'Devices already added/present in Service Now ',
                        keys:{
                            key: 262220
                        }
                    },
                    {
                        severity:'ERROR',
                        code:'SN-1000',
                        desc:'Invalid Devices',
                        keys:{
                            key:100
                        }
                    }
                ]
            }
        }
    

    Response Status Code

    Message

    Description

    500 Internal Server Error

    • Service Now is in Demo mode
    • Specified device ID does not exist
    • Error while adding device to Service Now

    Modified: 2016-08-11