Highlighted
Regular Contributor.
Regular Contributor.
152 views

invalid api-key

Jump to solution

I am trying to get the postcode API to work  but I keep getting 'invalid API key'.

I have a valid API key so what am I doing wrong?

           CALL "HttpGet" USING
                 DESTINATION-URL
                 RESPONSE-POINTER
                 RESPONSE-LENGTH
                 "X-Api-Key:"                
                 API-KEY
                 x"00"
                 x"00"                
                 GIVING STATUS-CODE

0 Likes
1 Solution

Accepted Solutions
Highlighted
Micro Focus Expert
Micro Focus Expert

Re: invalid api-key

Jump to solution

Can you perhaps try the extra headers in the format mentioned here - https://community.microfocus.com/t5/Extend-and-ACUCOBOL-Knowledge/HTTPPOST-with-extra-headers-returns-error-HTTP-400-Bad-Request/ta-p/2759536

If that doesn't work can you show us the CURL command you are using (without your real API key obviously).

---
Martin Turner
Product Support Engineer
Micro Focus

View solution in original post

0 Likes
4 Replies
Highlighted
Super Contributor.
Super Contributor.

Re: invalid api-key

Jump to solution

Hi,

please try this:

CALL "HttpGet" USING
                 DESTINATION-URL
                 RESPONSE-POINTER
                 RESPONSE-LENGTH
                 "X-Api-Key"               
                 x"00"
                 API-KEY
                 x"00"
                 x"00"                
                 GIVING STATUS-CODE.

 

0 Likes
Highlighted
Regular Contributor.
Regular Contributor.

Re: invalid api-key

Jump to solution

Thank you for replying but it still doesn't work.

Postman and curl.exe do work so the api-key itsself is ok.

0 Likes
Highlighted
Micro Focus Expert
Micro Focus Expert

Re: invalid api-key

Jump to solution

Can you perhaps try the extra headers in the format mentioned here - https://community.microfocus.com/t5/Extend-and-ACUCOBOL-Knowledge/HTTPPOST-with-extra-headers-returns-error-HTTP-400-Bad-Request/ta-p/2759536

If that doesn't work can you show us the CURL command you are using (without your real API key obviously).

---
Martin Turner
Product Support Engineer
Micro Focus

View solution in original post

0 Likes
Highlighted
Regular Contributor.
Regular Contributor.

Re: invalid api-key

Jump to solution

Yes. Using this method it works now.

 

Thank you so much

André

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.