Skip to main content

invalid api-key

  • February 22, 2020
  • 4 replies
  • 0 views

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

4 replies

Andreas Weinand
Forum|alt.badge.img+2
  • Participating Frequently
  • February 24, 2020

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

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.

 


  • February 24, 2020

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.

 

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

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


Martin Turner

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

Can you perhaps try the extra headers in the format mentioned here - /cobol/acucobol/w/wikiid-122/19708/httppost-with-extra-headers-returns-error-http-400---bad-request

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


  • February 24, 2020

Can you perhaps try the extra headers in the format mentioned here - /cobol/acucobol/w/wikiid-122/19708/httppost-with-extra-headers-returns-error-http-400---bad-request

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

Yes. Using this method it works now.

 

Thank you so much

André