[asterisk-dev] [Code Review] 2994: ari:Add application/json parameter support
David Lee
reviewboard at asterisk.org
Thu Nov 21 14:45:54 CST 2013
> On Nov. 20, 2013, 6:07 p.m., Matt Jordan wrote:
> > /branches/12/main/http.c, line 631
> > <https://reviewboard.asterisk.org/r/2994/diff/2/?file=48312#file48312line631>
> >
> > Particularly since this is coming from an external source, we should probably use sscanf.
> >
> > You pretty much do all of your checking for this already in ast_http_get_json, so it might be a moot point, but hey - coding guidelines :-)
>
> Matt Jordan wrote:
> Of course, this is auto-generated...
At the time, the handler didn't have a great way of handling parse failures
anyways, so atoi wasn't any different than using sscanf. Now I can handle
failures, so we could exit early with a 400 if someone gives a string for a
numeric input. But that's a change to the code generator, and outside of scope
for this patch.
- David
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/2994/#review10223
-----------------------------------------------------------
On Nov. 15, 2013, 12:29 p.m., David Lee wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviewboard.asterisk.org/r/2994/
> -----------------------------------------------------------
>
> (Updated Nov. 15, 2013, 12:29 p.m.)
>
>
> Review request for Asterisk Developers and Paul Belanger.
>
>
> Bugs: ASTERISK-22685
> https://issues.asterisk.org/jira/browse/ASTERISK-22685
>
>
> Repository: Asterisk
>
>
> Description
> -------
>
> 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.
>
>
> Diffs
> -----
>
> /branches/12/tests/test_ari.c 402455
> /branches/12/rest-api-templates/swagger_model.py 402455
> /branches/12/rest-api-templates/res_ari_resource.c.mustache 402455
> /branches/12/rest-api-templates/param_parsing.mustache 402455
> /branches/12/rest-api-templates/asterisk_processor.py 402455
> /branches/12/res/res_ari_sounds.c 402455
> /branches/12/res/res_ari_recordings.c 402455
> /branches/12/res/res_ari_playback.c 402455
> /branches/12/res/res_ari_endpoints.c 402455
> /branches/12/res/res_ari_channels.c 402455
> /branches/12/res/res_ari_bridges.c 402455
> /branches/12/res/res_ari_asterisk.c 402455
> /branches/12/res/res_ari_applications.c 402455
> /branches/12/res/res_ari.c 402455
> /branches/12/main/http.c 402455
> /branches/12/include/asterisk/http.h 402455
> /branches/12/include/asterisk/ari.h 402455
>
> Diff: https://reviewboard.asterisk.org/r/2994/diff/
>
>
> Testing
> -------
>
> Testsuite test.
>
> See https://reviewboard.asterisk.org/r/2993/
>
>
> Thanks,
>
> David Lee
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20131121/3bfc91fa/attachment-0001.html>
More information about the asterisk-dev
mailing list