Add a single configuration element instance
/rest/{version}/configuration/configElements
Request
-
version:
REST API version string.
Available values: v1.2
-
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
403 Response
404 Response
409 Response
423 Response
Examples
Example of Accessing the API with cURL
The following example shows how to add a single configuration element instance by submitting a POST request on the REST resource using cURL. For more information about cURL, see Use cURL.
curl -X POST \
-d@request.xml \
--header "Accept: application/xml" \
--header "Authorization: Bearer $TOKEN" \
"https://${SBCIP}/rest/v1.1/configuration/configElements"
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 Accessing the API with Python
The following example shows how to add a single configuration element instance by submitting a POST 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
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.1/configuration/configElements"
resp = requests.post(url, headers=headers, data=data)
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>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>