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
Imports System
Imports System.Collections
Imports System.Collections.Generic
Imports System.Runtime.Serialization
Imports ServiceStack
Imports ServiceStack.DataAnnotations
Imports WebService.ClientServiceModel
Imports WebService.ClientServiceModel.Base

Namespace Global

    Namespace WebService.ClientServiceModel

        Public Partial Class CalculateDistance
            Inherits ApiServiceRequest
            Implements ILogRequest
            Public Sub New()
                Coordinates = New List(Of Coordinate)
            End Sub

            '''<Summary>
            '''Array of coordinates
            '''</Summary>
            <ApiMember(Description:="Array of coordinates", IsRequired:=true)>
            Public Overridable Property Coordinates As List(Of Coordinate)
        End Class

        Public Partial Class CalculateDistanceResponse
            Inherits ApiServiceResponse
            Public Sub New()
                PointDistances = New List(Of Decimal)
            End Sub

            '''<Summary>
            '''A list of the distances between each point, returned in order that the points were provided
            '''</Summary>
            <ApiMember(Description:="A list of the distances between each point, returned in order that the points were provided")>
            Public Overridable Property PointDistances As List(Of Decimal)

            '''<Summary>
            '''The total distance between all points
            '''</Summary>
            <ApiMember(Description:="The total distance between all points")>
            Public Overridable Property TotalDistance As Decimal
        End Class

        Public Partial Class Coordinate
            '''<Summary>
            '''The Latitude
            '''</Summary>
            <ApiMember(Description:="The Latitude", IsRequired:=true)>
            Public Overridable Property Latitude As Double

            '''<Summary>
            '''The Longitude
            '''</Summary>
            <ApiMember(Description:="The Longitude", IsRequired:=true)>
            Public Overridable Property Longitude As Double
        End Class
    End Namespace

    Namespace WebService.ClientServiceModel.Base

        Public Partial Class ApiServiceRequest
            Implements IServiceRequest
            Implements IHasApiKey
            '''<Summary>
            '''The API Key required for authentication
            '''</Summary>
            <ApiMember(DataType:="string", Description:="The API Key required for authentication", IsRequired:=true)>
            Public Overridable Property ApiKey As String
        End Class

        Public Partial Class ApiServiceResponse
            Implements IServiceResponse
            '''<Summary>
            '''Information about the response.
            '''</Summary>
            <ApiMember(Description:="Information about the response.", IsRequired:=true)>
            Public Overridable Property Description As String

            '''<Summary>
            '''Heading or summary of the response.
            '''</Summary>
            <ApiMember(Description:="Heading or summary of the response.", IsRequired:=true)>
            Public Overridable Property Heading As String

            '''<Summary>
            '''Did the intended operation for this response complete successfully?
            '''</Summary>
            <ApiMember(DataType:="boolean", Description:="Did the intended operation for this response complete successfully?", IsRequired:=true)>
            Public Overridable Property WasSuccessful As Boolean
        End Class
    End Namespace
End Namespace

VB.NET CalculateDistance DTOs

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: 1fetch.api.client.prod.86degrees.com 
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
}