summaryrefslogtreecommitdiff
path: root/rest-api
diff options
context:
space:
mode:
authorMatt Jordan <mjordan@digium.com>2015-07-08 16:39:35 -0500
committerMatt Jordan <mjordan@digium.com>2015-07-16 20:38:57 -0500
commit254d07b15b6f6a741c1293cf9d26a2a235e795ed (patch)
tree0a1d7d9e98f5bd166fd74f575ea6d46c8ddf2b53 /rest-api
parentaf9ee2910d4f791243fa9c6ef98dd53264acc445 (diff)
ARI: Add support for push configuration of dynamic object
This patch adds support for push configuration of dynamic, i.e., sorcery, objects in Asterisk. It adds three new REST API calls to the 'asterisk' resource: * GET /asterisk/{configClass}/{objectType}/{id}: retrieve the current object given its ID. This returns back a list of ConfigTuples, which define the fields and their present values that make up the object. * PUT /asterisk/{configClass}/{objectType}/{id}: create or update an object. A body may be passed with the request that contains fields to populate in the object. The same format as what is retrieved using the GET operation is used for the body, save that we specify that the list of fields to update are contained in the "fields" attribute. * DELETE /asterisk/{configClass}/{objectType}/{id}: remove a dynamic object from its backing storage. Note that the success/failure of these operations is somewhat configuration dependent, i.e., you must be using a sorcery wizard that supports the operation in question. If a sorcery wizard does not support the create or delete mechanisms, then the REST API call will fail with a 403 forbidden. ASTERISK-25238 #close Change-Id: I28cd5c7bf6f67f8e9e437ff097f8fd171d30ff5c
Diffstat (limited to 'rest-api')
-rw-r--r--rest-api/api-docs/asterisk.json156
1 files changed, 156 insertions, 0 deletions
diff --git a/rest-api/api-docs/asterisk.json b/rest-api/api-docs/asterisk.json
index c6968a5ba..2705f45f6 100644
--- a/rest-api/api-docs/asterisk.json
+++ b/rest-api/api-docs/asterisk.json
@@ -8,6 +8,146 @@
"resourcePath": "/api-docs/asterisk.{format}",
"apis": [
{
+ "path": "/asterisk/config/dynamic/{configClass}/{objectType}/{id}",
+ "description": "Asterisk dynamic configuration",
+ "operations": [
+ {
+ "httpMethod": "GET",
+ "summary": "Retrieve a dynamic configuration object.",
+ "nickname": "getObject",
+ "responseClass": "List[ConfigTuple]",
+ "parameters": [
+ {
+ "name": "configClass",
+ "description": "The configuration class containing dynamic configuration objects.",
+ "paramType": "path",
+ "required": true,
+ "allowMultiple": false,
+ "dataType": "string"
+ },
+ {
+ "name": "objectType",
+ "description": "The type of configuration object to retrieve.",
+ "paramType": "path",
+ "required": true,
+ "allowMultiple": false,
+ "dataType": "string"
+ },
+ {
+ "name": "id",
+ "description": "The unique identifier of the object to retrieve.",
+ "paramType": "path",
+ "required": true,
+ "allowMultiple": false,
+ "dataType": "string"
+ }
+ ],
+ "errorResponses": [
+ {
+ "code": 404,
+ "reason": "{configClass|objectType|id} not found"
+ }
+ ]
+ },
+ {
+ "httpMethod": "PUT",
+ "summary": "Create or update a dynamic configuration object.",
+ "nickname": "updateObject",
+ "responseClass": "List[ConfigTuple]",
+ "parameters": [
+ {
+ "name": "configClass",
+ "description": "The configuration class containing dynamic configuration objects.",
+ "paramType": "path",
+ "required": true,
+ "allowMultiple": false,
+ "dataType": "string"
+ },
+ {
+ "name": "objectType",
+ "description": "The type of configuration object to create or update.",
+ "paramType": "path",
+ "required": true,
+ "allowMultiple": false,
+ "dataType": "string"
+ },
+ {
+ "name": "id",
+ "description": "The unique identifier of the object to create or update.",
+ "paramType": "path",
+ "required": true,
+ "allowMultiple": false,
+ "dataType": "string"
+ },
+ {
+ "name": "fields",
+ "description": "The body object should have a value that is a list of ConfigTuples, which provide the fields to update. Ex. [ { \"attribute\": \"directmedia\", \"value\": \"false\" } ]",
+ "paramType": "body",
+ "required": false,
+ "dataType": "containers",
+ "allowMultiple": false
+ }
+ ],
+ "errorResponses": [
+ {
+ "code": 400,
+ "reason": "Bad request body"
+ },
+ {
+ "code": 403,
+ "reason": "Could not create or update object"
+ },
+ {
+ "code": 404,
+ "reason": "{configClass|objectType} not found"
+ }
+ ]
+ },
+ {
+ "httpMethod": "DELETE",
+ "summary": "Delete a dynamic configuration object.",
+ "nickname": "deleteObject",
+ "responseClass": "void",
+ "parameters": [
+ {
+ "name": "configClass",
+ "description": "The configuration class containing dynamic configuration objects.",
+ "paramType": "path",
+ "required": true,
+ "allowMultiple": false,
+ "dataType": "string"
+ },
+ {
+ "name": "objectType",
+ "description": "The type of configuration object to delete.",
+ "paramType": "path",
+ "required": true,
+ "allowMultiple": false,
+ "dataType": "string"
+ },
+ {
+ "name": "id",
+ "description": "The unique identifier of the object to delete.",
+ "paramType": "path",
+ "required": true,
+ "allowMultiple": false,
+ "dataType": "string"
+ }
+ ],
+ "errorResponses": [
+ {
+ "code": 403,
+ "reason": "Could not delete object"
+ },
+ {
+ "code": 404,
+ "reason": "{configClass|objectType|id} not found"
+ }
+ ]
+ }
+ ]
+ },
+ {
"path": "/asterisk/info",
"description": "Asterisk system information (similar to core show settings)",
"operations": [
@@ -403,6 +543,22 @@
"description": "The value of the variable requested"
}
}
+ },
+ "ConfigTuple": {
+ "id": "ConfigTuple",
+ "description": "A key/value pair that makes up part of a configuration object.",
+ "properties": {
+ "attribute": {
+ "required": true,
+ "type": "string",
+ "description": "A configuration object attribute."
+ },
+ "value": {
+ "required": true,
+ "type": "string",
+ "description": "The value for the attribute."
+ }
+ }
}
}
}