Page 1 of 1

REST service error

Posted: Thu Nov 14, 2013 7:43 pm
by Doug Black

I created a REST service to get the ESV Bible API (esvapi.org) daily verse, and put it into an HTML component.

The service tests fine, and the URL it produces work fine. However, when I test it in the app, I get this:
precodeXMLHttpRequest cannot load http://www.esvapi.org/v2/rest/dailyVerse?&key=[MYKEY]&include-headings=false&include-footnotes=false&include-audio-link=false. Origin http://appery.io is not allowed by Access-Control-Allow-Origin. /code/pre

Any thoughts?


REST service error

Posted: Thu Nov 14, 2013 7:48 pm
by Maryna Brodina

Hello! Could you post service settings screenshot?


REST service error

Posted: Thu Nov 14, 2013 10:43 pm
by Doug Black

Here it is, including the test.
Image

Image

Image

Image


REST service error

Posted: Thu Nov 14, 2013 11:42 pm
by Igor

Hello Doug,

On "dailyESV"-settings tab-tick "Use Appery.io Proxy".
"Test" the service-click " Automatically Create Service Response" and remap elements on service screen.


REST service error

Posted: Fri Nov 15, 2013 12:20 am
by Doug Black

I created the response and mapped it. It's still not showing anything. The service isn't returning an error now; it's just not showing anything.

Is it because the service returns HTML instead of a JSON response?


REST service error

Posted: Fri Nov 15, 2013 12:22 am
by Doug Black

Though now that I look in the console, the header is sent as:
Request URL: https://appery.io/app/rest/tunnel?key... KEY]&include-headings=false&include-footnotes=false&include-audio-link=false


REST service error

Posted: Fri Nov 15, 2013 8:18 am
by Kateryna Grynko

Hi Doug,

A service can return json,sjonp,xml, but not html. If you specify data type as xml and will process html then you get a data structure, but not an html page.


REST service error

Posted: Fri Nov 15, 2013 11:49 am
by Doug Black

Thank you for clarifying. I was able to get it into XML, and it should work now.

For anyone else's reference, for esvapi.org: use output-format: crossway-xml-1.0