Highlighted
Regular Contributor.
Regular Contributor.
130 views

connecting with api.postcode.nl does not work

Jump to solution
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.
0 Likes
1 Solution

Accepted Solutions
Highlighted
Micro Focus Expert
Micro Focus Expert

Re: connecting with api.postcode.nl does not work

Jump to solution

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.

---
Martin Turner
Product Support Engineer
Micro Focus

View solution in original post

0 Likes
6 Replies
Highlighted
Micro Focus Expert
Micro Focus Expert

Re: connecting with api.postcode.nl does not work

Jump to solution

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

---
Martin Turner
Product Support Engineer
Micro Focus
0 Likes
Highlighted
Regular Contributor.
Regular Contributor.

Re: connecting with api.postcode.nl does not work

Jump to solution

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.

0 Likes
Highlighted
Regular Contributor.
Regular Contributor.

Re: connecting with api.postcode.nl does not work

Jump to solution

When using Curl I get a result.

curl "https://api.postcode.nl/rest/addresses/postcode/3024AN/212/E%20K001" -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"]}

0 Likes
Highlighted
Micro Focus Expert
Micro Focus Expert

Re: connecting with api.postcode.nl does not work

Jump to solution

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

---
Martin Turner
Product Support Engineer
Micro Focus
0 Likes
Highlighted
Regular Contributor.
Regular Contributor.

Re: connecting with api.postcode.nl does not work

Jump to solution

           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==

0 Likes
Highlighted
Micro Focus Expert
Micro Focus Expert

Re: connecting with api.postcode.nl does not work

Jump to solution

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.

---
Martin Turner
Product Support Engineer
Micro Focus

View solution in original post

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.