summaryrefslogtreecommitdiff
path: root/rest-api
diff options
context:
space:
mode:
authorJonathan Rose <jrose@digium.com>2014-01-14 23:44:57 +0000
committerJonathan Rose <jrose@digium.com>2014-01-14 23:44:57 +0000
commitaa9db707c56fa673560e25663f581954a66f3974 (patch)
treea539c9a84ad0679612606f15728bd5049ff2e441 /rest-api
parented0d083596bd22bf772433ac949f243dfc5fb28c (diff)
ARI: Add mailboxes resource for controlling and polling external MWI
Adds the following AMI commands: PUT mailboxes/mailboxName modifies mailbox state and implicitly creates new mailboxes GET mailboxes/mailboxName retrieves a JSON representation of a single mailbox if it exists GET mailboxes retrieves a JSON array of all mailboxes DELETE mailbox/mailboxName deletes a mailbox Note that res_mwi_external must be loaded for these functions to actually do anything. Review: https://reviewboard.asterisk.org/r/3117/ ........ Merged revisions 405553 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@405554 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'rest-api')
-rw-r--r--rest-api/api-docs/mailboxes.json134
-rw-r--r--rest-api/resources.json4
2 files changed, 138 insertions, 0 deletions
diff --git a/rest-api/api-docs/mailboxes.json b/rest-api/api-docs/mailboxes.json
new file mode 100644
index 000000000..40c83b0a9
--- /dev/null
+++ b/rest-api/api-docs/mailboxes.json
@@ -0,0 +1,134 @@
+{
+ "_copyright": "Copyright (C) 2013, Digium, Inc.",
+ "_author": "Jonathan Rose <jrose@digium.com>",
+ "_svn_revision": "$Revision$",
+ "apiVersion": "1.0.0",
+ "swaggerVersion": "1.1",
+ "basePath": "http://localhost:8088/stasis",
+ "resourcePath": "/api-docs/mailboxes.{format}",
+ "apis": [
+ {
+ "path": "/mailboxes",
+ "description": "Mailboxes",
+ "operations": [
+ {
+ "httpMethod": "GET",
+ "summary": "List all mailboxes.",
+ "nickname": "list",
+ "responseClass": "List[Mailbox]"
+ }
+ ]
+ },
+ {
+ "path": "/mailboxes/{mailboxName}",
+ "description": "Mailbox state",
+ "operations": [
+ {
+ "httpMethod": "GET",
+ "summary": "Retrieve the current state of a mailbox.",
+ "nickname": "get",
+ "responseClass": "Mailbox",
+ "parameters": [
+ {
+ "name": "mailboxName",
+ "description": "Name of the mailbox",
+ "paramType": "path",
+ "required": true,
+ "allowMultiple": false,
+ "dataType": "string"
+ }
+ ],
+ "errorResponses": [
+ {
+ "code": 404,
+ "reason": "Mailbox not found"
+ }
+ ]
+ },
+ {
+ "httpMethod": "PUT",
+ "summary": "Change the state of a mailbox. (Note - implicitly creates the mailbox).",
+ "nickname": "update",
+ "responseClass": "void",
+ "parameters": [
+ {
+ "name": "mailboxName",
+ "description": "Name of the mailbox",
+ "paramType": "path",
+ "required": true,
+ "allowMultiple": false,
+ "dataType": "string"
+ },
+ {
+ "name": "oldMessages",
+ "description": "Count of old messages in the mailbox",
+ "paramType": "query",
+ "required": true,
+ "allowMultiple": false,
+ "dataType": "int"
+ },
+ {
+ "name": "newMessages",
+ "description": "Count of new messages in the mailbox",
+ "paramType": "query",
+ "required": true,
+ "allowMultiple": false,
+ "dataType": "int"
+ }
+ ],
+ "errorResponses": [
+ {
+ "code": 404,
+ "reason": "Mailbox not found"
+ }
+ ]
+ },
+ {
+ "httpMethod": "DELETE",
+ "summary": "Destroy a mailbox.",
+ "nickname": "delete",
+ "responseClass": "void",
+ "parameters": [
+ {
+ "name": "mailboxName",
+ "description": "Name of the mailbox",
+ "paramType": "path",
+ "required": true,
+ "allowMultiple": false,
+ "dataType": "string"
+ }
+ ],
+ "errorResponses": [
+ {
+ "code": 404,
+ "reason": "Mailbox not found"
+ }
+ ]
+ }
+ ]
+ }
+ ],
+ "models": {
+ "Mailbox": {
+ "id": "Mailbox",
+ "description": "Represents the state of a mailbox.",
+ "properties": {
+ "name": {
+ "type": "string",
+ "description": "Name of the mailbox.",
+ "required": true
+ },
+ "old_messages": {
+ "type": "int",
+ "description": "Count of old messages in the mailbox.",
+ "required": true
+ },
+ "new_messages": {
+ "type": "int",
+ "description": "Count of new messages in the mailbox.",
+ "required": true
+ }
+ }
+ }
+ }
+}
diff --git a/rest-api/resources.json b/rest-api/resources.json
index c753ec018..3b197c369 100644
--- a/rest-api/resources.json
+++ b/rest-api/resources.json
@@ -39,6 +39,10 @@
"description": "Device state resources"
},
{
+ "path": "/api-docs/mailboxes.{format}",
+ "description": "Mailboxes resources"
+ },
+ {
"path": "/api-docs/events.{format}",
"description": "WebSocket resource"
},