Temperature Example: Function not found [SOLVED]


I’m trying the temperature example from the annotated examples; literally copy and pasting the code to the web-IDE. I then check the code (works fine) and flash. The lights on the device blink indicating its updating. However, when I access the temp via curl I get:
“error”: “Function not found”

The URL I use is: curl https://api.spark.io/v1/devices/xxxxx/temperature -d access_token=xxxxx

Other examples seem to work fine, like flashing the LED. Does anyone know what might be going wrong? Thanks in advance.

Yikes, I found the problem. I was missing the -G argument in curl.


Right on @jasonl, that one has tripped me up before too.

For others stubling on this: curl -G means curl --get and forces curl to do a GET request even if you use -d to specify params (whereas curl defaults to default the HTTP verb to POST if you use -d). If you don’t specify --get, you need to pass the params in the url, ala http://bla.com?access_token=123.