Skip to main content
Trying to connect with https://api.postcode.nl I keep getting this error.
"exception":"Authorization not found.",
"exceptionId":"PostcodeNl_Controller_Plugin_HttpBasicAuthentication_NoAuthorizationHeaderFoundException"
 
I am using "HttpGet" with extra headers.
       01  EXTRA-HEADERS.
          05 filler           PIC X(13) value 'Authorization'.
          05 filler           PIC X value x"00".
          05 filler           PIC X(05) value 'Basic'.
          05 filler           PIC X value x"00".      
          05 LNK-USERNAME     PIC X(100).
          05 filler           PIC X value x"00".         
          05 LNK-PASSWORD     PIC X(100).
          05 FILLER           PIC X VALUE X"00".
          05 FILLER           PIC X VALUE X"00". 
 
With Postman it works so my username and password are correct.
Trying to connect with https://api.postcode.nl I keep getting this error.
"exception":"Authorization not found.",
"exceptionId":"PostcodeNl_Controller_Plugin_HttpBasicAuthentication_NoAuthorizationHeaderFoundException"
 
I am using "HttpGet" with extra headers.
       01  EXTRA-HEADERS.
          05 filler           PIC X(13) value 'Authorization'.
          05 filler           PIC X value x"00".
          05 filler           PIC X(05) value 'Basic'.
          05 filler           PIC X value x"00".      
          05 LNK-USERNAME     PIC X(100).
          05 filler           PIC X value x"00".         
          05 LNK-PASSWORD     PIC X(100).
          05 FILLER           PIC X VALUE X"00".
          05 FILLER           PIC X VALUE X"00". 
 
With Postman it works so my username and password are correct.

Looks like you are only passing 'Basic' as your authorization. You need to send your encoded password too. Here is more information about passing the Authorization header - https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Authorization


Looks like you are only passing 'Basic' as your authorization. You need to send your encoded password too. Here is more information about passing the Authorization header - https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Authorization

Thank you Martin for your reply.

After reading the article and trying the following it still does not work unfortunately.

extra-header looks like this when I debug and after encoding my username:password:

Authorization: Basic  VU5BcTlyUXVwemFOcTVYZ1NIb2NjZ2RITGg0Zzg1RDZOOXhEbVIzcEcxUTpnUmJ2ODhnNGFjWmtrRjR6MlE5OHBYY0lSQ1NubURUdVBQTWRZcGRHYVdlcU5LOHFSQw==

 

This  is also the result in Postman where it does work.


Thank you Martin for your reply.

After reading the article and trying the following it still does not work unfortunately.

extra-header looks like this when I debug and after encoding my username:password:

Authorization: Basic  VU5BcTlyUXVwemFOcTVYZ1NIb2NjZ2RITGg0Zzg1RDZOOXhEbVIzcEcxUTpnUmJ2ODhnNGFjWmtrRjR6MlE5OHBYY0lSQ1NubURUdVBQTWRZcGRHYVdlcU5LOHFSQw==

 

This  is also the result in Postman where it does work.

When using Curl I get a result.

curl "https://api.postcode.nl/rest/addresses/postcode/3024AN/212/E K001" -H "Authorization: Basic VU5BcTlyUXVwemFOcTVYZ1NIb2NjZ2RITGg0Zzg1RDZOOXhEbVIzcEcxUTpnUmJ2ODhnNGFjWmtrRjR6MlE5OHBYY0lSQ1NubURUdVBQTWRZcGRHYVdlcU5LOHFSQw=="
{"street":"Coolhaven","streetNen":"Coolhaven","houseNumber":212,"houseNumberAddition":null,"postcode":"3024AN","city":"Rotterdam","cityShort":"Rotterdam","municipality":"Rotterdam","municipalityShort":"Rotterdam","province":"Zuid-Holland","rdX":90748,"rdY":435882,"latitude":51.90773448,"longitude":4.45348633,"bagNumberDesignationId":"0599200100026629","bagAddressableObjectId":"0599010400025779","addressType":"building","purposes":["residency","education"],"surfaceArea":51,"houseNumberAdditions":["A","B","C","D","E"]}


When using Curl I get a result.

curl "https://api.postcode.nl/rest/addresses/postcode/3024AN/212/E K001" -H "Authorization: Basic VU5BcTlyUXVwemFOcTVYZ1NIb2NjZ2RITGg0Zzg1RDZOOXhEbVIzcEcxUTpnUmJ2ODhnNGFjWmtrRjR6MlE5OHBYY0lSQ1NubURUdVBQTWRZcGRHYVdlcU5LOHFSQw=="
{"street":"Coolhaven","streetNen":"Coolhaven","houseNumber":212,"houseNumberAddition":null,"postcode":"3024AN","city":"Rotterdam","cityShort":"Rotterdam","municipality":"Rotterdam","municipalityShort":"Rotterdam","province":"Zuid-Holland","rdX":90748,"rdY":435882,"latitude":51.90773448,"longitude":4.45348633,"bagNumberDesignationId":"0599200100026629","bagAddressableObjectId":"0599010400025779","addressType":"building","purposes":["residency","education"],"surfaceArea":51,"houseNumberAdditions":["A","B","C","D","E"]}

Can you show what your CALL "HttpGet" ... looks like? The error shows 'NoAuthorizationHeaderFound' so perhaps you are not including the header in the request.


Can you show what your CALL "HttpGet" ... looks like? The error shows 'NoAuthorizationHeaderFound' so perhaps you are not including the header in the request.

           CALL "HttpGet" USING
                 DESTINATION-URL
                 RESPONSE-POINTER
                 RESPONSE-LENGTH
                 EXTRA-HEADERS       
                 GIVING STATUS-CODE
                 ON EXCEPTION
                 SET LOG-HTTPGET TO TRUE
                 PERFORM WRITE-LOG
           END-CALL.

EXTRA-HEADERS = "Authorization: Basic VU5BcTlyUXVwemFOcTVYZ1NIb2NjZ2RITGg0Zzg1RDZOOXhEbVIzcEcxUTpnUmJ2ODhnNGFjWmtrRjR6MlE5OHBYY0lSQ1NubURUdVBQTWRZcGRHYVdlcU5LOHFSQw==


           CALL "HttpGet" USING
                 DESTINATION-URL
                 RESPONSE-POINTER
                 RESPONSE-LENGTH
                 EXTRA-HEADERS       
                 GIVING STATUS-CODE
                 ON EXCEPTION
                 SET LOG-HTTPGET TO TRUE
                 PERFORM WRITE-LOG
           END-CALL.

EXTRA-HEADERS = "Authorization: Basic VU5BcTlyUXVwemFOcTVYZ1NIb2NjZ2RITGg0Zzg1RDZOOXhEbVIzcEcxUTpnUmJ2ODhnNGFjWmtrRjR6MlE5OHBYY0lSQ1NubURUdVBQTWRZcGRHYVdlcU5LOHFSQw==

Thank you. I don't see why this should not work. I would suggest creating an incident in Supportline with a sample program so that we can continue to investigate the issue. There must be something set incorrectly in the program but I cannot see what that is with the information I have.