Skip to main content

invalid api-key

  • Feb 22, 2020 11:41 AM UTC
  • 4 replies
  • 19 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
  • Feb 24, 2020 11:53 AM UTC

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.

 


  • Feb 24, 2020 12:41 PM UTC

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
Forum|alt.badge.img+2

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).


  • Feb 24, 2020 2:46 PM UTC

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é