{"info":{"_postman_id":"0f211fc3-c302-44ba-a26f-1298d66ce7a0","name":"Distance Between Locations","description":"<html><head></head><body><p>This API allows you to calculate distance as km. between the address you specified and Moscow Ring Road. </p>\n<h2 id=\"overview\">OVERVIEW</h2>\n<p>Here is the stesps how the API works in the backgrond.</p>\n<p>1 - Geocoding</p>\n<p>You should firstly give a valid address information to the API and then API converts the address into a coordinate that includes latitude and longitude information using Yandex Map Gecocoding API.</p>\n<p>2 - Check if the given address is aldready inside Moscow Ring Road.</p>\n<p>Once the coordinate is grabbed for the given address API checks if the given point(coordinate) is inside the polygon(Moscow Ring Road boundries).</p>\n<p>3 - Calculating Distance</p>\n<p>If the coordinate for the given address is not inside Moscow Ring Road, then API calculates the distance from Moscow Ring Road to the specified address using OSRM API (Open Street Routing Machine).</p>\n<h2 id=\"error-codes\">Error Codes</h2>\n<ul>\n<li>200: When the response is ok.</li>\n<li>400: When the address parameter is missing or invalid address info.</li>\n<li>404: URL not found.</li>\n<li>500: When something unexpected occurs.</li>\n</ul>\n<h2 id=\"example\">Example</h2>\n<p>When the API returns the response that includes distance correctly it looks like this.</p>\n<pre class=\"click-to-expand-wrapper is-snippet-wrapper\"><code>{\n  \"distance\": \"2341.655\",\n  \"from\": \"Moscow Ring Road\",\n  \"to\": \"istanbul\"\n}\n</code></pre><p>In the response body distance value is kilometer(km).</p>\n<h2 id=\"note\">Note</h2>\n<p>It is rarerly possible to see 500 server errors while getting the distance using the OSRM API because it is open source and not suitible for production. The reason that I did not use Yandex Routing Machine, it was not free.</p>\n</body></html>","schema":"https://schema.getpostman.com/json/collection/v2.0.0/collection.json","toc":[],"owner":"10919248","collectionId":"0f211fc3-c302-44ba-a26f-1298d66ce7a0","publishedId":"TzzHkYFH","public":true,"customColor":{"top-bar":"FFFFFF","right-sidebar":"303030","highlight":"EF5B25"},"publishDate":"2021-08-27T12:51:06.000Z"},"item":[{"name":"get distance from MKAD","id":"0b615515-ba5b-42e9-8c76-855ca177d71f","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[],"url":"localhost:5000/distance?address=<address>","urlObject":{"port":"5000","path":["distance"],"host":["localhost"],"query":[{"description":{"content":"<p>In order to get the distance, address information must be valid.</p>\n","type":"text/plain"},"key":"address","value":"<address>"}],"variable":[]}},"response":[{"id":"25f781e9-fec8-4881-b252-511706183f88","name":"get distance from MKAD to İstanbul","originalRequest":{"method":"GET","header":[],"url":{"raw":"localhost:5000/distance?address=istanbul","host":["localhost"],"port":"5000","path":["distance"],"query":[{"key":"address","value":"istanbul","description":"In this request distance is calculated from MKAD to İstanbul."}]}},"status":"OK","code":200,"_postman_previewlanguage":"json","header":[{"key":"Content-Type","value":"application/json"},{"key":"Content-Length","value":"81"},{"key":"Server","value":"Werkzeug/2.0.1 Python/3.9.2"},{"key":"Date","value":"Fri, 27 Aug 2021 11:31:18 GMT"}],"cookie":[],"responseTime":null,"body":"{\n    \"distance\": \"2341.655\",\n    \"from\": \"Moscow Ring Road\",\n    \"to\": \"istanbul\"\n}"},{"id":"900d4c53-5ae0-4abb-b642-ce4904a6e168","name":"get distance from MKAD to St. Petersburg","originalRequest":{"method":"GET","header":[],"url":{"raw":"localhost:5000/distance?address=St. Petersburg","host":["localhost"],"port":"5000","path":["distance"],"query":[{"key":"address","value":"St. Petersburg","description":"In this request distance is calculated from MKAD to St. Petersburg."}]}},"status":"OK","code":200,"_postman_previewlanguage":"json","header":[{"key":"Content-Type","value":"application/json"},{"key":"Content-Length","value":"86"},{"key":"Server","value":"Werkzeug/2.0.1 Python/3.9.2"},{"key":"Date","value":"Fri, 27 Aug 2021 11:40:31 GMT"}],"cookie":[],"responseTime":null,"body":"{\n    \"distance\": \"697.243\",\n    \"from\": \"Moscow Ring Road\",\n    \"to\": \"St. Petersburg\"\n}"},{"id":"46aa4fd3-d607-45a2-966c-05a8aa97c9ec","name":"wrong address info","originalRequest":{"method":"GET","header":[],"url":{"raw":"localhost:5000/distance?address=2131231sdfsd","host":["localhost"],"port":"5000","path":["distance"],"query":[{"key":"address","value":"2131231sdfsd","description":"In order to get the distance, address information must be valid."}]}},"status":"BAD REQUEST","code":400,"_postman_previewlanguage":"json","header":[{"key":"Content-Type","value":"application/json"},{"key":"Content-Length","value":"66"},{"key":"Server","value":"Werkzeug/2.0.1 Python/3.9.2"},{"key":"Date","value":"Fri, 27 Aug 2021 12:22:54 GMT"}],"cookie":[],"responseTime":null,"body":"{\n    \"message\": \"Make sure that address information is correct.\"\n}"},{"id":"11748e2d-819a-4984-988d-9a57fd79fc1e","name":"missing address parameter","originalRequest":{"method":"GET","header":[],"url":"localhost:5000/distance"},"status":"BAD REQUEST","code":400,"_postman_previewlanguage":"json","header":[{"key":"Content-Type","value":"application/json"},{"key":"Content-Length","value":"51"},{"key":"Server","value":"Werkzeug/2.0.1 Python/3.9.2"},{"key":"Date","value":"Fri, 27 Aug 2021 12:23:59 GMT"}],"cookie":[],"responseTime":null,"body":"{\n    \"message\": \"<address> parameter is missing.\"\n}"},{"id":"cdfefc8f-5946-4fed-aa7a-1afd790ce462","name":"no need to calculate","originalRequest":{"method":"GET","header":[],"url":{"raw":"localhost:5000/distance/?address=Sokolniki Park","host":["localhost"],"port":"5000","path":["distance",""],"query":[{"key":"address","value":"Sokolniki Park"}]}},"status":"OK","code":200,"_postman_previewlanguage":"json","header":[{"key":"Content-Type","value":"application/json"},{"key":"Content-Length","value":"81"},{"key":"Server","value":"Werkzeug/2.0.1 Python/3.9.2"},{"key":"Date","value":"Fri, 27 Aug 2021 12:24:56 GMT"}],"cookie":[],"responseTime":null,"body":"{\n    \"message\": \"No need to calculate. Address is already in Moscow Ring Road.\"\n}"},{"id":"748f7ccc-9afc-496c-a9a2-7bd134f64cb0","name":"url not found","originalRequest":{"method":"GET","header":[],"url":"localhost:5000/anypage"},"status":"NOT FOUND","code":404,"_postman_previewlanguage":"json","header":[{"key":"Content-Type","value":"application/json"},{"key":"Content-Length","value":"32"},{"key":"Server","value":"Werkzeug/2.0.1 Python/3.9.2"},{"key":"Date","value":"Fri, 27 Aug 2021 12:25:39 GMT"}],"cookie":[],"responseTime":null,"body":"{\n    \"Error\": \"URL not found.\"\n}"}],"_postman_id":"0b615515-ba5b-42e9-8c76-855ca177d71f"}]}