Create a Configuration Element

post

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

Use this (POST) method to create a configuration element object with default values. All configurations that a device supports are modeled as a Type-Of configuration element which has configuration attributes. For example, if a configuration element of the type NetworkInterface is requested, a configuration object is returned with default populated attributes that can be used to configure/add the network-interface element instance. Similarly, when a configuration element of type RealmConfig is requested, it returns a configuration object with default populated attributes that can be used to configure/add the realm-config element instance and so on. This is a convenience method that allows a user to ask the server to construct any type of configuration element that is based on the current model and release that the targeted device is running. The create method returns a configuration element object but does not persist this to the OSDMC database. The user can modify the configuration element, and then use the add API/method to add this object to the targeted device configuration. Refer to the Add an Element Type (POST) API for more information.

Request

Path Parameters
Back to Top

Response

200 Response

Config element for the given element type retrieved successfully, with default values.

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, config, and so on) of your input request cannot be found.

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 create 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/create"

The following example shows how to use Python to create 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/create"
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.

{
  "elementTypePath": "EnumConfig"
}

Example of the Response Body

The following example shows the contents of the response body.

{
  "attributes": [
    {
      "name": "healthQueryInterval",
      "value": "0"
    },
    {
      "name": "timeout",
      "value": "11"
    },
    {
      "name": "queryMethod",
      "value": "hunt"
    },
    {
      "name": "topLevelDomain",
      "value": ""
    },
    {
      "name": "maxResponseSize",
      "value": "512"
    },
    {
      "name": "translationMode",
      "value": "E164"
    },
    {
      "name": "options",
      "value": ""
    },
    {
      "name": "realmId",
      "value": ""
    },
    {
      "name": "lookupLength",
      "value": "0"
    },
    {
      "name": "lastModifiedDate",
      "value": ""
    },
    {
      "name": "dataVersion",
      "value": ""
    },
    {
      "name": "lastModifiedBy",
      "value": ""
    },
    {
      "name": "prependPrefix",
      "value": ""
    },
    {
      "name": "name",
      "value": ""
    },
    {
      "name": "healthQueryNumber",
      "value": ""
    },
    {
      "name": "numberDigits",
      "value": "0"
    }
  ],
  "elementTypePath": "EnumConfig"
}    

Example 2 of Accessing this API

This example shows creating tos-setting sub-element of media-policy with default values.

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/create"

The following shows an example of the request body.

{
  "elementTypePath": "mediaPolicy/tosSetting"
}

The following shows an example response.

{
  "attributes": [
    {
      "name": "mediaType",
      "value": ""
    },
    {
      "name": "tosValue",
      "value": "0x00"
    },
    {
      "name": "mediaSubType",
      "value": ""
    }
  ],
  "elementTypePath": "mediaPolicy/tosSetting"
}
Back to Top