Can you post xml to tastypie?
I’m trying to post something like this:
<?xml version="1.0" ?>
<brand>
neat
</brand>
to a model resource that has a brand attribute http://127.0.0.1:8000/api/v1/myentry/. I get back:
AttributeError: 'str' object has no attribute 'items'
What format should the xml be in? All the examples I can find are for posting json, not xml.
Thanks for the help.
EDIT
I also should note, that in the XML data I want to be able to set the limit and offset, along with filter.
Yes, you can!
When looking at the documentation at http://django-tastypie.readthedocs.org/en/latest/interacting.html#creating-a-new-resource-post
there is an example for json:
As you can see the content type and a json object are send with the request.
If you want to send xml you simply have to replace the content type and send an xml object instead.
The format of the xml object you can see if you look at http://x.x.x.x/api/entry/?format=xml
This results in: