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.
import java.math.*
import java.util.*
import net.servicestack.client.*


open class PlaceOrder : ApiServiceRequest(), ILogRequest
{
    /**
    * Optionally provide your own reference identifier
    */
    @ApiMember(Description="Optionally provide your own reference identifier")
    var ClientReference:String? = null

    /**
    * Optionally provide a reference for the customer/business
    */
    @ApiMember(Description="Optionally provide a reference for the customer/business")
    var CustomerReference:String? = null

    /**
    * Array of waypoints
    */
    @ApiMember(Description="Array of waypoints", IsRequired=true)
    var Waypoints:ArrayList<RequestQuoteWaypoint> = ArrayList<RequestQuoteWaypoint>()

    /**
    * Is this a scheduled order?
    */
    @ApiMember(Description="Is this a scheduled order?", IsRequired=true)
    var IsScheduled:Boolean? = null

    /**
    * Specify the scheduling type, required if IsScheduled is true
    */
    @ApiMember(Description="Specify the scheduling type, required if IsScheduled is true")
    var ScheduleType:ScheduleType? = null

    /**
    * Specify the scheduled date for this delivery in ISO 8601 string format, required if IsScheduled is true and ScheduleType is SpecificTime
    */
    @ApiMember(Description="Specify the scheduled date for this delivery in ISO 8601 string format, required if IsScheduled is true and ScheduleType is SpecificTime")
    var ScheduledDate:String? = null

    /**
    * Set this to true to prevent creating an order and billing for it
    */
    @ApiMember(Description="Set this to true to prevent creating an order and billing for it", IsRequired=true)
    var Test:Boolean? = null

    /**
    * Is your account allows Urgent Orders, you can use this flag to indicate when an Order is urgent.
    */
    @ApiMember(Description="Is your account allows Urgent Orders, you can use this flag to indicate when an Order is urgent.")
    var IsUrgent:Boolean? = null
}

open class ApiServiceRequest : IServiceRequest, IHasApiKey
{
    /**
    * The API Key required for authentication
    */
    @ApiMember(DataType="string", Description="The API Key required for authentication", IsRequired=true)
    var ApiKey:String? = null
}

open class RequestQuoteWaypoint : IRequestWaypoint
{
    /**
    * Number of waypoint for ordering
    */
    @ApiMember(Description="Number of waypoint for ordering", IsRequired=true)
    var WaypointNumber:Int? = null

    /**
    * Waypoint Latitude
    */
    @ApiMember(Description="Waypoint Latitude", IsRequired=true)
    var Latitude:Double? = null

    /**
    * Waypoint Longitude
    */
    @ApiMember(Description="Waypoint Longitude", IsRequired=true)
    var Longitude:Double? = null

    /**
    * Name of contact person at waypoint
    */
    @ApiMember(Description="Name of contact person at waypoint", IsRequired=true)
    var ContactName:String? = null

    /**
    * Telephone number of contact person at waypoint
    */
    @ApiMember(Description="Telephone number of contact person at waypoint", IsRequired=true)
    var ContactNumber:String? = null

    /**
    * Instructions for driver to follow at waypoint
    */
    @ApiMember(Description="Instructions for driver to follow at waypoint", IsRequired=true)
    var DeliveryInstructions:String? = null

    /**
    * Waypoint address
    */
    @ApiMember(Description="Waypoint address", IsRequired=true)
    var Address:String? = null
}

enum class ScheduleType(val value:Int)
{
    @SerializedName("0") NextAvailable(0),
    @SerializedName("1") SpecificTime(1),
}

open class PlaceOrderResponse : ApiServiceResponse()
{
    /**
    * The ID of the order.
    */
    @ApiMember(Description="The ID of the order.")
    var OrderId:UUID? = null

    /**
    * Were there any validation issues for any waypoints
    */
    @ApiMember(Description="Were there any validation issues for any waypoints")
    var WaypointIssue:Boolean? = null

    /**
    * The total distance for the order
    */
    @ApiMember(Description="The total distance for the order")
    var TotalDistance:Double? = null

