For this example, we will use the Port List endpoint to verify the authentication.
The following python code is a simple request for info about a port; however, this example will only use it to check the response code:
import requests
URL = "https://demo.ghmaritime.com/api/portserver/port/info/4533"
header = {
"Authorization": "Basic <credentials>"
}
response = requests.get(url=URL, headers=header)
print(response.status_code)
Replace <credentials> with you base64 encoding of your username and password. I.e. if the username is user and the password is pass, then the Base64 encoding of user:pass is dXNlcjpwYXNz, then the header field is constructed as:
"Authorization": "Basic dXNlcjpwYXNz"
Now, try to call the API with the example code.
If your credentials are authorized and correctly formatted, you should get the response status code 200.
Otherwise, see our list of error codes or contact our support at support@gatehouse.dk.