Get a template instance for a configuration element or sub-element type
get
/rest/{version}/configuration/elementTypes/template
Retrieves a template instance of the specified configuration element or sub-element type. The template instance is a data structure containing all of the supported attributes, mandatory sub-elements, and any specified optional sub-elements for the requested element or sub-element, with default values for each attribute. Clients can request a template as a starting point for creating the data structure needed for a /configuration/configElements POST request body.
There are three ways to request a 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_ (e.g., \"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
Path Parameters
-
version: string
For this release, the value is "v1.0".
Query Parameters
-
elementType: string
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 identifer (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): string
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.
Header Parameters
-
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 /auth/token request.
There's no request body for this operation.
Back to TopResponse
Supported Media Types
- application/xml
200 Response
The template instance for the requested configuration element type is returned in the data section of the response.
Nested Schema : links
Type:
object
Nested Schema : messages
Type:
object
400 Response
The request is malformed or missing required information.
Nested Schema : data
Type:
object
Nested Schema : links
Type:
object
401 Response
The client is not authorized.
Nested Schema : data
Type:
object
Nested Schema : links
Type:
object
404 Response
Unsupported versionId in URI, or requested element type not supported
Nested Schema : data
Type:
object
Nested Schema : links
Type:
object
Examples
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://10.0.0.2/rest/v1.0/configuration/elementTypes/template?elementType=ntp-config'
Example of the Response Headers
The following shows an example of the response headers.
HTTP/1.1 200 OK Date: Wed, 08 Aug 2018 12:39:05 GMT Cache-Control: no-cache Content-Length: 265 Content-Type: application/xml Connection: keep-alive Keep-Alive: timeout=60, max=99 Last-Modified: Wed, 08 Aug 2018 12:39:05 GMT X-Appweb-Seq: 154
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>ntp-config</elementType> <attribute> <name>server</name> <value/> </attribute> </configElement> </data> <messages/> <links/> </response>