1Fetch Client API

<back to all web services

Order

The following routes are available for this service:
GET/orderGet order information.If you do not specify an OrderId, the results will be paged.
import java.math.*
import java.util.*
import net.servicestack.client.*


open class Order : ApiServiceRequest(), ILogRequest
{
    /**
    * The ID if getting specific order
    */
    @ApiMember(Description="The ID if getting specific order")
    var OrderId:String? = null

    /**
    * The amount of elements to offset the index by
    */
    @ApiMember(Description="The amount of elements to offset the index by")
    var Offset:Int? = null

    /**
    * The number of elements to be returned, defaults to 10
    */
    @ApiMember(Description="The number of elements to be returned, defaults to 10")
    var Count:Int? = 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 OrderResponse : ApiServiceResponse()
{
    /**
    * List with order details, will only contain one item if requested with order id
    */
    @ApiMember(Description="List with order details, will only contain one item if requested with order id")
    var OrderItems:ArrayList<OrderDetail> = ArrayList<OrderDetail>()

    /**
    * Total number of items in order collection
    */
    @ApiMember(Description="Total number of items in order collection")
    var TotalCount:Int? = null

    /**
    * Used to indicate if there are more items available
    */
    @ApiMember(Description="Used to indicate if there are more items available")
    var LastPage:Boolean? = null
}

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 OrderDetail
{
    /**
    * ID of quote attached to the order
    */
    @ApiMember(Description="ID of quote attached to the order")
    var QuoteId:UUID? = null

    /**
    * ID of order
    */
    @ApiMember(Description="ID of order")
    var OrderId:UUID? = null

    /**
    * User friendly order identifier
    */
    @ApiMember(Description="User friendly order identifier")
    var Waybill:String? = null

    /**
    * Invoice number for the order
    */
    @ApiMember(Description="Invoice number for the order")
    var InvoiceNumber: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

    /**
    * Order status number
    */
    @ApiMember(Description="Order status number")
    var OrderStatus:OrderStatus? = null

    /**
    * String value of order status
    */
    @ApiMember(Description="String value of order status")
    var OrderStatusValue:String? = null

    /**
    * List of waypoints for this order
    */
    @ApiMember(Description="List of waypoints for this order")
    var Waypoints:ArrayList<OrderItemWaypoint> = ArrayList<OrderItemWaypoint>()

    /**
    * List of sections between waypoints
    */
    @ApiMember(Description="List of sections between waypoints")
    var TransitPoints:ArrayList<OrderTransitPoint> = ArrayList<OrderTransitPoint>()

    /**
    * Order Final price including VAT
    */
    @ApiMember(Description="Order Final price including VAT")
    var FinalPrice:BigDecimal? = null

    /**
    * Final price formatted as ZA currency
    */
    @ApiMember(Description="Final price formatted as ZA currency")
    var FinalPriceValue:String? = null

    /**
    * Total distance for the order in km
    */
    @ApiMember(Description="Total distance for the order in km")
    var TotalDistance:Double? = null

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

    /**
    * Date order was placed
    */
    @ApiMember(Description="Date order was placed")
    var Date:String? = null

    /**
    * Google encoded maps polyline path for drawing route on a google map
    */
    @ApiMember(Description="Google encoded maps polyline path for drawing route on a google map")
    var EncodedPolyPath:String? = null

    /**
    * List of events as they occurred while the order was in progress
    */
    @ApiMember(Description="List of events as they occurred while the order was in progress")
    var Events:ArrayList<EventDetail> = ArrayList<EventDetail>()
}

enum class OrderStatus(val value:Int)
{
    @SerializedName("0") AwaitingPayment(0),
    @SerializedName("1") ProcessingPayment(1),
    @SerializedName("2") AwaitingDispatch(2),
    @SerializedName("3") DriverDispatched(3),
    @SerializedName("4") PackageEnRoute(4),
    @SerializedName("5") Completed(5),
    @SerializedName("6") Cancelled(6),
    @SerializedName("7") DeliveryFailed(7),
}

open class OrderItemWaypoint
{
    /**
    * Has the driver completed this waypoint
    */
    @ApiMember(Description="Has the driver completed this waypoint")
    var Completed:Boolean? = null

    var Latitude:Double? = null
    var Longitude:Double? = null
    var Address:String? = null
    var ContactName:String? = null
    var ContactNumber:String? = null
    var DeliveryInstructions:String? = null
    /**
    * Details captured at waypoint
    */
    @ApiMember(Description="Details captured at waypoint")
    var ScanDetail:ScanDetail? = null
}

open class ScanDetail
{
    /**
    * List of URLs for images captured at the waypoint
    */
    @ApiMember(Description="List of URLs for images captured at the waypoint")
    var PhotoUrls:ArrayList<String> = ArrayList<String>()

    /**
    * List of URLs for images of signatures captured at the waypoint
    */
    @ApiMember(Description="List of URLs for images of signatures captured at the waypoint")
    var SignatureUrls:ArrayList<String> = ArrayList<String>()

    /**
    * Name of person the driver interacted with at the waypoint
    */
    @ApiMember(Description="Name of person the driver interacted with at the waypoint")
    var ReceivedBy:String? = null

    /**
    * The date the driver interacted with the person
    */
    @ApiMember(Description="The date the driver interacted with the person")
    var ReceivedDate:String? = null

    /**
    * Number of packages collected by the driver
    */
    @ApiMember(Description="Number of packages collected by the driver")
    var PackagesCollected:Int? = null
}

open class OrderTransitPoint
{
    /**
    * Origin waypoint number
    */
    @ApiMember(Description="Origin waypoint number")
    var FromWaypointNumber:Int? = null

    /**
    * Destination waypoint number
    */
    @ApiMember(Description="Destination waypoint number")
    var ToWaypointNumber:Int? = null

    /**
    * Distance between waypoints
    */
    @ApiMember(Description="Distance between waypoints")
    var Distance:Double? = null

    /**
    * Distance between waypoints rounded and converted to a string
    */
    @ApiMember(Description="Distance between waypoints rounded and converted to a string")
    var DistanceValue:String? = null

    /**
    * Price calculated between waypoints
    */
    @ApiMember(Description="Price calculated between waypoints")
    var Price:BigDecimal? = null

    /**
    * Price calculated between waypoints formatted as ZA currency
    */
    @ApiMember(Description="Price calculated between waypoints formatted as ZA currency")
    var PriceValue:String? = null
}

open class EventDetail
{
    var Description:String? = null
    var Time:String? = null
    var EventDateTime:Date? = null
}

Kotlin Order 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.

GET /order HTTP/1.1 
Host: api.1fetch.co.za 
Accept: application/json
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: length

{"OrderItems":[{"QuoteId":"00000000-0000-0000-0000-000000000000","OrderId":"00000000-0000-0000-0000-000000000000","Waybill":"String","InvoiceNumber":"String","ScheduledDate":"String","OrderStatus":0,"OrderStatusValue":"String","Waypoints":[{}],"TransitPoints":[{}],"FinalPrice":0,"FinalPriceValue":"String","TotalDistance":0,"TotalDistanceValue":"String","Date":"String","EncodedPolyPath":"String","Events":[{}]}],"TotalCount":0,"LastPage":false,"Description":"String","Heading":"String","WasSuccessful":false}