Control LEDs over the Net

I am new to Spark, I was going through the examples given in the docs.
I was able to run the first example, but I am stuck in the second example.
I am not sure where to use and where to run the following code, which is given in the docs:

POST /v1/devices/{DEVICE_ID}/led

# Core ID is 0123456789abcdef
# Your access token is 123412341234
curl \
  -d access_token=123412341234 \
  -d params=l1,HIGH

Any help ?

You will need to use curl which is a program itself to test it output.

Otherwise, you can use some resources available here:



1 Like

Thank you very much for replying, I am really sorry,I think I am too naive to understand what you are saying.
Can you please explain in a more elaborate way?

Hi @kiran

curl is program that runs on PC/Mac/Linux that can do the kind of web requests you might normally do in a browser. It can GET web pages just like a browser does when you visit a web page or do what is called a POST request, which is what happens when you click the final button on a web page form. The command above is a POST request that tells the Spark cloud to tell your core to run the function you have defined called “led” with arguments “l1,HIGH”.

Curl is great for testing since you can do anything a browser can do from the command line very easily, so a lot of the examples use curl. You can download and run curl for any platform.

There are other alternatives to curl like @kennethlimcp mentioned above, include some like that are entirely on the internet.


Hello @kennethlimcp,
I’m sort of using this thread to ask a question further down stream of your response.
I’ve been using curl to command my core to perform functions.
However upon seeing the two links you’ve posted here I figured these might be a little easier to use since windows prompt does not have copy paste functionality. Would you be able to shed light on how to use these links?

  1. For the spark-helper - what would I enter under “Function” and “data” fields?
  2. For the link in the POST field I entered the entire https request and it threw an error.

Any help will be appreciated.
Thanks much

I’ll give it a shot:

  1. says what to do right above, not sure what else to add

Input the function name to call along with the data to pass and hit the post button to attempt to send it to the core.

2. try this:

If you like you could also try this dashboard thingy I made, quite useful for testing, if I may say so myself. It should be pretty self explanatory.

Let us know if you need any more help.

1 Like

Spark-cli might be a good tool for you to pick up :slight_smile: