Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

Basic Authentication, HTTPS API (getHttp) not working

Basic Authentication, HTTPS API (getHttp) not working

I am trying to pull some data from a Rest API that is secured with basic authentication. I am getting the expected result when I use the following curl-command

curl -v -L -u admin:<password> -H "Accept: application/json" -H "Content-type: application/json" -X GET "https://myexample.com/services/v2/content.json"

However when I am using Nifi and the GetHttp Processor with the following configuration, I am not getting any Json result but the HTML code of the login page. Anything that I might be missing? Maybe a buggy API?

I configured the Standard SSL Context service, tried it on https://www.reddit.com/r/pics/.json? and it did work, so its probably not a SSL issue.

Url: https://myexample.com/services/v2/content.json
Filename: content.json
SSL Context Service: StandardSSLContextService
Username: admin
Password: <password>
Accept Content Type: application/json
Follow Redirects: true

Any idea is much appreciated :)

3 REPLIES 3
Highlighted

Re: Basic Authentication, HTTPS API (getHttp) not working

After a quick look through GetHttp and curl properties the only thing that's different is in the curl command you add the "Content-type: application/json" header. Try issuing the curl command without that and if that is the culprit try using the InvokeHttp processor with that header instead of GetHttp. If not I'd suggest running something like wireshark to try and see what else is different between the http calls.

Highlighted

Re: Basic Authentication, HTTPS API (getHttp) not working

Thanks @jpercivall I already tried without the additional headers, even w/o "follow redirects" (-L) , but curl still returns the right result. The traffic is encrypted so wireshark might not show a lot of information, I'll try anyway and check if I can find a difference between the requests.

Highlighted

Re: Basic Authentication, HTTPS API (getHttp) not working

Super Guru

https://nifi.apache.org/docs/nifi-docs/components/org.apache.nifi.processors.standard.GetHTTP/index....

Can you post the verbose trace curl results? I am wondering if curl is sending something extra by default.

I am wondering if it wants a user agent, that happens with some APIs. what kind of API?

Don't have an account?
Coming from Hortonworks? Activate your account here