Home > Blockchain >  How do i set parameters of rest api in InvokeHTTP of NiFi?
How do i set parameters of rest api in InvokeHTTP of NiFi?

Time:09-11

I want to filter my rest api with date range. The rest api has dateFrom and dateTo parameters. I want to set dateFrom to 5 days ago and dateTo to now. How do i set the parameters in NiFi ?

My api looks like the below URL:

https://api.aa/reports/api/order_report/?format=json&dateFrom=&dateTo=

CodePudding user response:

You can set your parameters in HTTP URL property, using the Nifi's Expression Language. E.g.:

https://api.aa/reports/api/order_report/?format=json&dateFrom=${now():toNumber():minus(86400000):multiply(5):format("yyyy-MM-dd")}&dateTo=${now():format("yyyy-MM-dd")}
  • Related