| POST | /calculatedistance | Calculate the distance between a list of coordinates |
|---|
namespace WebService.ClientServiceModel
open System
open System.Collections
open System.Collections.Generic
open System.Runtime.Serialization
open ServiceStack
open ServiceStack.DataAnnotations
[<AllowNullLiteral>]
type ApiServiceResponse() =
///<summary>
///Information about the response.
///</summary>
[<ApiMember(Description="Information about the response.", IsRequired=true)>]
member val Description:String = null with get,set
///<summary>
///Heading or summary of the response.
///</summary>
[<ApiMember(Description="Heading or summary of the response.", IsRequired=true)>]
member val Heading:String = null with get,set
///<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)>]
member val WasSuccessful:Boolean = new Boolean() with get,set
[<AllowNullLiteral>]
type CalculateDistanceResponse() =
inherit ApiServiceResponse()
///<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")>]
member val PointDistances:ResizeArray<Decimal> = new ResizeArray<Decimal>() with get,set
///<summary>
///The total distance between all points
///</summary>
[<ApiMember(Description="The total distance between all points")>]
member val TotalDistance:Decimal = new Decimal() with get,set
[<AllowNullLiteral>]
type ApiServiceRequest() =
///<summary>
///The API Key required for authentication
///</summary>
[<ApiMember(DataType="string", Description="The API Key required for authentication", IsRequired=true)>]
member val ApiKey:String = null with get,set
[<AllowNullLiteral>]
type Coordinate() =
///<summary>
///The Latitude
///</summary>
[<ApiMember(Description="The Latitude", IsRequired=true)>]
member val Latitude:Double = new Double() with get,set
///<summary>
///The Longitude
///</summary>
[<ApiMember(Description="The Longitude", IsRequired=true)>]
member val Longitude:Double = new Double() with get,set
[<AllowNullLiteral>]
type CalculateDistance() =
inherit ApiServiceRequest()
///<summary>
///Array of coordinates
///</summary>
[<ApiMember(Description="Array of coordinates", IsRequired=true)>]
member val Coordinates:ResizeArray<Coordinate> = new ResizeArray<Coordinate>() with get,set
To override the Content-type in your clients, use the HTTP Accept Header, append the .csv suffix or ?format=csv
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/csv
Content-Type: text/csv
Content-Length: length
{"Coordinates":[{"Latitude":0,"Longitude":0}],"ApiKey":"String"}
HTTP/1.1 200 OK
Content-Type: text/csv
Content-Length: length
{"PointDistances":[0],"TotalDistance":0,"Description":"String","Heading":"String","WasSuccessful":false}