Spark.function Call Not Working [SOLVED]

Hi! I’m having an issue executing a function call to a Photon using curl. My code is as follows:

curl https://api.particle.io/devices/{device_ID}/{function_handle} \ -d access_toke=12345

curl returns the following error:

{
    "error": "invalid_request",
    "error_description": "The access token was not found"
}curl: (6) Could not resolve host:  -d
curl: (6) Could not resolve host: access_token=12345

Have function calls changed in the latest firmware build? Any help resolving this would be greatly appreciated! Thank you.

@gaudsend, you need to use your own access token.

In the Web IDE under settings, you can grab it there.

Using particle-cli, you can enter particle config identify to see the access token used as well

1 Like

Hi @kennethlimcp I am definitely using my own access token. I can make GET requests to the same Photon just fine (using my access token, not 12345). Also, my access token from the web IDE is different from the one returned using particle config identify.

After you flash the app, try particle list and see if the function is listed.

Yep, it’s listed. Both the exposed function and the exposed variable are listed.

@gaudsend, noticed one ‘’ with the Curl command, is that is there or by mistake?

The following should work

curl https://api.particle.io/v1/devices/{device_id}/[function_name} -d access_token=1234
2 Likes

Try particle call device_name function_name params

I think he was trying the documentation example but copied the entire line into one command

1 Like

Ah yes, good point. I hadn’t noticed that ‘’. All’s good. Thank you!