Hi guys i am new in this Spark and facing problem to call Tinker API functions
using curl in web
i am following the same example as in documentation curl https://api.spark.io/v1/devices/0123456789abcdef/digitalwrite \ -d access_token=123412341234 -d params=D0,HIGH
replacing with my own access token and device id
it’s returning me
{ "ok": false, "error": "Function digitalread not found" }
I have to ask: have you flashed new code to your device, or is this a factory state Core running the Tinker firmware? Looking at your response, I’ve got feeling the original Tinker firmware is no longer running. If you’ve got your own code running on it, might you be able to share it here so we can take a look at it?
i am not using my own code i am just sending the post request by curl
i am following this documentation http://docs.spark.io/tinker. as i said i am new in this not have much knowledge about spark api i don’t know i am going right or wrong my motive is to make functionality same as in Spark app
Well, let's give this a try first, to see if your firmware, the stuff running on your Core, is okay; Could you try logging in here, and checking whether or not it displays any functions for your Core? If so, you could try entering a valid argument in the function box, and try to call it. Checking if they show up in the first place is more important though, so do that first.
You don't call the "digitalRead" from a language, you call the REST API. Almost every programming language can do that, and node.js is certainly one of them.
But rather than worrying about what language to use, you should first get the basic functionality working. From there on, you can expand.
Just to emphasize what the other elites have told you, this indicates that you are not running firmware on your core that will talk to the cloud in a meaningful way. A factory reset will reload Tinker and there will be four functions that you can use.
In this case it means that your request was not formatted properly and it is returning an error. In general the return integer values are decided by the programmer. Your request to Tinker typically requires the first character to be a “D” or and “A”.