Page 1 of 1

API Documentation - JSON

PostPosted: Tue Dec 06, 2011 5:02 pm
by will
Just a quick thing, could you update the API Documentation "Section 2.1 XML or JSON" to note that you need to add the header "Accept: application/json" if you want serviio to respond with json. You noted that you need to set Content-Type so I did that and I then spent 20 min wondering why the response was xml. Mostly my fault as its my first attempt at writing anything that uses webservices, but hopefully it will save someone else some time.

Re: API Documentation - JSON

PostPosted: Tue Dec 06, 2011 5:26 pm
by zip
will do thanks

Re: API Documentation - JSON

PostPosted: Tue Dec 06, 2011 9:42 pm
by kairoh
To use json you can either :
- Set HTTP header "Accept: application/json" to your requests.
- Add "media=json" to your request parameters (in URL or in submitted forms).
For example :
http://localhost:23423/rest/application => get XML response
http://localhost:23423/rest/application?media=json => get JSON response

Or use both...

Re: API Documentation - JSON

PostPosted: Wed Dec 07, 2011 11:43 am
by will
kairoh wrote:http://localhost:23423/rest/application?media=json => get JSON response


Thanks, that will be useful for testing things out quickly without using CURL.