Rapid account: Distance.to

Distance.to / Distance.to

चर्चाएँ

14
Title
Created at (Click to sort ascending)
A
1
You're right. The example code is wrong. You need to JSON.stringify the body: `const url = 'https://distanceto.p.rapidapi.com/distance/route'; const options = { method: 'POST', headers: { 'content-type': 'application/json', 'X-RapidAPI-Key': '', 'X-RapidAPI-Host': 'distanceto.p.rapidapi.com' }, body: JSON.stringify({ route: [ { country: 'DEU', name: 'Berlin' }, { country: 'DEU', name: 'Hamburg' } ] }) }; try { const response = await fetch(url, options); const result = await response.text(); console.log(result); } catch (error) { console.error(error); }` mié. 9:02 7/2/24
A
2
Dear User. Thank you for reporting this. There was a major outage yesterday affecting the main domain and all its sub-domains. Read more about the incident here https://docs.distance.to/status#id-2024-02-05-domain-renewal-issue. mar. 12:02 6/2/24
A
1
It is constantly being maintained and developed. lun. 7:06 22/1/24
A
1
Sure, you can add coordinates to the name input as latitude,longitude: `{ "route": [ { "name": "41.7830857,12.846900" }, { "country": "DEU", "name": "Hamburg" } ] }` lun. 10:55 8/1/24
A
1
No,there's no issue with car distance. Could you please provide more information about endpoint, version and request payload? mar. 9:13 18/4/23
A
2
Did you try out the example Code Snippet from https://rapidapi.com/Distance.to/api/distance ? ` <?php $curl = curl_init(); curl_setopt_array($curl, [ CURLOPT_URL => "https://distanceto.p.rapidapi.com/get?route=%5B%7B%22t%22%3A%22TXL%22%7D%2C%7B%22t%22%3A%22Hamburg%22%7D%5D&car=false&foot=false", CURLOPT_RETURNTRANSFER => true, CURLOPT_FOLLOWLOCATION => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 30, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => "GET", CURLOPT_HTTPHEADER => [ "x-rapidapi-host: distanceto.p.rapidapi.com", "x-rapidapi-key: <YOUR KEY>" ], ]); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { echo $response; } ` I think you forgot to [urlencode](https://www.php.net/manual/de/function.urlencode.php) $route_json. vie. 10:38 13/11/20