Skip to main content
Solved

does the api return jsonp for an ajax call?

  • April 26, 2016
  • 2 replies
  • 41 views

Forum|alt.badge.img+5

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?

Best answer by ebauer

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.

2 replies

Forum|alt.badge.img+7
  • Contributor
  • April 27, 2016

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


Forum|alt.badge.img+5
  • Author
  • New Contributor
  • Answer
  • May 5, 2016

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.