Write
This writes a new outbound service with the name as supplied in the URL and a configuration
supplied within the body of the request, with the Content-Type header set to 'application/json'. If the name does not exist
in the list of outbound services, then a new service is created with the supplied configuration. If the name does
exist in the list of outbound services, then the configuration of the existing service is replaced by the supplied configuration.
It is not possible to write an outbound service without providing a configuration
that contains a few mandatory options. At a bare minimum, the configuration needs to contain a service_password and either
a uas.application_name or a rest.first_page.address (Depending on if you have set application_type to 'UAS' (Which it is by default)
or 'REST'). Options that are omitted from the configuration will be set to their default values.
You need to supply your account username and API access key in the basic authorisation string.
URL |
: |
https://ws.aculabcloud.net/service/v1/outbound/<ServiceName> |
Methods |
: |
PUT
|
Username |
: |
cloudID/username (e.g. 1-2-0/bob@example.com) |
Password | : | Your API Access Key |
Returns on success:
A JSON object within the body of either a 201 response (If the service was created) or a 200 response (If the service was replaced).
The JSON object is the newly written outbound service configuration.
Example 1 - Create a new UAS service:
In this example, assume 'MyFirstOutboundService' does not already exist:
(PUT) https://ws-1-2-0.aculabcloud.net/service/v1/outbound/MyFirstOutboundService
With the following JSON in the body of the request:
{
"description" : "This is my outbound UAS service",
"service_password" : "p@$$w0rd",
"uas" : {
"application_name" : "my_uas_app"
}
}
Response:
You will receive a JSON object in the body of a 201 response. The JSON object is the configuration for the newly created 'MyFirstOutboundService'.
The options that were not set in the supplied configuration will be set to their default values:
{
"enabled": true,
"service_password": "p@$$w0rd",
"description": "This is my outbound UAS service",
"extra_channels": 0,
"g729": false,
"call_constraints": {...},
"application_type": "UAS",
"uas": {
"application_name": "my_uas_app",
"application_parameters": null
},
"rest": {...},
"fax": {...}
}
Example 2 - Create a new REST service:
In this example, assume 'MySecondOutboundService' does not already exist:
(PUT) https://ws-1-2-0.aculabcloud.net/service/v1/outbound/MySecondOutboundService
With the following JSON in the body of the request:
{
"service_password" : "p@$$w0rd",
"description" : "This is my outbound REST service",
"application_type" : "REST",
"rest" : {
"first_page" : {
"address" : "http://11.222.33.44:50080/my_first_page"
},
"final_page" : {
"address" : "http://11.222.33.44:50080/my_final_page"
}
}
}
Response:
You will receive a JSON object in the body of a 201 response. The JSON object is the configuration for the newly created 'MySecondOutboundService'.
The service options that were not set in the supplied configuration will be set to their default values:
{
"enabled": true,
"service_password": "p@$$w0rd",
"description": "This is my outbound REST service",
"extra_channels": 0,
"g729": false,
"call_constraints": {...},
"application_type": "REST",
"uas": {...},
"rest": {
"first_page": {
"address": "http://11.222.33.44:50080/my_first_page",
"method": "POST"
},
"final_page": {
"address": "http://11.222.33.44:50080/my_final_page",
"method": "POST"
},
"error_page": {
"address": null,
"method": "POST"
},
"api_version": "2.0",
"application_parameters": null,
"tts_voice": "English UK Female Polly Amy",
"authentication": {...},
"call_recording": {...},
"max_call_duration": 240,
"answer_timeout": 30,
"call_configuration": {...}
},
"fax": {...}
}
Example 3 - Replace the configuration of an existing service:
In this example, assume 'MySecondOutboundService' already exists and configured as shown above (In the response of the previous example):
(PUT) https://ws-1-2-0.aculabcloud.net/service/v1/outbound/MySecondOutboundService
With the following JSON in the body of the request:
{
"service_password" : "p@$$w0rd",
"application_type" : "REST",
"rest" : {
"first_page" : {
"address" : "http://11.222.33.44:50080/my_first_page"
},
"error_page" : {
"address" : "http://11.222.33.44:50080/my_error_page"
}
}
}
Response:
You will receive a JSON object in the body of a 201 response. The JSON object contains the new configuration for the
existing 'MySecondOutboundService'.
The service options that were not set in the supplied configuration will be set to their default values:
{
"enabled": true,
"service_password": "p@$$w0rd",
"description": null,
"extra_channels": 0,
"g729": false,
"call_constraints": {...},
"application_type": "REST",
"uas": {...},
"rest": {
"first_page": {
"address": "http://11.222.33.44:50080/my_first_page",
"method": "POST"
},
"final_page": {
"address": null,
"method": "POST"
},
"error_page": {
"address": "http://11.222.33.44:50080/my_final_page",
"method": "POST"
},
"api_version": "2.0",
"application_parameters": null,
"tts_voice": "English UK Female Polly Amy",
"authentication": {...},
"call_recording": {...},
"max_call_duration": 240,
"answer_timeout": 30,
"call_configuration": {...}
},
"fax": {...}
}
Example 4 - Failure to write a service due to an incomplete configuration:
(PUT) https://ws-1-2-0.aculabcloud.net/service/v1/outbound/MyExampleOutboundService
With the following JSON in the body of the request:
{
"description" : "This is my outbound REST service",
"application_type" : "REST"
}
Response:
{
"error": {
"code": "HTTP 400",
"text": "Failed to validate configuration, see details for more information.",
"details": [
"service_password None is not of type 'string'. For REST, you must provide a first_page, a service_password and you can not enable fax receive.",
"rest.first_page.address None is not of type 'string'. For REST, you must provide a first_page, a service_password and you can not enable fax receive."
],
"datetime": "2022-07-22_16:28:25",
"link": "https://www.aculab.com/cloud/web-services/services/outbound/management?target=service_action_tabs&tab-id=write"
},
"request": {
"url": "/service/v1/outbound/MyExampleOutboundService",
"datetime": "2022-07-22_16:28:24"
}
}