Nyan available via cloud api?

Hi Guys! Thanks a lot for this awesome product!
As I’d like to give my users the chance to identify their devices by shouting out rainbows, I wanted to ask if the nyan function is also available via the cloud api.
If not, I’ll just add an according function to my device code.
Best Regards, Tobi

Something like this?

1 Like

Though it doesn’t seem to be documented under the cloud section, it is available. Luckily it’s in the JS lib, and the relevant info can be found in there.

The CLI also uses this:


That’s it! Thanks a lot! I had to use a “PUT” command, in connection with the parameters “signal” (value 1 or 0) and “access_token” in the body. :smiley:

For all the other folks interested in making your photon shout rainbows via the web api. Here is the curl command:

`curl -X PUT -H "Content-Type: application/x-www-form-urlencoded" -H "Cache-Control: no-cache" -d 'signal=0&access_token=%YOUR_ACCESS_TOKEN' "https://api.particle.io/v1/products/%YOUR_PRODUCT_SLUG%/devices/%YOUR_DEVICE_ID%/"`

Thanks for the help @ScruffR @Moors7. Also thank you for posting your solution @partTee that is a great help for others that run into this issue!

Hey @ScruffR @Moors7 also form me: thank’s a lot for the quick help!

As said above, it’s working fine. BUT only when using the access_token of one of my team member’s accounts. If I do use an “ordinary” scoped customer’s access_token (which I renew at every login), the call give’s me a
{ "ok": false, "error": "Organization not found for user's role." }

Do you have any Idea why this might be the case?

The renewal of the access token is done via:

curl -X POST -H "Content-Type: application/x-www-form-urlencoded" -H "Authorization: Basic %MYHASHEDUSERNAMEANDSECRET%" -H "Cache-Control: no-cache" -d 'grant_type=client_credentials&scope=customer=mailOfCustomer@host.com&client_id=%MYCLIENTID%&client_secret=%MYCLIENTSECRET%' "https://api.particle.io/oauth/token"

And it returns the desired access_ and refresh_tokens:
{ "token_type": "bearer", "access_token": "%THEACCESSTOKEN%", "expires_in": 7776000, "refresh_token": "%THEREFRESHTOKEN%", "scope": "customer=mailOfCustomer@host.com" }