I have a REST data service where I want to allow users to create new elements using HTTP PUT, using different formats such as json, xml, csv. I'm not sure how best to handle the format specification in the url:
PUT /ressource/ID/json PUT /ressource/ID/xml
or
PUT /ressource/ID?format=json PUT /ressource/ID?format=xml
So what is the best way to specify a format indicator?
If I specify a format with a request parameter and want to do PUT , how can I do this with curl?
curl -T test/data.json -d "format=json" http://localhost:5000/resource/33
does not work.
curl -T test/data.json http://localhost:5000/update?format=json
works, but I would rather let curl build query parameters, rather than add them myself.
source share