Page 1 of 1

how do I get data from a rest service ?

Posted: Fri Dec 30, 2016 10:28 am
by sculptorsjb
I am new to spider basic

Ideally I want to get json from a particular rest service.

The service defaults to supplying xml unless I can set the request header accept field to json. (firefox)

At the moment in my spider project I have a web gadget that fills with xml when I access the rest service.

Can I access that xml in the web gadget ?

Can I set the request header to get json and if I can what sort of gadget should I use ?

I am ok with javascript but I like the concept of spider basic, I would greatly appreciate some pointers to
lead me in the right direction for accessing a rest service with spider.

Thank you.
steve

Re: how do I get data from a rest service ?

Posted: Sat Dec 31, 2016 1:01 am
by tj1010
Nope.. Origin policy.. You need to pull it with a CGI language like PHP, Perl, or Python and grab it over sockets or ajax requests.

Re: how do I get data from a rest service ?

Posted: Thu Jan 05, 2017 7:18 am
by sculptorsjb
thanks for the reply tj1010

i managed to get the rest service to allow set Access-Control-Allow-Origin: *
i can now bring the json down and display it in the debug window and save it as a file
i am still trying to learn how to use the gadgets to move stuff around

luckily the server is doing the cors work for me as i don't see any way to set the cors request headers in
spiderbasic.