    /**
    * The total distance for the order, formatted as a string
    */
    @ApiMember(Description="The total distance for the order, formatted as a string")
    var TotalDistanceValue:String? = null

    /**
    * The date and time the order is scheduled for in ISO 8601 string format, will be set if IsScheduled is true
    */
    @ApiMember(Description="The date and time the order is scheduled for in ISO 8601 string format, will be set if IsScheduled is true")
    var ScheduledDate:String? = null

    /**
    * The subtotal of the order before VAT
    */
    @ApiMember(Description="The subtotal of the order before VAT")
    var SubTotal:String? = null

    /**
    * The total of the order after VAT
    */
    @ApiMember(Description="The total of the order after VAT")
    var FinalPrice:String? = null

    /**
    * The amount of VAT 
    */
    @ApiMember(Description="The amount of VAT ")
    var VATValue:String? = null

    /**
    * Will contain a message if there a problem with a scheduled order
    */
    @ApiMember(Description="Will contain a message if there a problem with a scheduled order")
    var SchedulingNotice:String? = null

    /**
    * Will contain a message if there is a problem with a scheduled quote, if the order is scheduled to soon to opening times
    */
    @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")
    var SchedulingError:String? = null

    /**
    * User friendly waybill number
    */
    @ApiMember(Description="User friendly waybill number")
    var WayBill:String? = null

    /**
    * List of order information for pricing etc between each waypoint
    */
    @ApiMember(Description="List of order information for pricing etc between each waypoint")
    var Waypoints:ArrayList<WaypointQuoteInformation> = ArrayList<WaypointQuoteInformation>()

    /**
    * List with validation information for each waypoint
    */
    @ApiMember(Description="List with validation information for each waypoint")
    var WaypointValidations:ArrayList<WaypointValidationInformation> = ArrayList<WaypointValidationInformation>()
}

open class ApiServiceResponse : IServiceResponse
{
    /**
    * Information about the response.
    */
    @ApiMember(Description="Information about the response.", IsRequired=true)
    var Description:String? = null

    /**
    * Heading or summary of the response.
    */
    @ApiMember(Description="Heading or summary of the response.", IsRequired=true)
    var Heading:String? = null

    /**
    * Did the intended operation for this response complete successfully?
    */
    @ApiMember(DataType="boolean", Description="Did the intended operation for this response complete successfully?", IsRequired=true)
    var WasSuccessful:Boolean? = null
}

open class WaypointQuoteInformation : LinkedWaypoint()
{
    /**
    * Distance between waypoints as a number
    */
    @ApiMember(Description="Distance between waypoints as a number")
    var Distance:Double? = null

    /**
    * String formatted distance
    */
    @ApiMember(Description="String formatted distance")
    var DistanceValue:String? = null

    var WaypointValid:Boolean? = null
    var Message:String? = null
    var ErrorDetails:ArrayList<String> = ArrayList<String>()
    /**
    * Caculated price between waypoints excluding vat
    */
    @ApiMember(Description="Caculated price between waypoints excluding vat")
    var Price:BigDecimal? = null

    /**
    * Price excluding vat formatted as a string rand value
    */
    @ApiMember(Description="Price excluding vat formatted as a string rand value")
    var PriceValue:String? = null

    /**
    * The price between waypoints including vat
    */
    @ApiMember(Description="The price between waypoints including vat")
    var PriceWithVAT:BigDecimal? = null

    /**
    * The price including vat formatted as a rand value string
    */
    @ApiMember(Description="The price including vat formatted as a rand value string")
    var PriceValueWithVAT:String? = null
}

open class LinkedWaypoint
{
    var FromWaypointNumber:Int? = null
    var ToWaypointNumber:Int? = null
    var FromLatitude:Double? = null
    var FromLongitude:Double? = null
    var ToLatitude:Double? = null
    var ToLongitude:Double? = null
}

open class WaypointValidationInformation
{
    var WaypointNumber:Int? = null
    var IsValid:Boolean? = null
    var ErrorMessages:ArrayList<String> = ArrayList<String>()
}

Kotlin PlaceOrder DTOs

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

HTTP + JSON

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: application/json
Content-Type: application/json
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: application/json
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}