REST to spark core

Hello,
Is the Spark Core able to receive Web Service requests (REST http requests) .
I mean the spark core will listen to such requests ?
I know the spark can send Http requests, but is it able to receive ?

hi @michealgroiser,

if you give us more information we can answer or could you explain what do you want to do ?

I want to build a web server which will send messages to the Spark Core to perform some action.

If you’re okay with using the cloud? Then yeah, definitely! Check out the tutorial section on the forum for some awesome tutorials on how to do just that (with Javascript/JQuery I believe)

2 Likes

Hi @michaelgroiser,

Checkout the API docs here for information on the REST interface:

http://docs.spark.io/api/

And there are lots of wrappers for the cloud api as well, here’s one that came out recently if you happen to be using Node.js or client-side javascript - https://www.npmjs.com/package/spark

Thanks,
David

1 Like

As far as I can tell, this answer or these docs do not clearly represent how to use the Spark/Photon as an endpoint to receive a request. It has a lot of information about sending them.

If you’re okay with using the cloud, those docs should suffice for sending data to the device. The series also TCP/UDP without the cloud, and the HTTP(S) library which you could check out.

What exactly are you trying to achieve?

@Moors7 , I believe the OP is asking if the Core/Photon acts as an endpoint for REST calls. I believe the answer is no. The cloud acts as the endpoint and queries the Core/Photon to responde to the REST request. I hope I got that right.

I dunno… Looking at the available libraries, there are a couple that catch my eye. In particular, “Webserver” and “Spark-web-embd-rest-json”. At a quick glance, those both look like they’re designed to let the Core/Photon handle an incoming http request…

1 Like