With the EWS Road Distance service you can obtain road distances for a relation between two input locations in Europe.
Using the EWS Road Distance API is simple. Follow the steps on this page to get started with road distance calculation. For an easy integration you can also use the clients for Java, C# and TypeScript on GitHub.
Please note the individual rate and request limits for each API. You can find all limits in our FAQ.
API Endpoint
To get you started we will use the following endpoint, that will return the road distance between a start and destination location.
https://api.myptv.com/ews/v1/relations
Request
You can test this by entering the URL into your web browser (be sure to replace YOUR_API_KEY with your actual API key).
https://api.myptv.com/ews/v1/relations?start[postalCode]=76135&destination[postalCode]=70173&apiKey=YOUR_API_KEY
Alternatively you can choose one of the following options to send your request. You also have the option to send the API key in the request header.
cURL:
curl --location --request GET "https://api.myptv.com/ews/v1/relations?start[postalCode]=76135&destination[postalCode]=70173" --header "ApiKey: YOUR_API_KEY"
PowerShell:
$headers = @{"apiKey" = "YOUR_API_KEY"}
$Uri = "https://api.myptv.com/ews/v1/relations?start[postalCode]=76135&destination[postalCode]=70173"
$response = Invoke-RestMethod -Uri $uri -Method Get -Headers $headers
$response | ConvertTo-Json
Response
Below you will find the response of the request mentioned above.
{
"distance": 75000,
"start": {
"country": "DE",
"postalCode": "76135",
"locality": "Karlsruhe",
"type": "CITY"
},
"destination": {
"country": "DE",
"postalCode": "70173",
"locality": "Stuttgart",
"type": "CITY"
},
"dataVersion": "V2022",
"region": "GERMANY"
}