Site specific settings

The Settings section described how to manage common settings for a configuration and how individual settings are marked as site-specific by setting the @scope property to mixed or matched

In the example below, we see that there are 3 settings marked as site-specific settings.

  • /system/1/contact - A required setting that must be present in the device’s site-specific settings
  • /system/1/location - An optional setting that can be present in the device’s site-specific settings. If not present the value Rochester, MN is used.
  • /system/1/description - An optional setting that can be present in the device’s site-specific settings. If not present the value used is empty
{
    "id": 6415,
    "customer_id": 57639,
    "system": {
      "#entries": [
        {
          "name": {
            "@managed": true,
            "@scope": "common",
            "#value": "TX64"
          },
          "contact": {
            "@managed": true,
            "@scope": "matched"
          },
          "location": {
            "@managed": true,
            "@scope": "mixed",
            "#value": "Rochester, MN"
          },
          "description": {
            "@managed": true,
            "@scope": "mixed"
          },
          "banner": {
            "@managed": false,
            "@scope": "common",
            "#value": "Welcome to the TX64"
          },
...etc...

GET Site-specific settings

Retrieve site-specific settings for a device in one of two formats.

In the following example there are 2 devices that have site-specific settings specified.

The first device is identified by device_id 00000000-00000000-0040FFFF-FF8001B0 and sets the contact and description settings to Fred and Store Router respectively. Only that device receives those settings, the location setting is unset and therefore the common value of Rochester, MN is used.

The second device is identified by the device name. When the configuration scan encounters a device named Bus23, the contact, description, and location settings are set to Bob, Home Router, and Hopkins, MN respectively.

JSON Format

Retrieve site-specific settings for all devices that have site-specific settings in either JSON format using the GET method of the /ws/v1/configs/inventory/6415/settings/device API.

{
    "count": 2,
    "list": [
        {
            "customer_id": 57639,
            "id": 6415,
            "key_type": "device_id",
            "key_value": "00000000-00000000-0040FFFF-FF8001B0",
            "settings": {
                "system/1/contact": "Fred",
                "system/1/description": "Store Router"
            }
        },
        {
            "customer_id": 57639,
            "id": 6415,
            "key_type": "device_name",
            "key_value": "Bus23",
            "settings": {
                "system/1/contact": "Bob",
                "system/1/description": "Home Router",
                "system/1/location": "Hopkins, MN"
            }
        }
    ],
    "size": 1000
}

CSV Format

Retrieve site-specific settings for all devices that have site-specific settings in either CSV format using the /ws/v1/configs/inventory/6415/settings/device/bulk API.

key_type,key_value,system/1/contact,system/1/description,system/1/location
device_id,"00000000-00000000-0040FFFF-FF8001B0",Fred,"Store Router",
device_name,Bus23,Bob,"Home Router","Hopkins, MN"

GET Site-specific settings for a specific device

Retrieve site-specific settings for a specific device using the GET method and specifying either the device_name or the device_id parameter. If there are no site-specific settings currently set for the device, the result is an HTTP 404 error.

For example the result of the GET method of the /ws/v1/configs/inventory/6415/settings/device?device_id=00000000-00000000-0040FFFF-FF8001B0 API results in the following json.

{
    "customer_id": 57639,
    "id": 6415,
    "key_type": "device_id",
    "key_value": "00000000-00000000-0040FFFF-FF8001B0",
    "settings": {
        "system/1/contact": "Fred",
        "system/1/description": "Store Router"
    }
}

The result of the GET method of the /ws/v1/configs/inventory/6415/settings/device?device_name=Bus23 API results in the following json.

{
    "customer_id": 57639,
    "id": 6415,
    "key_type": "device_name",
    "key_value": "Bus23",
    "settings": {
        "system/1/contact": "Bob",
        "system/1/description": "Home Router",
        "system/1/location": "Hopkins, MN"
    }
}

Put site-specific settings

To update site specific settings for all devices, POST a multipart/form payload with a CSV file to the /ws/v1/configs/inventory/6415/settings/device/bulk API.

This payload replaced all existing site-specific settings for all devices with the settings for those devices specified in the CSV file. Devices that are not in the new settings file have their site-specific settings removed.

key_type,key_value,system/1/contact,system/1/description,system/1/location
device_id,"00000000-00000000-0040FFFF-FF8001B0",Fred,"Store Router",
device_name,Bus23,Bob,"Home Router","Hopkins, MN"
device_name,Bus42,Bill,"Shop Router","Byron, MN"
device_name,Bus99,Chris,"Store Router","Lewiston, MN"

Put site-specific settings for a specific device

To update site specific settings for a specific device, PUT a json payload to the /ws/v1/configs/inventory/6415/settings/device API using a device_id or device_name parameter.

This payload replaces all existing site-specific settings for the specified device with the settings specified in the payload. For example, POST the following payload to /ws/v1/configs/inventory/6415/settings/device?device_name=Bus99 will replace all site-specific settings for the Bus99 device.

{
    "settings": {
        "system/1/contact": "Chris",
        "system/1/description": "Store Router",
        "system/1/location": "Lewiston, MN"
    }
}

Delete site-specific settings for a specific device

To delete site specific settings for a specific device, DELETE to the /ws/v1/configs/inventory/6415/settings/device API using a device_id or device_name parameter.

For example, DELETE to /ws/v1/configs/inventory/6415/settings/device?device_name=Bus99 will delete all site-specific settings for the Bus99 device.