JSON response from API

Feb 7, 2016 at 6:59 PM
Hi

It is possible to get a JSON response from an API request. Currently if I go to an API action e.g. /Courses I get an xml file based on the SeachResults object.

Thanks
Coordinator
Feb 12, 2016 at 9:14 PM
hi
Sorry, did not see your question until now, notifications do not work again at codeplex.
Make sure you have 2 things setup:
  1. JsonTypeFormatter is added on the server.
  2. The client adds Accept=applicaton/json header to request. If you try it in browser (type in URL), you can't do it, so it might always return XML response. So try it in ApiClient, in code. Or in Fiddler. The server determines response format based on accept header in request.
Feb 16, 2016 at 12:29 PM
Brilliant. Thanks for the help