1Fetch Client API

<back to all web services

CalculateDistance

The following routes are available for this service:
POST/calculatedistanceCalculate the distance between a list of coordinates
CalculateDistance Parameters:
NameParameterData TypeRequiredDescription
CoordinatesbodyList<Coordinate>YesArray of coordinates
ApiServiceRequest Parameters:
NameParameterData TypeRequiredDescription
ApiKeyformstringYesThe API Key required for authentication
Coordinate Parameters:
NameParameterData TypeRequiredDescription
LatitudeformdoubleYesThe Latitude
LongitudeformdoubleYesThe Longitude
CalculateDistanceResponse Parameters:
NameParameterData TypeRequiredDescription
PointDistancesformList<decimal>NoA list of the distances between each point, returned in order that the points were provided
TotalDistanceformdecimalNoThe total distance between all points
ApiServiceResponse Parameters:
NameParameterData TypeRequiredDescription
DescriptionformstringYesInformation about the response.
HeadingformstringYesHeading or summary of the response.
WasSuccessfulformbooleanYesDid the intended operation for this response complete successfully?

To override the Content-type in your clients, use the HTTP Accept Header, append the .jsv suffix or ?format=jsv

HTTP + JSV

The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.

POST /calculatedistance HTTP/1.1 
Host: api.1fetch.co.za 
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length

{
	Coordinates: 
	[
		{
			Latitude: 0,
			Longitude: 0
		}
	],
	ApiKey: String
}
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length

{
	PointDistances: 
	[
		0
	],
	TotalDistance: 0,
	Description: String,
	Heading: String,
	WasSuccessful: False
}