does the api return jsonp for an ajax call?

ebauer
New Contributor II

Has anyone verified that the jss api returns jsonp for a cross-domain, browser-based ajax request?

I can return json objects from the api with a REST client, but no matter what I try, I can't get a javascript ajax request to return anything other than xml.

If anyone has this working, would you mind sharing the bit of your .ajax() or XMLHttpRequest() or whatever you are using that is enabling jsonp?

1 ACCEPTED SOLUTION

ebauer
New Contributor II

As of 5/22/2016 per jss tech support:

"We do support ajax queries, and that right now there is a bug with headers in the JSS that's causing it to only return XML."

this bug seems to only apply to javascript ajax calls.

View solution in original post

2 REPLIES 2

Graeme
Contributor

I have had some issues with the format that the API returns. In my case I had to add a header to specify xml. I think the header (in Python) for JSON is

opener.addheaders.append(('Accept', 'application/json'))

To specify xml I used

opener.addheaders.append(('Accept', 'application/xml'))

Hope this helps

Regards
Graeme

ebauer
New Contributor II

As of 5/22/2016 per jss tech support:

"We do support ajax queries, and that right now there is a bug with headers in the JSS that's causing it to only return XML."

this bug seems to only apply to javascript ajax calls.