export async function call(targetPostalCodes, latitude, postalCode, authKey) {
const baseUrl = "https://api.pro6pp.nl";
const encodedUrl = new URL(`${baseUrl}/v2/locator/dk`);
const queryParams = { targetPostalCodes: targetPostalCodes, latitude: latitude, postalCode: postalCode, authKey: authKey }
encodedUrl.search = new URLSearchParams(queryParams)
return await fetch(encodedUrl).catch((error) => {
throw new Error(error);
});
}
call("4350", "55.61155", "4340", "YOUR_API_KEY")
.then((response) => {
console.log(response.status);
return response.json();
})
.then((res) => {
console.log(res);
});
import requests
def call(target_postal_codes, latitude, postal_code, auth_key):
url = f"https://api.pro6pp.nl/v2/locator/dk?targetPostalCodes={target_postal_codes}&latitude={latitude}&postalCode={postal_code}&authKey={auth_key}"
try:
response = requests.get(url)
return response
except requests.exceptions.RequestException as e:
raise e
response = call("4350", "55.61155", "4340", "YOUR_API_KEY")
print(response.status_code)
print(response.json())