Skip to main content

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

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.

 


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.


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


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é