How to send data to a bucket with Node Red


#1

How I can send data to a bucket with Node Red? I try with a Http request node, but I allways have the same error:
error%20bucket

I have these configuration in http node

any solution?? I read mkrfox information, but I have the same error

Thanks!


#2

Hello @jccf07,

The problem is in the “token” box. You have to introduce a Thinger.io “access token”, created with permissions to access the data bucket and write on it.

And regarding the API, please check that it has been created properly, fallowing this structure: https://api.thinger.io/v1/users/<Username>/buckets/<bucket_ID>/data

remain the “data” at the end

Hope it helps!


#3

Thanks for reply @jtrinc26!
Yes, this is my problem, I have the token access with full access to any action on these bucket (MyBucket). And y I have the URL like you said: https://api.thinger.io/v1/users/MyUser/buckets/MyBucket/data

I´ll try to start again, and do all step again


#4

Maybe the problem it is the inject Node, because I don´t write with proper syntax

I write at inject node body Json:

[{“device”:“MyDevice”,“val”:{“Bomba”:1}}]

And return Json to.

This is my flow in Node Red

[{“id”:“113cb0c3.39517f”,“type”:“inject”,“z”:“5b0a2acd.4f25a4”,“name”:"",“topic”:"",“payload”:"[{“device”:“MyDevice”,“val”:{“Bomba”:1}}]",“payloadType”:“json”,“repeat”:"",“crontab”:"",“once”:false,“onceDelay”:0.1,“x”:90,“y”:440,“wires”:[[“8dcaf768.1d4118”]]},{“id”:“8dcaf768.1d4118”,“type”:“http request”,“z”:“5b0a2acd.4f25a4”,“name”:"",“method”:“POST”,“ret”:“obj”,“paytoqs”:false,“url”:“https://api.thinger.io/v1/users/jccf07/buckets/PruebaNodeRed/data",“tls”:"",“proxy”:"",“authType”:“bearer”,“x”:250,“y”:440,“wires”:[[“c1665b73.e6b7a8”]]},{“id”:“c1665b73.e6b7a8”,“type”:“debug”,“z”:“5b0a2acd.4f25a4”,“name”:"",“active”:true,“tosidebar”:true,“console”:false,“tostatus”:false,“complete”:“true”,“targetType”:“full”,“x”:410,“y”:440,"wires”:[]}]

This are photos of my Thinger config

Node%20Red1

Node%20Red4


#5

When I have fix my problem I´m going to write a post for begginer like me!


#6

Hello Again, I find the problem, It´s was that the bucket data source wasn´t “from write call”, now I recieve data, but now, my problem was Json syntax, because I want to send, for example, variable “Bomba” = “3”, but I get this:
image

My Json body: [{"device":"ESP32","val":{"Bomba":"3"}}]

What could be a correct syntax for Json?
Thanks!


#7

I respond myself: : {"Bomba":3,"Temperatura":99}


#8

:rofl::+1:

Sorry I completely forgot talking about the “from write call” feature, and actually it is a very important part of the configuration because it is the one that allows telling thinger server the source of the data.

Of course… the Json must be written in proper grammar. I strongly recommend you to use the “test endpoint” interface to verify it by calling the API you have created, since it has an editor with grammatical corrector and it will also allow you to see if the API is working properly.

Glad to see that you finally got it!

Best!!