Buffer Parser to JSON to PUSH & REST API


I want to know:

  1. How I can convert the output of Buffer Parser into JSON?
  2. How to send the JSON data over PUSH API and REST API.

Please help.

For 1. Assuming that the output is a JavaScript Object in msg.payload then feed it through a JSON node and it will convert it into a JSON string.

For 2. Start by looking at the examples in the node red cookbook.

This is not really a buffer parser question. You should really title this how to convert js object to JSON and transmit to REST API.

As @Colin said, send your js object through a JSON node to convert it into JSON however, I am fairly certain you can simply pass the object to the http request node. Have you tried?

@Steve-Mcl & @Colin

I'm sending the data output of Buffer Parser to PUSH API and in order to send the data, I need to convert it into JSON format so I wrote Buffer Parser to JSON to PUSH & REST API.

Currently, I'm getting status code 400 on HTTP node while sending the data directly from Buffer Parser and/ or after using JSON Parser. I've configured API URL in HTTP node and method as POST.

Please help.

Unless the API is public, there is no way to help you as you have provided too little information.

I would suggest start simple use basic inject / change / function nodes and attempt to make a simple POST using HTTP Request. Once you have a simple one working, then change the payload to use your real data.

If necessary, work through the cookbook examples



How do I verify that data is flowing to API?

If you own the API, check it is logging connections and commands.

If you know who owns the API, ask them to check.

If you get data or a negative response from the API, it is working.

If you have none of the above, you cannot 100% verify.

You can - emulate the API and test to the emulated API.

You can use wireshark to see data going out of your node-red.