distance
Use the following method to calculate distance and time between two locations by using GPS coordinates
/distance
Usage and SDK Samples
curl -X POST -H "apieco-key: [[apiKey]]" "https://api.apieco.ir/trackservice/distance"
import io.swagger.client.*;
import io.swagger.client.auth.*;
import io.swagger.client.model.*;
import io.swagger.client.api.CalculateDistanceByLocationApi;
import java.io.File;
import java.util.*;
public class CalculateDistanceByLocationApiExample {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
// Configure API key authorization: apieco-key
ApiKeyAuth apieco-key = (ApiKeyAuth) defaultClient.getAuthentication("apieco-key");
apieco-key.setApiKey("YOUR API KEY");
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//apieco-key.setApiKeyPrefix("Token");
CalculateDistanceByLocationApi apiInstance = new CalculateDistanceByLocationApi();
String apiecoKey = apiecoKey_example; // String |
String contentType = contentType_example; // String | To receive response in JSON format you must specify content type text/json or application/json.
Body_4 body = ; // Body_4 | The following request uses Latitude and Longitude for Vehicle start location and Latitude and Longitude for a location.
try {
inline_response_200_3 result = apiInstance.distance(apiecoKey, contentType, body);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling CalculateDistanceByLocationApi#distance");
e.printStackTrace();
}
}
}
import io.swagger.client.api.CalculateDistanceByLocationApi;
public class CalculateDistanceByLocationApiExample {
public static void main(String[] args) {
CalculateDistanceByLocationApi apiInstance = new CalculateDistanceByLocationApi();
String apiecoKey = apiecoKey_example; // String |
String contentType = contentType_example; // String | To receive response in JSON format you must specify content type text/json or application/json.
Body_4 body = ; // Body_4 | The following request uses Latitude and Longitude for Vehicle start location and Latitude and Longitude for a location.
try {
inline_response_200_3 result = apiInstance.distance(apiecoKey, contentType, body);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling CalculateDistanceByLocationApi#distance");
e.printStackTrace();
}
}
}
Configuration *apiConfig = [Configuration sharedConfig];
// Configure API key authorization: (authentication scheme: apieco-key)
[apiConfig setApiKey:@"YOUR_API_KEY" forApiKeyIdentifier:@"apieco-key"];
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//[apiConfig setApiKeyPrefix:@"Bearer" forApiKeyIdentifier:@"apieco-key"];
String *apiecoKey = apiecoKey_example; //
String *contentType = contentType_example; // To receive response in JSON format you must specify content type text/json or application/json.
Body_4 *body = ; // The following request uses Latitude and Longitude for Vehicle start location and Latitude and Longitude for a location.
CalculateDistanceByLocationApi *apiInstance = [[CalculateDistanceByLocationApi alloc] init];
//
[apiInstance distanceWith:apiecoKey
contentType:contentType
body:body
completionHandler: ^(inline_response_200_3 output, NSError* error) {
if (output) {
NSLog(@"%@", output);
}
if (error) {
NSLog(@"Error: %@", error);
}
}];
var TrackServiceApiDocumentation = require('track_service_api_documentation');
var defaultClient = TrackServiceApiDocumentation.ApiClient.instance;
// Configure API key authorization: apieco-key
var apieco-key = defaultClient.authentications['apieco-key'];
apieco-key.apiKey = "YOUR API KEY"
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//apieco-key.apiKeyPrefix['apieco-key'] = "Token"
var api = new TrackServiceApiDocumentation.CalculateDistanceByLocationApi()
var apiecoKey = apiecoKey_example; // {String}
var contentType = contentType_example; // {String} To receive response in JSON format you must specify content type text/json or application/json.
var body = ; // {Body_4} The following request uses Latitude and Longitude for Vehicle start location and Latitude and Longitude for a location.
var callback = function(error, data, response) {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
};
api.distance(apiecoKey, contentType, body, callback);
using System;
using System.Diagnostics;
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;
namespace Example
{
public class distanceExample
{
public void main()
{
// Configure API key authorization: apieco-key
Configuration.Default.ApiKey.Add("apieco-key", "YOUR_API_KEY");
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// Configuration.Default.ApiKeyPrefix.Add("apieco-key", "Bearer");
var apiInstance = new CalculateDistanceByLocationApi();
var apiecoKey = apiecoKey_example; // String |
var contentType = contentType_example; // String | To receive response in JSON format you must specify content type text/json or application/json.
var body = new Body_4(); // Body_4 | The following request uses Latitude and Longitude for Vehicle start location and Latitude and Longitude for a location.
try
{
//
inline_response_200_3 result = apiInstance.distance(apiecoKey, contentType, body);
Debug.WriteLine(result);
}
catch (Exception e)
{
Debug.Print("Exception when calling CalculateDistanceByLocationApi.distance: " + e.Message );
}
}
}
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');
// Configure API key authorization: apieco-key
Swagger\Client\Configuration::getDefaultConfiguration()->setApiKey('apieco-key', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// Swagger\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('apieco-key', 'Bearer');
$api_instance = new Swagger\Client\Api\CalculateDistanceByLocationApi();
$apiecoKey = apiecoKey_example; // String |
$contentType = contentType_example; // String | To receive response in JSON format you must specify content type text/json or application/json.
$body = ; // Body_4 | The following request uses Latitude and Longitude for Vehicle start location and Latitude and Longitude for a location.
try {
$result = $api_instance->distance($apiecoKey, $contentType, $body);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling CalculateDistanceByLocationApi->distance: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use WWW::SwaggerClient::Configuration;
use WWW::SwaggerClient::CalculateDistanceByLocationApi;
# Configure API key authorization: apieco-key
$WWW::SwaggerClient::Configuration::api_key->{'apieco-key'} = 'YOUR_API_KEY';
# uncomment below to setup prefix (e.g. Bearer) for API key, if needed
#$WWW::SwaggerClient::Configuration::api_key_prefix->{'apieco-key'} = "Bearer";
my $api_instance = WWW::SwaggerClient::CalculateDistanceByLocationApi->new();
my $apiecoKey = apiecoKey_example; # String |
my $contentType = contentType_example; # String | To receive response in JSON format you must specify content type text/json or application/json.
my $body = WWW::SwaggerClient::Object::Body_4->new(); # Body_4 | The following request uses Latitude and Longitude for Vehicle start location and Latitude and Longitude for a location.
eval {
my $result = $api_instance->distance(apiecoKey => $apiecoKey, contentType => $contentType, body => $body);
print Dumper($result);
};
if ($@) {
warn "Exception when calling CalculateDistanceByLocationApi->distance: $@\n";
}
from __future__ import print_statement
import time
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint
# Configure API key authorization: apieco-key
swagger_client.configuration.api_key['apieco-key'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# swagger_client.configuration.api_key_prefix['apieco-key'] = 'Bearer'
# create an instance of the API class
api_instance = swagger_client.CalculateDistanceByLocationApi()
apiecoKey = apiecoKey_example # String |
contentType = contentType_example # String | To receive response in JSON format you must specify content type text/json or application/json.
body = # Body_4 | The following request uses Latitude and Longitude for Vehicle start location and Latitude and Longitude for a location.
try:
#
api_response = api_instance.distance(apiecoKey, contentType, body)
pprint(api_response)
except ApiException as e:
print("Exception when calling CalculateDistanceByLocationApi->distance: %s\n" % e)
Parameters
Name | Description |
---|---|
apieco-key* |
String
Required
|
ContentType* |
String
To receive response in JSON format you must specify content type text/json or application/json.
Required
|
Name | Description |
---|---|
body * |