I have a REST data service where I want to allow the users to create new items with HTTP PUT using different formats like json,xml,csv. Now I'm a little unsure how to best handle the format specification in the url:
PUT -> /ressource/ID/json
PUT -> /ressource/ID/xml
or
PUT -> /ressource/ID?format=json
So what is the best way to specify a format indicator?
If I specify the format with an query parameter and want to do a PUT how can I do this with curl?
curl -T test/data.json -d "format=json" http://localhost:5000/ressource/33
does not work.
curl -T test/data.json http://localhost:5000/update?format=json
works, but I would rather let curl build the query parameters instead of adding them by myself.