2013-04-22 14:58:53 +00:00
|
|
|
{
|
|
|
|
"_copyright": "Copyright (C) 2012 - 2013, Digium, Inc.",
|
|
|
|
"_author": "David M. Lee, II <dlee@digium.com>",
|
|
|
|
"_svn_revision": "$Revision$",
|
2015-05-21 18:05:08 +00:00
|
|
|
"apiVersion": "1.7.0",
|
2013-04-22 14:58:53 +00:00
|
|
|
"swaggerVersion": "1.1",
|
2014-09-20 23:41:55 +00:00
|
|
|
"basePath": "http://localhost:8088/ari",
|
2013-11-08 17:59:16 +00:00
|
|
|
"resourcePath": "/api-docs/playbacks.{format}",
|
2013-04-22 14:58:53 +00:00
|
|
|
"apis": [
|
|
|
|
{
|
2013-11-08 17:59:16 +00:00
|
|
|
"path": "/playbacks/{playbackId}",
|
2013-04-22 14:58:53 +00:00
|
|
|
"description": "Control object for a playback operation.",
|
|
|
|
"operations": [
|
|
|
|
{
|
|
|
|
"httpMethod": "GET",
|
|
|
|
"summary": "Get a playback's details.",
|
2013-11-07 21:10:31 +00:00
|
|
|
"nickname": "get",
|
2013-04-22 14:58:53 +00:00
|
|
|
"responseClass": "Playback",
|
|
|
|
"parameters": [
|
|
|
|
{
|
|
|
|
"name": "playbackId",
|
|
|
|
"description": "Playback's id",
|
|
|
|
"paramType": "path",
|
|
|
|
"required": true,
|
|
|
|
"allowMultiple": false,
|
|
|
|
"dataType": "string"
|
|
|
|
}
|
2013-10-29 11:15:59 +00:00
|
|
|
],
|
|
|
|
"errorResponses": [
|
|
|
|
{
|
|
|
|
"code": 404,
|
|
|
|
"reason": "The playback cannot be found"
|
|
|
|
}
|
2013-04-22 14:58:53 +00:00
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"httpMethod": "DELETE",
|
|
|
|
"summary": "Stop a playback.",
|
2013-11-07 21:10:31 +00:00
|
|
|
"nickname": "stop",
|
2013-10-11 16:36:00 +00:00
|
|
|
"responseClass": "void",
|
2013-04-22 14:58:53 +00:00
|
|
|
"parameters": [
|
|
|
|
{
|
|
|
|
"name": "playbackId",
|
|
|
|
"description": "Playback's id",
|
|
|
|
"paramType": "path",
|
|
|
|
"required": true,
|
|
|
|
"allowMultiple": false,
|
|
|
|
"dataType": "string"
|
|
|
|
}
|
2013-10-29 11:15:59 +00:00
|
|
|
],
|
|
|
|
"errorResponses": [
|
|
|
|
{
|
|
|
|
"code": 404,
|
|
|
|
"reason": "The playback cannot be found"
|
|
|
|
}
|
2013-04-22 14:58:53 +00:00
|
|
|
]
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
2013-11-08 17:59:16 +00:00
|
|
|
"path": "/playbacks/{playbackId}/control",
|
2013-04-22 14:58:53 +00:00
|
|
|
"description": "Control object for a playback operation.",
|
|
|
|
"operations": [
|
|
|
|
{
|
|
|
|
"httpMethod": "POST",
|
2013-10-11 16:36:00 +00:00
|
|
|
"summary": "Control a playback.",
|
2013-11-07 21:10:31 +00:00
|
|
|
"nickname": "control",
|
2013-07-19 19:35:21 +00:00
|
|
|
"responseClass": "void",
|
2013-04-22 14:58:53 +00:00
|
|
|
"parameters": [
|
|
|
|
{
|
|
|
|
"name": "playbackId",
|
|
|
|
"description": "Playback's id",
|
|
|
|
"paramType": "path",
|
|
|
|
"required": true,
|
|
|
|
"allowMultiple": false,
|
|
|
|
"dataType": "string"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"name": "operation",
|
|
|
|
"description": "Operation to perform on the playback.",
|
|
|
|
"paramType": "query",
|
|
|
|
"required": true,
|
|
|
|
"allowMultiple": false,
|
|
|
|
"dataType": "string",
|
|
|
|
"allowableValues": {
|
|
|
|
"valueType": "LIST",
|
|
|
|
"values": [
|
2013-05-23 20:21:16 +00:00
|
|
|
"restart",
|
2013-04-22 14:58:53 +00:00
|
|
|
"pause",
|
2013-05-23 20:21:16 +00:00
|
|
|
"unpause",
|
|
|
|
"reverse",
|
|
|
|
"forward"
|
2013-04-22 14:58:53 +00:00
|
|
|
]
|
|
|
|
}
|
|
|
|
}
|
2013-05-23 20:21:16 +00:00
|
|
|
],
|
|
|
|
"errorResponses": [
|
|
|
|
{
|
|
|
|
"code": 400,
|
|
|
|
"reason": "The provided operation parameter was invalid"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"code": 404,
|
|
|
|
"reason": "The playback cannot be found"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"code": 409,
|
|
|
|
"reason": "The operation cannot be performed in the playback's current state"
|
|
|
|
}
|
|
|
|
]
|
2013-04-22 14:58:53 +00:00
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"models": {
|
|
|
|
"Playback": {
|
|
|
|
"id": "Playback",
|
Update events to use Swagger 1.3 subtyping, and related aftermath
This patch started with the simple idea of changing the /events data
model to be more sane. The original model would send out events like:
{ "stasis_start": { "args": [], "channel": { ... } } }
The event discriminator was the field name instead of being a value in
the object, due to limitations in how Swagger 1.1 could model objects.
While technically sufficient in communicating event information, it was
really difficult to deal with in terms of client side JSON handling.
This patch takes advantage of a proposed extension[1] to Swagger which
allows type variance through the use of a discriminator field. This had
a domino effect that made this a surprisingly large patch.
[1]: https://groups.google.com/d/msg/wordnik-api/EC3rGajE0os/ey_5dBI_jWcJ
In changing the models, I also had to change the swagger_model.py
processor so it can handle the type discriminator and subtyping. I took
that a big step forward, and using that information to generate an
ari_model module, which can validate a JSON object against the Swagger
model.
The REST and WebSocket generators were changed to take advantage of the
validators. If compiled with AST_DEVMODE enabled, JSON objects that
don't match their corresponding models will not be sent out. For REST
API calls, a 500 Internal Server response is sent. For WebSockets, the
invalid JSON message is replaced with an error message.
Since this took over about half of the job of the existing JSON
generators, and the .to_json virtual function on messages took over the
other half, I reluctantly removed the generators.
The validators turned up all sorts of errors and inconsistencies in our
data models, and the code. These were cleaned up, with checks in the
code generator avoid some of the consistency problems in the future.
* The model for a channel snapshot was trimmed down to match the
information sent via AMI. Many of the field being sent were not
useful in the general case.
* The model for a bridge snapshot was updated to be more consistent
with the other ARI models.
Another impact of introducing subtyping was that the swagger-codegen
documentation generator was insufficient (at least until it catches up
with Swagger 1.2). I wanted it to be easier to generate docs for the API
anyways, so I ported the wiki pages to use the Asterisk Swagger
generator. In the process, I was able to clean up many of the model
links, which would occasionally give inconsistent results on the wiki. I
also added error responses to the wiki docs, making the wiki
documentation more complete.
Finally, since Stasis-HTTP will now be named Asterisk REST Interface
(ARI), any new functions and files I created carry the ari_ prefix. I
changed a few stasis_http references to ari where it was non-intrusive
and made sense.
(closes issue ASTERISK-21885)
Review: https://reviewboard.asterisk.org/r/2639/
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@393529 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-07-03 16:32:41 +00:00
|
|
|
"description": "Object representing the playback of media to a channel",
|
2013-04-22 14:58:53 +00:00
|
|
|
"properties": {
|
|
|
|
"id": {
|
Update events to use Swagger 1.3 subtyping, and related aftermath
This patch started with the simple idea of changing the /events data
model to be more sane. The original model would send out events like:
{ "stasis_start": { "args": [], "channel": { ... } } }
The event discriminator was the field name instead of being a value in
the object, due to limitations in how Swagger 1.1 could model objects.
While technically sufficient in communicating event information, it was
really difficult to deal with in terms of client side JSON handling.
This patch takes advantage of a proposed extension[1] to Swagger which
allows type variance through the use of a discriminator field. This had
a domino effect that made this a surprisingly large patch.
[1]: https://groups.google.com/d/msg/wordnik-api/EC3rGajE0os/ey_5dBI_jWcJ
In changing the models, I also had to change the swagger_model.py
processor so it can handle the type discriminator and subtyping. I took
that a big step forward, and using that information to generate an
ari_model module, which can validate a JSON object against the Swagger
model.
The REST and WebSocket generators were changed to take advantage of the
validators. If compiled with AST_DEVMODE enabled, JSON objects that
don't match their corresponding models will not be sent out. For REST
API calls, a 500 Internal Server response is sent. For WebSockets, the
invalid JSON message is replaced with an error message.
Since this took over about half of the job of the existing JSON
generators, and the .to_json virtual function on messages took over the
other half, I reluctantly removed the generators.
The validators turned up all sorts of errors and inconsistencies in our
data models, and the code. These were cleaned up, with checks in the
code generator avoid some of the consistency problems in the future.
* The model for a channel snapshot was trimmed down to match the
information sent via AMI. Many of the field being sent were not
useful in the general case.
* The model for a bridge snapshot was updated to be more consistent
with the other ARI models.
Another impact of introducing subtyping was that the swagger-codegen
documentation generator was insufficient (at least until it catches up
with Swagger 1.2). I wanted it to be easier to generate docs for the API
anyways, so I ported the wiki pages to use the Asterisk Swagger
generator. In the process, I was able to clean up many of the model
links, which would occasionally give inconsistent results on the wiki. I
also added error responses to the wiki docs, making the wiki
documentation more complete.
Finally, since Stasis-HTTP will now be named Asterisk REST Interface
(ARI), any new functions and files I created carry the ari_ prefix. I
changed a few stasis_http references to ari where it was non-intrusive
and made sense.
(closes issue ASTERISK-21885)
Review: https://reviewboard.asterisk.org/r/2639/
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@393529 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-07-03 16:32:41 +00:00
|
|
|
"type": "string",
|
|
|
|
"description": "ID for this playback operation",
|
|
|
|
"required": true
|
|
|
|
},
|
|
|
|
"media_uri": {
|
|
|
|
"type": "string",
|
|
|
|
"description": "URI for the media to play back.",
|
|
|
|
"required": true
|
|
|
|
},
|
|
|
|
"target_uri": {
|
|
|
|
"type": "string",
|
|
|
|
"description": "URI for the channel or bridge to play the media on",
|
|
|
|
"required": true
|
|
|
|
},
|
|
|
|
"language": {
|
|
|
|
"type": "string",
|
|
|
|
"description": "For media types that support multiple languages, the language requested for playback."
|
|
|
|
},
|
|
|
|
"state": {
|
|
|
|
"type": "string",
|
|
|
|
"description": "Current state of the playback operation.",
|
2013-04-22 14:58:53 +00:00
|
|
|
"required": true,
|
Update events to use Swagger 1.3 subtyping, and related aftermath
This patch started with the simple idea of changing the /events data
model to be more sane. The original model would send out events like:
{ "stasis_start": { "args": [], "channel": { ... } } }
The event discriminator was the field name instead of being a value in
the object, due to limitations in how Swagger 1.1 could model objects.
While technically sufficient in communicating event information, it was
really difficult to deal with in terms of client side JSON handling.
This patch takes advantage of a proposed extension[1] to Swagger which
allows type variance through the use of a discriminator field. This had
a domino effect that made this a surprisingly large patch.
[1]: https://groups.google.com/d/msg/wordnik-api/EC3rGajE0os/ey_5dBI_jWcJ
In changing the models, I also had to change the swagger_model.py
processor so it can handle the type discriminator and subtyping. I took
that a big step forward, and using that information to generate an
ari_model module, which can validate a JSON object against the Swagger
model.
The REST and WebSocket generators were changed to take advantage of the
validators. If compiled with AST_DEVMODE enabled, JSON objects that
don't match their corresponding models will not be sent out. For REST
API calls, a 500 Internal Server response is sent. For WebSockets, the
invalid JSON message is replaced with an error message.
Since this took over about half of the job of the existing JSON
generators, and the .to_json virtual function on messages took over the
other half, I reluctantly removed the generators.
The validators turned up all sorts of errors and inconsistencies in our
data models, and the code. These were cleaned up, with checks in the
code generator avoid some of the consistency problems in the future.
* The model for a channel snapshot was trimmed down to match the
information sent via AMI. Many of the field being sent were not
useful in the general case.
* The model for a bridge snapshot was updated to be more consistent
with the other ARI models.
Another impact of introducing subtyping was that the swagger-codegen
documentation generator was insufficient (at least until it catches up
with Swagger 1.2). I wanted it to be easier to generate docs for the API
anyways, so I ported the wiki pages to use the Asterisk Swagger
generator. In the process, I was able to clean up many of the model
links, which would occasionally give inconsistent results on the wiki. I
also added error responses to the wiki docs, making the wiki
documentation more complete.
Finally, since Stasis-HTTP will now be named Asterisk REST Interface
(ARI), any new functions and files I created carry the ari_ prefix. I
changed a few stasis_http references to ari where it was non-intrusive
and made sense.
(closes issue ASTERISK-21885)
Review: https://reviewboard.asterisk.org/r/2639/
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@393529 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-07-03 16:32:41 +00:00
|
|
|
"allowableValues": {
|
|
|
|
"valueType": "LIST",
|
|
|
|
"values": [
|
|
|
|
"queued",
|
|
|
|
"playing",
|
|
|
|
"complete"
|
|
|
|
]
|
|
|
|
}
|
2013-04-22 14:58:53 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|