# Node-Red + Cloudant

**URL:** <https://discourse.nodered.org/t/node-red-cloudant/33289>\
**Category:** General\
**Created:** [24 September 2020 13:58 UTC](https://discourse.nodered.org/t/node-red-cloudant/33289 "2020-09-24T13:58:28Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Martin10](https://avatars.discourse-cdn.com/v4/letter/m/a587f6/32.png) [@Martin10](https://discourse.nodered.org/u/Martin10)\
**Post date:** [24 September 2020 13:58 UTC](https://discourse.nodered.org/t/node-red-cloudant/33289/1 "2020-09-24T13:58:29Z")

</div>

Hi i try to connect NR and Cloudant via this tutorial, but i have this error:

> **[IBM Cloud Docs](https://cloud.ibm.com/docs/Cloudant?topic=Cloudant-creating-an-ibm-cloudant-instance-on-ibm-cloud)**

 ![2020-09-24-165130_800x480_scrot](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/a/2/a20c9e27652fcd97d02584608eb07336293fd9d2.png)

Any help, please?

---

<div class="post-metadata">

**Author:** ![Martin10](https://avatars.discourse-cdn.com/v4/letter/m/a587f6/32.png) [@Martin10](https://discourse.nodered.org/u/Martin10)\
**Post date:** [24 September 2020 14:42 UTC](https://discourse.nodered.org/t/node-red-cloudant/33289/2 "2020-09-24T14:42:23Z")

</div>

I also try with this node

 ![2020-09-24-174050_800x480_scrot](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/8/9/891888e8337d702044349b656959b7392def40d0.png)

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [24 September 2020 15:07 UTC](https://discourse.nodered.org/t/node-red-cloudant/33289/3 "2020-09-24T15:07:39Z")

</div>

Hi @Martin10

it isn't really possible to tell the difference between those two screenshots, so it isn't clear what exactly you've tried.

What cloudant node are you using? I would recommend [https://flows.nodered.org/node/node-red-contrib-cloudantplus](https://flows.nodered.org/node/node-red-contrib-cloudantplus)

What payload are you passing into the node?

---

<div class="post-metadata">

**Author:** ![Martin10](https://avatars.discourse-cdn.com/v4/letter/m/a587f6/32.png) [@Martin10](https://discourse.nodered.org/u/Martin10)\
**Post date:** [24 September 2020 15:32 UTC](https://discourse.nodered.org/t/node-red-cloudant/33289/4 "2020-09-24T15:32:07Z")

</div>

Yes, i use this node. I use this msg

```auto
msg.payload = msg.payload;
return msg;

```

i'm worried about that in the cloudant config there is a pass tab, but in the cloudant Service credentials i don't see pass. Instead i use api key, but i'm not shure if it is right to use it?

 ![2020-09-24-182420_800x480_scrot](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/8/e/8efe756ad3cb9716f68820185dd381ac53fbc3b7.png)  
 ![Cloudant_Service credentials - Copy](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/0/0/0004e9a965de37d57cf6850a44b5ee2eec2afb0a.jpeg)

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [24 September 2020 15:49 UTC](https://discourse.nodered.org/t/node-red-cloudant/33289/5 "2020-09-24T15:49:17Z")

</div>

Well at this point you've just shared your service credentials with the whole internet... so you may want to generate some new credentials 🙂

I think you would use the `apikey` value for the password.

> [@Martin10](#):
>
> Yes, i use this node. I use this msg
> 
> ```auto
> msg.payload = msg.payload;
> return msg;
> 
> ```

That isn't doing anything but passing through the message exactly how it was received. That doesn't tell us anything about the value of `msg.payload` you are trying to pass the node and what you'd like it to do with that value.

---

<div class="post-metadata">

**Author:** ![Martin10](https://avatars.discourse-cdn.com/v4/letter/m/a587f6/32.png) [@Martin10](https://discourse.nodered.org/u/Martin10)\
**Post date:** [24 September 2020 15:54 UTC](https://discourse.nodered.org/t/node-red-cloudant/33289/6 "2020-09-24T15:54:57Z")

</div>

I just want to pass the sensor data to the cloudant, but obviously i miss something. Do i need some addition code in the function node?

---

<div class="post-metadata">

**Author:** ![Martin10](https://avatars.discourse-cdn.com/v4/letter/m/a587f6/32.png) [@Martin10](https://discourse.nodered.org/u/Martin10)\
**Post date:** [25 September 2020 08:58 UTC](https://discourse.nodered.org/t/node-red-cloudant/33289/7 "2020-09-25T08:58:02Z")

</div>

Please, any help?

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [25 September 2020 09:06 UTC](https://discourse.nodered.org/t/node-red-cloudant/33289/8 "2020-09-25T09:06:26Z")

</div>

I suggested you try using the `apiKey` as the password. Did that not help?

Cloudant stores JSON documents - I don't think you can pass it `"25.00"` by itself.

You could try adding a Function node before the cloudant node that changes the payload into an object:

```auto
msg.payload = {
   "temperature": msg.payload
}
return msg;

```

---

<div class="post-metadata">

**Author:** ![Martin10](https://avatars.discourse-cdn.com/v4/letter/m/a587f6/32.png) [@Martin10](https://discourse.nodered.org/u/Martin10)\
**Post date:** [25 September 2020 09:12 UTC](https://discourse.nodered.org/t/node-red-cloudant/33289/9 "2020-09-25T09:12:03Z")

</div>

Yes, i try both your advices, but error i got, is the same

 ![2020-09-25-121440_800x480_scrot](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/3/6/36d81510e90ab0ed24efc7f8db4cf9481d2fe2c9.png)

---

<div class="post-metadata">

**Author:** ![Martin10](https://avatars.discourse-cdn.com/v4/letter/m/a587f6/32.png) [@Martin10](https://discourse.nodered.org/u/Martin10)\
**Post date:** [25 September 2020 10:57 UTC](https://discourse.nodered.org/t/node-red-cloudant/33289/10 "2020-09-25T10:57:41Z")

</div>

What i miss?  
I watched this video, and try it, but did not work with me  
https://www.youtube.com/embed/Cds3ziauml4?feature=oembed&wmode=opaque&list=LLTrv0nR3emkBhgCwl8MKqqg

---

<div class="post-metadata">

**Author:** ![Martin10](https://avatars.discourse-cdn.com/v4/letter/m/a587f6/32.png) [@Martin10](https://discourse.nodered.org/u/Martin10)\
**Post date:** [25 September 2020 16:19 UTC](https://discourse.nodered.org/t/node-red-cloudant/33289/11 "2020-09-25T16:19:51Z")

</div>

Do i need to do this first?

> **[jguillod/couchdb-on-raspberry-pi](https://github.com/jguillod/couchdb-on-raspberry-pi)**
>
> How to install CouchDB on Raspbian Stretch / Raspberry PI - jguillod/couchdb-on-raspberry-pi

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [25 September 2020 16:34 UTC](https://discourse.nodered.org/t/node-red-cloudant/33289/12 "2020-09-25T16:34:32Z")

</div>

> [@Martin10](#):
>
> Do i need to do this first?

It depends what your requirements are.

If you want to do everything locally, then yes, you could install couchdb, or look at the other database options like sqlite. There are lots of guides for doing that online.

I'm afraid I've not had time today to look into your cloudant issue. I can't see anything obviously wrong given what you've shared, so you could consider raising an issue against the cloudant node so its author could help you.

---

<div class="post-metadata">

**Author:** ![Martin10](https://avatars.discourse-cdn.com/v4/letter/m/a587f6/32.png) [@Martin10](https://discourse.nodered.org/u/Martin10)\
**Post date:** [25 September 2020 16:50 UTC](https://discourse.nodered.org/t/node-red-cloudant/33289/13 "2020-09-25T16:50:40Z")

</div>

I want to upload sensor data in the cloud. Something like in the video i post.

When i upload data in the grafana via influxDB, i still need to install influxDB locally. I don't know is it the same here?

Thanks for help so far, if you or any body have any idea what i do wrong, i will be grateful if you share with me, whenever you can.

---

<div class="post-metadata">

**Author:** ![Martin10](https://avatars.discourse-cdn.com/v4/letter/m/a587f6/32.png) [@Martin10](https://discourse.nodered.org/u/Martin10)\
**Post date:** [26 September 2020 12:26 UTC](https://discourse.nodered.org/t/node-red-cloudant/33289/14 "2020-09-26T12:26:25Z")

</div>

Funny... When i insert the api key of the Cloudant Service credentials in the cloudant NR node as a password, and i deploy the flow, and than i reopen the node, the password is shorter, anyone know the reason?

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [26 September 2020 12:48 UTC](https://discourse.nodered.org/t/node-red-cloudant/33289/15 "2020-09-26T12:48:52Z")

</div>

Do you mean it shows the wrong number of stars? Since the password encryption is not reversible there is no way for the software to know how many characters there are in your password after you have left the page on which you enter it.

---

<div class="post-metadata">

**Author:** ![Martin10](https://avatars.discourse-cdn.com/v4/letter/m/a587f6/32.png) [@Martin10](https://discourse.nodered.org/u/Martin10)\
**Post date:** [26 September 2020 12:52 UTC](https://discourse.nodered.org/t/node-red-cloudant/33289/16 "2020-09-26T12:52:23Z")

</div>

So, it's not a problem?

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [26 September 2020 12:58 UTC](https://discourse.nodered.org/t/node-red-cloudant/33289/17 "2020-09-26T12:58:55Z")

</div>

If the software does not know how long the password is then it is impossible for it to show the right number of stars. If it showed the right number of stars (except by coincidence) then that would be a problem because it would mean that your password had not be encrypted by a secure algorithm.

---

<div class="post-metadata">

**Author:** ![Martin10](https://avatars.discourse-cdn.com/v4/letter/m/a587f6/32.png) [@Martin10](https://discourse.nodered.org/u/Martin10)\
**Post date:** [26 September 2020 13:18 UTC](https://discourse.nodered.org/t/node-red-cloudant/33289/18 "2020-09-26T13:18:15Z")

</div>

Thank you for the explanation.  
Eventually what can be the reason why i can't upload sensor data into the cloudant, basis on the errors i received?

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [26 September 2020 14:15 UTC](https://discourse.nodered.org/t/node-red-cloudant/33289/19 "2020-09-26T14:15:40Z")

</div>

I can't help with that I am afraid, never having used cloudant.

---

<div class="post-metadata">

**Author:** ![Martin10](https://avatars.discourse-cdn.com/v4/letter/m/a587f6/32.png) [@Martin10](https://discourse.nodered.org/u/Martin10)\
**Post date:** [29 September 2020 14:01 UTC](https://discourse.nodered.org/t/node-red-cloudant/33289/20 "2020-09-29T14:01:35Z")

</div>

I was able to install and create CouchDB on RPI ([https://github.com/jguillod/couchdb-on-raspberry-pi](https://github.com/jguillod/couchdb-on-raspberry-pi)). But still can't upload sensor data to the cloud, any idea?

[Next page](https://discourse.nodered.org/t/node-red-cloudant/33289.md?page=2)
