Apache NiFi - API



NiFi offers a large number of API, which helps developers to make changes and get information of NiFi from any other tool or custom developed applications. In this tutorial, we will use postman app in google chrome to explain some examples.

To add postmantoyour Google Chrome, go to the below mentioned URL and click add to chrome button. You will now see a new app added toyour Google Chrome.

chrome web store

The current version of NiFi rest API is 1.8.0 and the documentation is present in the below mentioned URL.

https://nifi.apache.org/docs/nifi-docs/rest-api/index.html

Following are the most used NiFi rest API Modules −

  • http://<nifi url>:<nifi port>/nifi-api/<api-path>

  • In case HTTPS is enabled https://<nifi url>:<nifi port>/nifi-api/<api-path>

S.No. API module Name api-path Description
1 Access /access To authenticate user and get access token from NiFi.
2 Controller /controller To manage the cluster and create reporting task.
3 Controller Services /controller-services It is used to manage controller services and update controller service references.
4 Reporting Tasks /reporting-tasks To manage reporting tasks.
5 Flow /flow To get the data flow metadata and  component status and query history
6 Process Groups /process-groups To upload and instantiate a template and create components.
7 Processors /processors To create and schedule a processor and set its properties.
8 Connections /connections To create a connection, set queue priority and update connection destination
9 FlowFile Queues /flowfile-queues To view queue contents, download flowfile content, and empty queue.
10 Remote Process Groups /remote-process-groups To create a remote group and enable transmission.
11 Provenance /provenance To query provenance, and search event lineage.

Let us now consider an example and run on postman to get the details about the running NiFi instance.

Request

GET http://localhost:8080/nifi-api/flow/about

Response

{
   "about": {
      "title": "NiFi",
      "version": "1.7.1",
      "uri": "http://localhost:8080/nifi-api/",
      "contentViewerUrl": "../nifi-content-viewer/",
      "timezone": "SGT",
      "buildTag": "nifi-1.7.1-RC1",
      "buildTimestamp": "07/12/2018 12:54:43 SGT"
   }
}
Advertisements