I have a function in my controller decorated with the @request.restful()
decorator. I would like to be able to accept a JSON array of objects,
[{"id": 1, "new_value": 1},{"id": 2, "new_value": 2}]
, on a POST, PUT, or DELETE. For example, I'd like the client to be able to
update a series of values on one request, as opposed to having to submit
multiple requests for each individual update. However, the args and vars
parameters being passed to the methods are empty when a request is sent
with the JSON payload above. Specifically, args only gets populated from
URL args and vars only get populated if the array is accompanied by a key,
such as in:
{"update": [{"id": 1, "new_value": 1},{"id": 2, "new_value": 2}]}
While it certainly isn't too much trouble to include that initial key, I
was wondering if there's any way to retrieve the JSON objects from the
request without having to specify the key so that I could pass a simple
array instead?
Thank you ahead of time for any help.
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.