How to Access NiFi REST API

When authenticating via LDAP, the NiFi REST API will require the client pass along a token with each request. To obtain a token, you’ll need to pass the credentials to authenticate.

curl 'https://localhost:8443/nifi-api/access/token' -H 'Accept-Encoding: gzip, deflate, br' -H 'Content-Type: application/x-www-form-urlencoded; charset=UTF-8' -H 'Accept: */*' --data 'username=<user>&password=<pass>' --compressed

This request will return the token that you’ll need to pass in the headers of each subsequent request. For instance:

curl 'https://localhost:8443/nifi-api/flow/current-user' -H 'Accept-Encoding: gzip, deflate, sdch, br' -H 'Authorization: Bearer <token>' -H 'Accept: application/json, text/javascript, */*; q=0.01' --compressed 

Leave a Comment