{
	"_copyright": "Copyright (C) 2013, Digium, Inc.",
	"_author": "David M. Lee, II <dlee@digium.com>",
	"_svn_revision": "$Revision$",
	"apiVersion": "2.0.0",
	"swaggerVersion": "1.1",
	"basePath": "http://localhost:8088/ari",
	"resourcePath": "/api-docs/applications.{format}",
	"since": [
		"13.0.0"
	],
	"apis": [
		{
			"path": "/applications",
			"description": "Stasis applications",
			"operations": [
				{
					"httpMethod": "GET",
					"since": [
						"13.0.0"
					],
					"summary": "List all applications.",
					"nickname": "list",
					"responseClass": "List[Application]"
				}
			]
		},
		{
			"path": "/applications/{applicationName}",
			"description": "Stasis application",
			"operations": [
				{
					"httpMethod": "GET",
					"since": [
						"13.0.0"
					],
					"summary": "Get details of an application.",
					"nickname": "get",
					"responseClass": "Application",
					"parameters": [
						{
							"name": "applicationName",
							"description": "Application's name",
							"paramType": "path",
							"required": true,
							"allowMultiple": false,
							"dataType": "string"
						}
					],
					"errorResponses": [
						{
							"code": 404,
							"reason": "Application does not exist."
						}
					]
				}
			]
		},
		{
			"path": "/applications/{applicationName}/subscription",
			"description": "Stasis application",
			"operations": [
				{
					"httpMethod": "POST",
					"since": [
						"13.0.0"
					],
					"summary": "Subscribe an application to a event source.",
					"notes": "Returns the state of the application after the subscriptions have changed",
					"nickname": "subscribe",
					"responseClass": "Application",
					"parameters": [
						{
							"name": "applicationName",
							"description": "Application's name",
							"paramType": "path",
							"required": true,
							"allowMultiple": false,
							"dataType": "string"
						},
						{
							"name": "eventSource",
							"description": "URI for event source (channel:{channelId}, bridge:{bridgeId}, endpoint:{tech}[/{resource}], deviceState:{deviceName}",
							"paramType": "query",
							"required": true,
							"allowMultiple": true,
							"dataType": "string"
						}
					],
					"errorResponses": [
						{
							"code": 400,
							"reason": "Missing parameter."
						},
						{
							"code": 404,
							"reason": "Application does not exist."
						},
						{
							"code": 422,
							"reason": "Event source does not exist."
						}
					]
				},
				{
					"httpMethod": "DELETE",
					"since": [
						"13.0.0"
					],
					"summary": "Unsubscribe an application from an event source.",
					"notes": "Returns the state of the application after the subscriptions have changed",
					"nickname": "unsubscribe",
					"responseClass": "Application",
					"parameters": [
						{
							"name": "applicationName",
							"description": "Application's name",
							"paramType": "path",
							"required": true,
							"allowMultiple": false,
							"dataType": "string"
						},
						{
							"name": "eventSource",
							"description": "URI for event source (channel:{channelId}, bridge:{bridgeId}, endpoint:{tech}[/{resource}], deviceState:{deviceName}",
							"paramType": "query",
							"required": true,
							"allowMultiple": true,
							"dataType": "string"
						}
					],
					"errorResponses": [
						{
							"code": 400,
							"reason": "Missing parameter; event source scheme not recognized."
						},
						{
							"code": 404,
							"reason": "Application does not exist."
						},
						{
							"code": 409,
							"reason": "Application not subscribed to event source."
						},
						{
							"code": 422,
							"reason": "Event source does not exist."
						}
					]
				}
			]
		},
		{
			"path": "/applications/{applicationName}/eventFilter",
			"description": "Stasis application",
			"operations": [
				{
					"httpMethod": "PUT",
					"since": [
						"13.26.0",
						"16.3.0"
					],
					"summary": "Filter application events types.",
					"notes": "Allowed and/or disallowed event type filtering can be done. The body (parameter) should specify a JSON key/value object that describes the type of event filtering needed. One, or both of the following keys can be designated:<br /><br />\"allowed\" - Specifies an allowed list of event types<br />\"disallowed\" - Specifies a disallowed list of event types<br /><br />Further, each of those key's value should be a JSON array that holds zero, or more JSON key/value objects. Each of these objects must contain the following key with an associated value:<br /><br />\"type\" - The type name of the event to filter<br /><br />The value must be the string name (case sensitive) of the event type that needs filtering. For example:<br /><br />{ \"allowed\": [ { \"type\": \"StasisStart\" }, { \"type\": \"StasisEnd\" } ] }<br /><br />As this specifies only an allowed list, then only those two event type messages are sent to the application. No other event messages are sent.<br /><br />The following rules apply:<br /><br />* If the body is empty, both the allowed and disallowed filters are set empty.<br />* If both list types are given then both are set to their respective values (note, specifying an empty array for a given type sets that type to empty).<br />* If only one list type is given then only that type is set. The other type is not updated.<br />* An empty \"allowed\" list means all events are allowed.<br />* An empty \"disallowed\" list means no events are disallowed.<br />* Disallowed events take precedence over allowed events if the event type is specified in both lists.",
					"nickname": "filter",
					"responseClass": "Application",
					"parameters": [
						{
							"name": "applicationName",
							"description": "Application's name",
							"paramType": "path",
							"required": true,
							"allowMultiple": false,
							"dataType": "string"
						},
						{
							"name": "filter",
							"description": "Specify which event types to allow/disallow",
							"paramType": "body",
							"required": false,
							"dataType": "object",
							"allowMultiple": false
						}
					],
					"errorResponses": [
						{
							"code": 400,
							"reason": "Bad request."
						},
						{
							"code": 404,
							"reason": "Application does not exist."
						}
					]
				}
			]
		}
	],
	"models": {
		"Application": {
			"id": "Application",
			"description": "Details of a Stasis application",
			"properties": {
				"name": {
					"type": "string",
					"description": "Name of this application",
					"required": true
				},
				"channel_ids": {
					"type": "List[string]",
					"description": "Id's for channels subscribed to.",
					"required": true
				},
				"bridge_ids": {
					"type": "List[string]",
					"description": "Id's for bridges subscribed to.",
					"required": true
				},
				"endpoint_ids": {
					"type": "List[string]",
					"description": "{tech}/{resource} for endpoints subscribed to.",
					"required": true
				},
				"device_names": {
					"type": "List[string]",
					"description": "Names of the devices subscribed to.",
					"required": true
				},
				"events_allowed": {
					"type": "List[object]",
					"description": "Event types sent to the application.",
					"required": true
				},
				"events_disallowed": {
					"type": "List[object]",
					"description": "Event types not sent to the application.",
					"required": true
				}
			}
		}
	}
}
