ari:Add application/json parameter support
authorDavid M. Lee <dlee@digium.com>
Wed, 27 Nov 2013 15:48:39 +0000 (15:48 +0000)
committerDavid M. Lee <dlee@digium.com>
Wed, 27 Nov 2013 15:48:39 +0000 (15:48 +0000)
commitfccb427c88e6b6e0ae8627ffcdc06f4ae5077d34
treef3aa4bd4148bd818be174ee8648c3d50300ceec7
parentfd33969240111a9ad2fdd305461265b315ce13dd
ari:Add application/json parameter support

The patch allows ARI to parse request parameters from an incoming JSON
request body, instead of requiring the request to come in as query
parameters (which is just weird for POST and DELETE) or form
parameters (which is okay, but a bit asymmetric given that all of our
responses are JSON).

For any operation that does _not_ have a parameter defined of type
body (i.e. "paramType": "body" in the API declaration), if a request
provides a request body with a Content type of "application/json", the
provided JSON document is parsed and searched for parameters.

The expected fields in the provided JSON document should match the
query parameters defined for the operation. If the parameter has
'allowMultiple' set, then the field in the JSON document may
optionally be an array of values.

(closes issue ASTERISK-22685)
Review: https://reviewboard.asterisk.org/r/2994/

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@403177 65c4cc65-6c06-0410-ace0-fbb531ad65f3
18 files changed:
include/asterisk/ari.h
include/asterisk/http.h
main/http.c
res/res_ari.c
res/res_ari_applications.c
res/res_ari_asterisk.c
res/res_ari_bridges.c
res/res_ari_channels.c
res/res_ari_device_states.c
res/res_ari_endpoints.c
res/res_ari_playbacks.c
res/res_ari_recordings.c
res/res_ari_sounds.c
rest-api-templates/asterisk_processor.py
rest-api-templates/param_parsing.mustache
rest-api-templates/res_ari_resource.c.mustache
rest-api-templates/swagger_model.py
tests/test_ari.c