- REST API for <ProductName>REST API for Enterprise Communications Broker, Release 4.1.0
- Examples
- Create A Session Group
Create A Session Group
Complete these tasks to create the session-group configuration element.
Table - Prerequisites
Prerequisite | More Information |
Authenticate | Authenticate |
This example assumes you have exported the access token to the variable $TOKEN
.
- Retrieve the session-group template.
The template of a configuration element is a data structure containing all required sub-elements and supported attributes with their default values, along with any specified optional sub-elements.
curl -X GET -o response.xml \ --header "Accept: application/xml" \ --header "Authorization: Bearer $TOKEN" \ "https://10.0.0.2/rest/v1.1/configuration/elementTypes/template?elementType=session-group"
The response is saved to the fileresponse.xml
. - Copy the content between the opening and closing <configElement> tags to a new file called
session-group.xml
.If you are on a Linux system with
xmllint
installed, you may optionally format the XML before writing it to the file system.sed -n '/<configElement>/,/<\/configElement>/p' response.xml | xmllint --format - > session-group.xml
- If a non-default attribute is desired, set the attribute to its desired value. If using the default settings, do not modify
session-group.xml
.The following shows an example of the contents of
session-group.xml
:<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <configElement> <elementType>session-group</elementType> <attribute> <name>group-name</name> <value>group3</value> </attribute> <attribute> <name>description</name> <value>new group 3</value> </attribute> <attribute> <name>state</name> <value>enabled</value> </attribute> <attribute> <name>app-protocol</name> <value>SIP</value> </attribute> <attribute> <name>strategy</name> <value>Hunt</value> </attribute> <attribute> <name>dest</name> <value/> </attribute> <attribute> <name>trunk-group</name> <value/> </attribute> <attribute> <name>sag-recursion</name> <value>disabled</value> </attribute> <attribute> <name>stop-sag-recurse</name> <value>401,407</value> </attribute> <attribute> <name>sip-recursion-policy</name> <value/> </attribute> <attribute> <name>last-modified-by</name> <value>REST-admin@10.0.0.6</value> </attribute> <attribute> <name>last-modified-date</name> <value>2019-07-08 21:15:10</value> </attribute> </configElement>
- Acquire the configuration lock.
curl -X POST \ --header "Accept: application/xml" \ --header "Authorization: Bearer $TOKEN" \ "https://10.0.0.2/rest/v1.1/configuration/lock"
- Add the session-group configuration element to the ECB.
curl -X POST \ -d@session-group.xml \ --header "Accept: application/xml" \ --header "Authorization: Bearer $TOKEN" \ "https://10.0.0.2/rest/v1.1/configuration/configElements"
- If done editing the configuration, save, verify, and activate the configuration.
- Release the configuration lock.
curl -X POST \ --header "Accept: application/xml" \ --header "Authorization: Bearer $TOKEN" \ "https://10.0.0.2/rest/v1.1/configuration/unlock"