Get a template instance for a configuration element or sub-element type
/rest/{version}/configuration/elementTypes/template
There are three ways to request a template:
- Top-level element and mandatory sub-elements only: if the query string only includes the elementType parameter, and the elementType value specifies a top-level configuration element, then the returned template includes all of that top-level element type's attributes plus any mandatory sub-elements - but no optional sub-elements.
- Optional sub-element only: if the query string only includes the elementType parameter, and the elementType value is a path to a sub-element (for example,
sip-manipulation/header-rules
- a forward slash-delimited list of the top-level element type and sub-element type(s)), then the returned template includes only the requested sub-element, plus any of its own sub-elements which are mandatory. - Full template structure: if the query string includes the elementType parameter, whose value is a top-level element type, plus one or more instances of the subElement parameter, then the returned template includes all of the top-level element type's attributes, any mandatory sub-elements, and each optional sub-element named in a subElement parameter.
Request
-
version:
REST API version string.
Available values: v1.2
-
elementType:
Specifies the configuration element type for which a template instance is requested. When requesting templates for top-level configuration element types (with or without optional sub-elements), the value for this query parameter is just the top-level configuration element type identifier (e.g., "phy-interface"). For optional sub-elements, the value is the hierarchical path to the desired sub-element, beginning with the top-level element itself (e.g., "network-interface/bfd-config/bfd-session").
-
subElement(optional):
When requesting the full template structure for a top-level element type that has optional sub-elements, there should be one subElement parameter for each optional sub-element the client wants included in the returned template. The value for each subElement parameter is the hierarchical path to the desired sub-element, _not_ including the top-level element itself, which is named in the elementType parameter (e.g., "bfd-config/bfd-session", under network-interface). The subElement parameter is included only when requesting a template for a top-level element plus one or more of its optional sub-elements.
-
Authorization:
The value in the Authorization header must be the string "
Bearer {access token}
", where{access token}
is a valid, unexpired token received in response to a prior/rest/{version}/auth/token
request.
Response
200 Response
400 Response
401 Response
404 Response
Examples
Example of Accessing the API with cURL
The following example shows how to get a template instance for a configuration element or sub-element type by submitting a GET request on the REST resource using cURL. For more information about cURL, see Use cURL.
curl -X GET \
--header "Accept: application/xml" \
--header "Authorization: Bearer $TOKEN" \
"https://${SBCIP}/rest/v1.1/configuration/elementTypes/template?elementType=access-control"
Example of Accessing the API with Python
The following example shows how to get a template instance for a configuration element or sub-element type by submitting a GET request on the REST resource using Python. This example assumes you have a valid token stored in the token
variable. For an example of authenticating with Python, see Authenticate.
import requests
headers = { "Accept":"application/xml", "Authorization":"Bearer " + token }
url = "https://" + sbcip + "/rest/v1.1/configuration/elementTypes/template?elementType=access-control"
resp = requests.get(url, headers=headers)
Example of the Response Body
The following example shows the contents of the response body in XML format.
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<response>
<data>
<configElement>
<elementType>access-control</elementType>
<attribute>
<name>realm-id</name>
<value/>
</attribute>
<attribute>
<name>description</name>
<value/>
</attribute>
<attribute>
<name>source-address</name>
<value>0.0.0.0</value>
</attribute>
...
<attribute>
<name>untrust-cac-failure-threshold</name>
<value>0</value>
</attribute>
</configElement>
</data>
<messages/>
<links/>
</response>