Delete a Configuration Element

post

/rest/{versionId}/configuration/device-configs/{deviceId}/config-elements/delete

Use this (POST) method to delete the complete targeted configuration element instance. If the configuration element instance has sub-element children, they are also deleted from the targeted device configuration. This deletion is only done on the SDMC database and is not pushed to the device. The deletion is not applied to the device until an action method is initiated. Refer to the Perform a Device Action (POST) method for more information.

Request

Path Parameters
Back to Top

Response

204 Response

Successfully processed the request with no content.

400 Response

The user input is invalid.

401 Response

The user is unauthorized.

403 Response

The user doesn't have the required permission

404 Response

The object (resource URI, device, and so on) of your input request cannot be found.

409 Response

Target configuration element must have one instance

500 Response

An internal server error has occurred while processing the request.
Back to Top

Examples

Examples of Accessing the API

See Authenticate page to acquire a token.

The following example shows how to use curl to delete a configuration element.

curl -X POST \
    -d @request.json \
    -H @auth_header.txt \
    "https://<tenant-url>/<tenant-name>/osdmc/ums/rest/<versionId>/configuration/device-configs/<deviceId>/config-elements/delete"

The following example shows how to use Python to delete a configuration element.

import requests
import json
headers = {
	"Accept": "application/json",
	"Authorization": "Bearer <auth-token>"
}
with open("request.json") as f: data = json.load(f)
url  = "https://<tenant-url>/<tenant-name>/osdmc/ums/rest/<versionId>/configuration/device-configs/<deviceId>/config-elements/delete"
resp = requests.post(url, headers=headers, data=data)

Note:

Use the Get a List of Devices Associated with Config Manager API to find the deviceId parameter.

Example of the Request Body

The following shows an example of the contents of the request file sent as the request body.

{
  "attributes": [
    {
      "name": "parent",
      "value": "corporate"
    },
    {
      "name": "name",
      "value": "TestDialingContext"
    }
  ],
  "elementTypePath": "dialingContext"
}

Example of the Response Body

This endpoint does not return a response body.

Example 2 of Accessing this API

This example shows deleting the security-config element.

curl -X POST \
    -d @request.json \
    -H @auth_header.txt \
    "https://<tenant-url>/<tenant-name>/osdmc/ums/rest/<versionId>/configuration/device-configs/<deviceId>/config-elements/delete"

The following shows an example of the request body.

{
  "elementTypePath": "securityConfig"
}

The following shows an example response.

Example 3 of Accessing this API

This example shows deleting the realm-config element whose id attribute is "realmTest".

curl -X POST \
    -d @request.json \
    -H @auth_header.txt \
    "https://<tenant-url>/<tenant-name>/osdmc/ums/rest/<versionId>/configuration/device-configs/<deviceId>/config-elements/delete"

The following shows an example of the request body.

{
  "elementTypePath": "realmConfig",
  "attributes": [
    {
      "name": "id",
      "value": "realmTest"
    }
  ]
}

The following shows an example response.

Example 4 of Accessing this API

This example shows deleting a network-interface element.

curl -X POST \
    -d @request.json \
    -H @auth_header.txt \
    "https://<tenant-url>/<tenant-name>/osdmc/ums/rest/<versionId>/configuration/device-configs/<deviceId>/config-elements/delete"

The following shows an example of the request body.

{
  "attributes": [
    {
      "name": "name",
      "value": "testNm"
    },
    {
      "name": "ipAddress",
      "value": "192.0.2.10"
    },
    {
      "name": "secondUtilityAddress",
      "value": "192.0.2.10"
    },
    {
      "name": "utilityAddress",
      "value": "192.0.2.10"
    },
    {
      "name": "subPortId",
      "value": 0
    },
    {
      "name": "family",
      "value": "4"
    }
  ],
  "elementTypePath": "networkInterface"
}        

The following shows an example response.

Example 5 of Accessing this API

This example shows deleting a local-policy configuration element.

curl -X POST \
    -d @request.json \
    -H @auth_header.txt \
    "https://<tenant-url>/<tenant-name>/osdmc/ums/rest/<versionId>/configuration/device-configs/<deviceId>/config-elements/delete"

The following shows an example of the request body.

{
  "elementTypePath": "localPolicy",
  "childrenElements": [
    {
      "elementTypePath": "localPolicy/sourceRealm",
      "attributes": [
        {
          "name": "name",
          "value": "realmConfig4"
        }
      ]
    },
    {
      "elementTypePath": "localPolicy/from",
      "attributes": [
        {
          "name": "addr",
          "value": "192.0.2.10"
        }
      ]
    },
    {
      "elementTypePath": "localPolicy/to",
      "attributes": [
        {
          "name": "addr",
          "value": "192.0.2.10"
        }
      ]
    }
  ]
}        

The following shows an example response.

Example 6 of Accessing this API

This example shows deleting the codec-policy/order-codecs sub-element from a codec-policy parent element.

curl -X POST \
    -d @request.json \
    -H @auth_header.txt \
    "https://<tenant-url>/<tenant-name>/osdmc/ums/rest/<versionId>/configuration/device-configs/<deviceId>/config-elements/delete"

The following shows an example of the request body.

{
  "parentElement": {
    "elementTypePath": "codecPolicy",
    "attributes": [
      {
        "name": "name",
        "value": "test"
      }
    ]
  },
  "elementTypePath": "codecPolicy/order",
  "attributes": [
    {
      "name": "name",
      "value": "PCMU"
    }
  ]
}

The following shows an example response.

Example 7 of Accessing this API

This example shows deleting a media-attributes element inside tos-setting inside media-policy element.

curl -X POST \
    -d @request.json \
    -H @auth_header.txt \
    "https://<tenant-url>/<tenant-name>/osdmc/ums/rest/<versionId>/configuration/device-configs/<deviceId>/config-elements/delete"

The following shows an example of the request body.

{
  "parentElement": {
    "elementTypePath": "mediaPolicy",
    "attributes": [
      {
        "name": "name",
        "value": "testMePolicy"
      }
    ],
    "childrenElements": [
      {
        "elementTypePath": "mediaPolicy/tosSetting",
        "attributes": [
          {
            "name": "mediaType",
            "value": "testSetting"
          },
          {
            "name": "mediaSubType",
            "value": "testSubTesting"
          }
        ]
      }
    ]
  },
  "elementTypePath": "mediaPolicy/tosSetting/mediaAttribute",
  "attributes": [
    {
      "name": "value",
      "value": "testMediaAttr2"
    }
  ]
}

The following shows an example response.

Back to Top