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 Devices to an Address Group

    Use this API to associate one or more devices to an address group.

    URI

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

    URI Parameters

    Parameter

    Type

    Required

    Description

    id

    Integer

    Yes

    ID of the address group

    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 associated with the address group

    href

    String

    Link to the address group

    addressType

    String

    Type of address

    Possible values:

    • 0—Address is a location address
    • 1—Address is a ship-to address
    • 2—Address applies to both the location and ship-to addresses

    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 associate devices to 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:

    • ERROR
    • WARN

    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 SML 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>2</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",
                    "addressType": "2"
                }
            ]
        }
    }
    

    Sample Output

    Sample XML Output

    <servicenowmsg>
      <status>
        <desc>Devices successfully associated with address group</desc>
        <keys>
          <key>1671168</key>
          <key>1671181</key>
          <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>
      </exceptions>
    </servicenowmsg>
    

    Sample JSON Output

    {
      "servicenowmsg": {
        "status": {
          "desc": "Devices successfully associated with address group",
          "keys": {
            "key": [
              1671168,
              1671181,
              1671197
            ]
          }
        },
        "exceptions": {
          "exception": [
            {
              "severity": "ERROR",
              "code": "SN-1000",
              "desc": "Invalid Devices",
              "keys": {
                "key": 1234
              }
            },
            {
              "severity": "ERROR",
              "code": "SN-1007",
              "desc": "Address Type is not valid",
              "keys": {
                "key": 1671208
              }
            }
          ]
        }
      }
    }
    

    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.

    Modified: 2017-07-19