how do I get data from a rest service ?

Just starting out? Need help? Post your questions and find answers here.
sculptorsjb
Posts: 3
Joined: Tue Dec 27, 2016 6:01 am

how do I get data from a rest service ?

Post 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
tj1010
Posts: 218
Joined: Wed May 27, 2015 1:36 pm
Contact:

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

Post 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.
sculptorsjb
Posts: 3
Joined: Tue Dec 27, 2016 6:01 am

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

Post 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.
Post Reply