I am trying to retrieve records using an API from NiFi(1.8 version). I tried using GetHTTP processor but could not fetch the records. However I am able to fetch the records using CURL command,
CURL - curl -v -X GET --insecure --header 'Accept: application/json' --header 'Authorization: Bearer Mzo3ZTIxNTUzN2M2MTZmNDc1NjEzNDBhYzZjMjJmMDhmNzoxMjg1NzUyOjAtYWI1MDk2MzkwZD' 'https://host.uk.dev.net/api/v1.1/data/search?query=search%20Host&limit=100'
NiFi GetHTTP processor configuration -
URL - https://host.uk.dev.net/api/v1.1/data/search?query=search%20Host&limit=100
Filename - test
SSL Context Service - Configured StandardRestrictedSSLContextService controller service with the below values,
Truststore Filename - /usr/lib/jvm/jre/lib/security/cacerts
Truststore Password - changeit
Truststore Type - JKS
Rest of the parameters in the controller service & processor are set to default values.
Could you please let me know if the above configuration is correct?
Your curl command shows that you are passing an authentication bearer token to your endpoint.
you are not going to be able to do that using the getHTTP processor.
You will instead want to use the invokeHTTP processor.
In most cases a Bearer token has an expiration (this expiration is not determined or set by client). So you will probably need to build a dataflow that first hits the proper endpoint to obtain the bearer token. They extract that received bearer token from the response and place it in a FlowFile Attribute. Then route that FlowFile to the invokeHTTP processor where you use the "attributes to send" configuration property to send that token as a header just as it is done in your curl command.
You will still need your sslContextService as well.
Hope this helps,