Sending data from Apache NiFi to InfluxDB

Hello,

I was wondering how I could send some JSON data obtained from an API using NiFi, to my influxDB data bucket. It just doesn’t seem to get updated. I would be glad if someone could help me out here.

Here is a small part of the data I want to send to influxDB:

{
  "ID" : "e7f03f49-51ce-4d12-8d0e-73880ab5053d",
  "Country" : "Zimbabwe",
  "CountryCode" : "ZW",
  "Slug" : "zimbabwe",
  "NewConfirmed" : 0,
  "TotalConfirmed" : 231040,
  "NewDeaths" : 0,
  "TotalDeaths" : 5373,
  "NewRecovered" : 0,
  "TotalRecovered" : 0,
  "Date" : "2022-02-11T07:18:48.299Z",
  "Premium" : { }
}

From that data, I want to transfer the “Country”, “TotalConfirmed” and “TotalDeaths” information to my influxDB bucket.

Thanks in advance!

Hi @akhtarameen,

Did you take a look at GitHub - influxdata/nifi-influxdb-bundle: InfluxDB Processors For Apache NiFi?

Regards

Hi,

Yes I did. I understood what you have done but when I followed your way of flattening the json data into different parts and then using it for the Avro scheme, it didn’t work for me. Could you guide me for my data above as to how you would configure the JSONTreeReader service and thereafter, configuring the schema text field following the avro scheme?

Thanks in advance!

It is a little bit hard to test the NiFi configuration without running flow. Can you share a configuration of your JSONTreeReader and also your AVRO Schema?

Yes here you go:

Here is the link from which I am getting my data:
https://api.covid19api.com/summary

Thanks in advance!

Here is the avro scheme:
image

I also seem to be getting this new error now, and I really don’t have an idea as to what it means:

Sorry, I can’t seem to post more than one image in a response!