Reputation: 755
I've copied rest.php from core/config to app/config and modified default_format to json but if i don't append '.json' to the URL I still get response in XML format.
How can I get response in JSON on URLs without format?
Upvotes: 0
Views: 1874
Reputation: 18865
To determine the format in which the result should be returned, the REST controller uses the following algorithm and selects the first that is found:
If you're performing an AJAX request you'll want to send up some accept headers up with the request. It's considered bad practice to hard code the response type server side.
Upvotes: 5