1Fetch Client API

<back to all web services

PlaceOrder

The following routes are available for this service:
POST/orderProvide waypoints for a route and place an order. This will bill the order to your account.
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 LinkedWaypoint() = 
        member val FromWaypointNumber:Int32 = new Int32() with get,set
        member val ToWaypointNumber:Int32 = new Int32() with get,set
        member val FromLatitude:Double = new Double() with get,set
        member val FromLongitude:Double = new Double() with get,set
        member val ToLatitude:Double = new Double() with get,set
        member val ToLongitude:Double = new Double() with get,set

    [<AllowNullLiteral>]
    type WaypointQuoteInformation() = 
        inherit LinkedWaypoint()
        ///<summary>
        ///Distance between waypoints as a number
        ///</summary>
        [<ApiMember(Description="Distance between waypoints as a number")>]
        member val Distance:Double = new Double() with get,set

        ///<summary>
        ///String formatted distance
        ///</summary>
        [<ApiMember(Description="String formatted distance")>]
        member val DistanceValue:String = null with get,set

        member val WaypointValid:Boolean = new Boolean() with get,set
        member val Message:String = null with get,set
        member val ErrorDetails:ResizeArray<String> = new ResizeArray<String>() with get,set
        ///<summary>
        ///Caculated price between waypoints excluding vat
        ///</summary>
        [<ApiMember(Description="Caculated price between waypoints excluding vat")>]
        member val Price:Decimal = new Decimal() with get,set

        ///<summary>
        ///Price excluding vat formatted as a string rand value
        ///</summary>
        [<ApiMember(Description="Price excluding vat formatted as a string rand value")>]
        member val PriceValue:String = null with get,set

        ///<summary>
        ///The price between waypoints including vat
        ///</summary>
        [<ApiMember(Description="The price between waypoints including vat")>]
        member val PriceWithVAT:Decimal = new Decimal() with get,set

        ///<summary>
        ///The price including vat formatted as a rand value string
        ///</summary>
        [<ApiMember(Description="The price including vat formatted as a rand value string")>]
        member val PriceValueWithVAT:String = null with get,set

    [<AllowNullLiteral>]
    type WaypointValidationInformation() = 
        member val WaypointNumber:Int32 = new Int32() with get,set
        member val IsValid:Boolean = new Boolean() with get,set
        member val ErrorMessages:ResizeArray<String> = new ResizeArray<String>() with get,set

    [<AllowNullLiteral>]
    type PlaceOrderResponse() = 
        inherit ApiServiceResponse()
        ///<summary>
        ///The ID of the order.
        ///</summary>
        [<ApiMember(Description="The ID of the order.")>]
        member val OrderId:Guid = new Guid() with get,set

        ///<summary>
        ///Were there any validation issues for any waypoints
        ///</summary>
        [<ApiMember(Description="Were there any validation issues for any waypoints")>]
        member val WaypointIssue:Boolean = new Boolean() with get,set

        ///<summary>
        ///The total distance for the order
        ///</summary>
        [<ApiMember(Description="The total distance for the order")>]
        member val TotalDistance:Double = new Double() with get,set

        ///<summary>
        ///The total distance for the order, formatted as a string
        ///</summary>
        [<ApiMember(Description="The total distance for the order, formatted as a string")>]
        member val TotalDistanceValue:String = null with get,set

        ///<summary>
        ///The date and time the order is scheduled for in ISO 8601 string format, will be set if IsScheduled is true
        ///</summary>
        [<ApiMember(Description="The date and time the order is scheduled for in ISO 8601 string format, will be set if IsScheduled is true")>]
        member val ScheduledDate:String = null with get,set

        ///<summary>
        ///The subtotal of the order before VAT
        ///</summary>
        [<ApiMember(Description="The subtotal of the order before VAT")>]
        member val SubTotal:String = null with get,set

        ///<summary>
        ///The total of the order after VAT
        ///</summary>
        [<ApiMember(Description="The total of the order after VAT")>]
        member val FinalPrice:String = null with get,set

        ///<summary>
        ///The amount of VAT 
        ///</summary>
        [<ApiMember(Description="The amount of VAT ")>]
        member val VATValue:String = null with get,set

        ///<summary>
        ///Will contain a message if there a problem with a scheduled order
        ///</summary>
        [<ApiMember(Description="Will contain a message if there a problem with a scheduled order")>]
        member val SchedulingNotice:String = null with get,set

        ///<summary>
        ///Will contain a message if there is a problem with a scheduled quote, if the order is scheduled to soon to opening times
        ///</summary>
        [<ApiMember(Description="Will contain a message if there is a problem with a scheduled quote, if the order is scheduled to soon to opening times")>]
        member val SchedulingError:String = null with get,set

        ///<summary>
        ///User friendly waybill number
        ///</summary>
        [<ApiMember(Description="User friendly waybill number")>]
        member val WayBill:String = null with get,set

        ///<summary>
        ///List of order information for pricing etc between each waypoint
        ///</summary>
        [<ApiMember(Description="List of order information for pricing etc between each waypoint")>]
        member val Waypoints:ResizeArray<WaypointQuoteInformation> = new ResizeArray<WaypointQuoteInformation>() with get,set

        ///<summary>
        ///List with validation information for each waypoint
        ///</summary>
        [<ApiMember(Description="List with validation information for each waypoint")>]
        member val WaypointValidations:ResizeArray<WaypointValidationInformation> = new ResizeArray<WaypointValidationInformation>() 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 RequestQuoteWaypoint() = 
        ///<summary>
        ///Number of waypoint for ordering
        ///</summary>
        [<ApiMember(Description="Number of waypoint for ordering", IsRequired=true)>]
        member val WaypointNumber:Int32 = new Int32() with get,set

        ///<summary>
        ///Waypoint Latitude
        ///</summary>
        [<ApiMember(Description="Waypoint Latitude", IsRequired=true)>]
        member val Latitude:Double = new Double() with get,set

        ///<summary>
        ///Waypoint Longitude
        ///</summary>
        [<ApiMember(Description="Waypoint Longitude", IsRequired=true)>]
        member val Longitude:Double = new Double() with get,set

        ///<summary>
        ///Name of contact person at waypoint
        ///</summary>
        [<ApiMember(Description="Name of contact person at waypoint", IsRequired=true)>]
        member val ContactName:String = null with get,set

        ///<summary>
        ///Telephone number of contact person at waypoint
        ///</summary>
        [<ApiMember(Description="Telephone number of contact person at waypoint", IsRequired=true)>]
        member val ContactNumber:String = null with get,set

        ///<summary>
        ///Instructions for driver to follow at waypoint
        ///</summary>
        [<ApiMember(Description="Instructions for driver to follow at waypoint", IsRequired=true)>]
        member val DeliveryInstructions:String = null with get,set

        ///<summary>
        ///Waypoint address
        ///</summary>
        [<ApiMember(Description="Waypoint address", IsRequired=true)>]
        member val Address:String = null with get,set

    type ScheduleType =
        | NextAvailable = 0
        | SpecificTime = 1

    [<AllowNullLiteral>]
    type PlaceOrder() = 
        inherit ApiServiceRequest()
        ///<summary>
        ///Optionally provide your own reference identifier
        ///</summary>
        [<ApiMember(Description="Optionally provide your own reference identifier")>]
        member val ClientReference:String = null with get,set

        ///<summary>
        ///Optionally provide a reference for the customer/business
        ///</summary>
        [<ApiMember(Description="Optionally provide a reference for the customer/business")>]
        member val CustomerReference:String = null with get,set

        ///<summary>
        ///Array of waypoints
        ///</summary>
        [<ApiMember(Description="Array of waypoints", IsRequired=true)>]
        member val Waypoints:ResizeArray<RequestQuoteWaypoint> = new ResizeArray<RequestQuoteWaypoint>() with get,set

        ///<summary>
        ///Is this a scheduled order?
        ///</summary>
        [<ApiMember(Description="Is this a scheduled order?", IsRequired=true)>]
        member val IsScheduled:Boolean = new Boolean() with get,set

        ///<summary>
        ///Specify the scheduling type, required if IsScheduled is true
        ///</summary>
        [<ApiMember(Description="Specify the scheduling type, required if IsScheduled is true")>]
        member val ScheduleType:ScheduleType = new ScheduleType() with get,set

        ///<summary>
        ///Specify the scheduled date for this delivery in ISO 8601 string format, required if IsScheduled is true and ScheduleType is SpecificTime
        ///</summary>
        [<ApiMember(Description="Specify the scheduled date for this delivery in ISO 8601 string format, required if IsScheduled is true and ScheduleType is SpecificTime")>]
        member val ScheduledDate:String = null with get,set

        ///<summary>
        ///Set this to true to prevent creating an order and billing for it
        ///</summary>
        [<ApiMember(Description="Set this to true to prevent creating an order and billing for it", IsRequired=true)>]
        member val Test:Boolean = new Boolean() with get,set

        ///<summary>
        ///Is your account allows Urgent Orders, you can use this flag to indicate when an Order is urgent.
        ///</summary>
        [<ApiMember(Description="Is your account allows Urgent Orders, you can use this flag to indicate when an Order is urgent.")>]
        member val IsUrgent:Boolean = new Boolean() with get,set

F# PlaceOrder DTOs

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

HTTP + CSV

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

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

{"ClientReference":"String","CustomerReference":"String","Waypoints":[{"WaypointNumber":0,"Latitude":0,"Longitude":0,"ContactName":"String","ContactNumber":"String","DeliveryInstructions":"String","Address":"String"}],"IsScheduled":false,"ScheduleType":0,"ScheduledDate":"String","Test":false,"IsUrgent":false,"ApiKey":"String"}
HTTP/1.1 200 OK
Content-Type: text/csv
Content-Length: length

{"OrderId":"00000000-0000-0000-0000-000000000000","WaypointIssue":false,"TotalDistance":0,"TotalDistanceValue":"0","ScheduledDate":"String","SubTotal":"String","FinalPrice":"String","VATValue":"String","SchedulingNotice":"String","SchedulingError":"String","WayBill":"String","Waypoints":[{}],"WaypointValidations":[{}],"Description":"String","Heading":"String","WasSuccessful":false}