| POST | /calculatedistance | Calculate 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
To override the Content-type in your clients, use the HTTP Accept Header, append the .json suffix or ?format=json
To embed the response in a jsonp callback, append ?callback=myCallback
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: application/json
Content-Type: application/json
Content-Length: length
{"Coordinates":[{"Latitude":0,"Longitude":0}],"ApiKey":"String"}
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: length
{"PointDistances":[0],"TotalDistance":0,"Description":"String","Heading":"String","WasSuccessful":false}