Add a single configuration element instance
post
https://{managementIp}/rest/{version}/configuration/configElements
Adds a single instance of the specified configuration element type to the system configuration. The client making the POST request must already possess the configuration lock or the request fails. If the configuration element type is a singleton - meaning only one instance can exist in the system configuration - the instance must first be created using POST, supplying only the element type in the POST request. The instance can then be edited via a subsequent PUT request. For any element type that supports multiple instances, the key attribute(s) sent in the POST request must not duplicate the key attribute(s) for any already-configured instance. The client can supply as many non-key attributes and sub-elements in the POST request for an element type that supports multiple instances. If the client attempts to create a singleton element type that has already been created, or if the key attributes duplicate an existing instance, 409 Conflict is returned. If one or more attributes/sub-elements in the request is syntactically invalid in any way, the POST request fails and the system configuration is left unmodified.
Request
Path Parameters
-
version(required): string
REST API version string.
Available values: v1.2Allowed Values:[ "v1.2" ]
Header Parameters
-
Authorization(required):
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.
Supported Media Types
- application/xml
Nested Schema : items
Type:
object
Response
Supported Media Types
- application/xml
200 Response
Successful creation of the requested instance. The complete configuration data (all supported attributes and sub-elements) are returned in the response body.
Nested Schema : links
Type:
object
Nested Schema : messages
Type:
object
Nested Schema : items
Type:
object
400 Response
One or more attribute/sub-element values supplied by the client is not syntactically valid, or the request is malformed and cannot be processed.
Nested Schema : data
Type:
object
Nested Schema : items
Type:
Show Source
object
-
link: string
If available, a message with possible valid API URL(s) for the client to invokeExample:
Available URL(s) message string
401 Response
Unauthorized - Request lacks valid authentication credentials.
Nested Schema : data
Type:
object
Nested Schema : items
Type:
Show Source
object
-
link: string
If available, a message with possible valid API URL(s) for the client to invokeExample:
Available URL(s) message string
403 Response
This request requires the client credentials to have administrator privileges.
Nested Schema : data
Type:
object
Nested Schema : items
Type:
Show Source
object
-
link: string
If available, a message with possible valid API URL(s) for the client to invokeExample:
Available URL(s) message string
404 Response
Unsupported versionId in URI, or requested element type not supported.
Nested Schema : data
Type:
object
Nested Schema : items
Type:
Show Source
object
-
link: string
If available, a message with possible valid API URL(s) for the client to invokeExample:
Available URL(s) message string
409 Response
Attempt to create an existing singleton element type, or the supplied key attribute values already exist for a configured element instance.
Nested Schema : data
Type:
object
Nested Schema : items
Type:
Show Source
object
-
link: string
If available, a message with possible valid API URL(s) for the client to invokeExample:
Available URL(s) message string
423 Response
The request requires the configuration lock and failed because the client does not currently own the lock. If another client or user currently owns the configuration lock, the error message is "Resource locked by another user". If no client or user owns the configuration lock, the error message is "User does not have the lock".
Nested Schema : data
Type:
object
Nested Schema : items
Type:
Show Source
object
-
link: string
If available, a message with possible valid API URL(s) for the client to invokeExample:
Available URL(s) message string
Examples
Examples of Accessing the API
See Authenticate for how to acquire a token.
The following example shows how to add a single configuration element instance using curl.
curl -X POST \
-d@request.xml \
--header "Accept: application/xml" \
--header "Authorization: Bearer $TOKEN" \
"https://${SBCIP}/rest/v1.2/configuration/configElements"
The following example shows how to add a single configuration element instance using Python.
import requests
from lxml import etree
headers = { "Accept":"application/xml", "Authorization":"Bearer " + token }
data = etree.tostring(etree.parse("request.xml"), xml_declaration=True, encoding='utf-8')
url = "https://" + sbcip + "/rest/v1.2/configuration/configElements"
resp = requests.post(url, headers=headers, data=data)
The following shows an example of the contents of the request.xml
file sent as the request body.
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<configElement>
<elementType>access-control</elementType>
<attribute>
<name>realm-id</name>
<value>core</value>
</attribute>
<attribute>
<name>source-address</name>
<value>10.4.4.0/24</value>
</attribute>
<attribute>
<name>application-protocol</name>
<value>SIP</value>
</attribute>
<attribute>
<name>transport-protocol</name>
<value>TCP</value>
</attribute>
<attribute>
<name>access</name>
<value>permit</value>
</attribute>
</configElement>
Example of the Response Body
The following example shows the contents of the response body in XML.
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<response>
<data>
<configElement>
<elementType>access-control</elementType>
<attribute>
<name>realm-id</name>
<value>core</value>
</attribute>
<attribute>
<name>description</name>
<value/>
</attribute>
<attribute>
<name>source-address</name>
<value>10.4.4.0/24</value>
</attribute>
<attribute>
<name>destination-address</name>
<value>0.0.0.0</value>
</attribute>
<attribute>
<name>application-protocol</name>
<value>SIP</value>
</attribute>
<attribute>
<name>transport-protocol</name>
<value>TCP</value>
</attribute>
<attribute>
<name>access</name>
<value>permit</value>
</attribute>
<attribute>
<name>average-rate-limit</name>
<value>0</value>
</attribute>
...
<attribute>
<name>last-modified-date</name>
<value>2019-01-14 13:14:05</value>
</attribute>
</configElement>
</data>
<messages/>
<links/>
</response>