'Requesting list of Companies from Swagger UI

I have embarked on a new project in which I am trying to source data from a REST API. The documentation to this API is available here: https://www.zefixintg.admin.ch/ZefixPublicREST/swagger-ui/index.html?configUrl=/ZefixPublicREST/v3/api-docs/swagger-config#/.

I am specifically interested in the following: /api/v1/company/search.

Unfortunately, I am unable to receive a 200 response with my following query. Instead it always results in an authorisation error 401:

import requests
from requests.auth import HTTPBasicAuth

params= {"activeOnly": TRUE}

response = requests.get(url='https://www.zefixintg.admin.ch/ZefixPublicREST/api/v1/company/search',
                        auth= HTTPBasicAuth('<user>', '<password>'),
                        params=params)

print(response.status_code)

I am not sure what other way I should be authorising myself as I have been told that I would only need a user and a password, which the API owner has provided to me. Am I using an incorrect method for this use case?

Thanks for the support!

Fred



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source