export async function call ( street, settlement, streetNumber, authKey ) {
const baseUrl = "https://api.pro6pp.nl" ;
const encodedUrl = new URL( ` ${baseUrl} /v2/suggest/ch/streetNumber` );
const queryParams = { street : street, settlement : settlement, streetNumber : streetNumber, authKey : authKey }
encodedUrl.search = new URLSearchParams(queryParams)
return await fetch(encodedUrl).catch( ( error ) => {
throw new Error (error);
});
}
call( "Bifang" , "Lenzburg" , "1" , "YOUR_API_KEY" )
.then( ( response ) => {
console .log(response.status);
return response.json();
})
.then( ( res ) => {
console .log(res);
});
import requests
def call ( street, settlement, street_number, auth_key ):
url = f"https://api.pro6pp.nl/v2/suggest/ch/streetNumber?street= {street} &settlement= {settlement} &streetNumber= {street_number} &authKey= {auth_key} "
try :
response = requests.get(url)
return response
except requests.exceptions.RequestException as e:
raise e
response = call( "Bifang" , "Lenzburg" , "1" , "YOUR_API_KEY" )
print (response.status_code)
print (response.json())