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
# EXAMPLE REQUEST IN TERMINAL
# Core ID is 0123456789abcdef
# Your access token is 123412341234
curl https://api.spark.io/v1/devices/0123456789abcdef/led \
-d access_token=123412341234 \
-d params=l1,HIGH
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?
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 hurl.it 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?
For the spark-helper - what would I enter under “Function” and “data” fields?
For the hurl.it link in the POST field I entered the entire https request and it threw an error.