Support Questions

Find answers, ask questions, and share your expertise

NiFi provide Rest API to get data

avatar
Rising Star

Could Nifi provide a rest api to allow java program to submit the data?

I know Nifi can call a rest api from java, but can Nifi provide a api to allow other app to push data?

Thanks

Andy

1 ACCEPTED SOLUTION

avatar

Hi @Andy Liang,

If you want to send data into NiFi through HTTP REST calls, you can use ListenHTTP processor. The data send to the endpoint you define in this processor will be the content of the generated flow files.

If you to manage what responses are sent to your client, you can also use the combination of HandleHttpRequest and HandleHttpResponse. The content of the flow file coming in HandleHttpResponse will be the body of the HTTP response sent to the client. This way you can, for example, create web services for external clients that need access to some data.

Hope this helps.

View solution in original post

5 REPLIES 5

avatar

Hi @Andy Liang,

If you want to send data into NiFi through HTTP REST calls, you can use ListenHTTP processor. The data send to the endpoint you define in this processor will be the content of the generated flow files.

If you to manage what responses are sent to your client, you can also use the combination of HandleHttpRequest and HandleHttpResponse. The content of the flow file coming in HandleHttpResponse will be the body of the HTTP response sent to the client. This way you can, for example, create web services for external clients that need access to some data.

Hope this helps.

avatar
Rising Star

@Pierre Villard could the java app call the ListenHTTP processor or HandleHttpRequest directly in the java app? I know NiFi has rest-api, but I never use them. Do you know any tutorial/example/info is available?

Thanks a lot, Andy

avatar

avatar
Rising Star

@Pierre Villard Thanks a lot for your detail advice. HandleHttpRequest and HandleHttpResponse are exactly what I need.