Simple POST request


#1

Can I use a simple POST request to send a value to my dashboard?
In the request there are the OAuth token?
There are a simple example to start?


#2

HI @0lab we’ll have an example app here soon. Until then, maybe @hcortes could show us a simple example of sending and requesting values from the dashboard?


#3

Hi @0lab,

There is currently a known bug where you will receive a 401 error response when sending an MQTT command and this issue has been addressed and will be released on next API release which will be soon. I’ll let you know when it’s released and ready to be used.

To send messages to MQTT devices, you will be able to use the following endpoint: https://platform.mydevices.com/things/{thingId}/cmd (thingId can be easily retrieved from your dashboard view url, for example: http://cayenne.app/cayenne/dashboard/device/THING_ID_HERE)

Payload example:

{
channel: 'STRING - your MQTT sensor channel',
value: 'STRING - MQTT value you wish to send'
}

For header please use: Authorization: Bearer OAUTH TOKEN

Please note the following:

  • clientId is your MQTT client id that you use the connect to the Cayenne dashboard.
  • With the fix, you will be able to use your token from either your Cayenne Account when using a password grant option or when using your application oAuth token.

#4

Great! Thanks!


#5

Hi @0lab,

The API has now been updated to fix the bug and you are now able to issue a command POST to an MQTT device :slight_smile:

I also updated my previous post describing how to send the payload as there were some changes on that.