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.*;

public class dtos
{

    public static class Order extends ApiServiceRequest implements ILogRequest
    {
        /**
        * The ID if getting specific order
        */
        @ApiMember(Description="The ID if getting specific order")
        public String OrderId = null;

        /**
        * The amount of elements to offset the index by
        */
        @ApiMember(Description="The amount of elements to offset the index by")
        public Integer Offset = null;

        /**
        * The number of elements to be returned, defaults to 10
        */
        @ApiMember(Description="The number of elements to be returned, defaults to 10")
        public Integer Count = null;
        
        public String getOrderId() { return OrderId; }
        public Order setOrderId(String value) { this.OrderId = value; return this; }
        public Integer getOffset() { return Offset; }
        public Order setOffset(Integer value) { this.Offset = value; return this; }
        public Integer getCount() { return Count; }
        public Order setCount(Integer value) { this.Count = value; return this; }
    }

    public static class ApiServiceRequest implements IServiceRequest, IHasApiKey
    {
        /**
        * The API Key required for authentication
        */
        @ApiMember(DataType="string", Description="The API Key required for authentication", IsRequired=true)
        public String ApiKey = null;
        
        public String getApiKey() { return ApiKey; }
        public ApiServiceRequest setApiKey(String value) { this.ApiKey = value; return this; }
    }

    public static class OrderResponse extends 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")
        public ArrayList<OrderDetail> OrderItems = null;

        /**
        * Total number of items in order collection
        */
        @ApiMember(Description="Total number of items in order collection")
        public Integer TotalCount = null;

        /**
        * Used to indicate if there are more items available
        */
        @ApiMember(Description="Used to indicate if there are more items available")
        public Boolean LastPage = null;
        
        public ArrayList<OrderDetail> getOrderItems() { return OrderItems; }
        public OrderResponse setOrderItems(ArrayList<OrderDetail> value) { this.OrderItems = value; return this; }
        public Integer getTotalCount() { return TotalCount; }
        public OrderResponse setTotalCount(Integer value) { this.TotalCount = value; return this; }
        public Boolean isLastPage() { return LastPage; }
        public OrderResponse setLastPage(Boolean value) { this.LastPage = value; return this; }
    }

    public static class ApiServiceResponse implements IServiceResponse
    {
        /**
        * Information about the response.
        */
        @ApiMember(Description="Information about the response.", IsRequired=true)
        public String Description = null;

        /**
        * Heading or summary of the response.
        */
        @ApiMember(Description="Heading or summary of the response.", IsRequired=true)
        public String Heading = 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)
        public Boolean WasSuccessful = null;
        
        public String getDescription() { return Description; }
        public ApiServiceResponse setDescription(String value) { this.Description = value; return this; }
        public String getHeading() { return Heading; }
        public ApiServiceResponse setHeading(String value) { this.Heading = value; return this; }
        public Boolean isWasSuccessful() { return WasSuccessful; }
        public ApiServiceResponse setWasSuccessful(Boolean value) { this.WasSuccessful = value; return this; }
    }

    public static class OrderDetail
    {
        /**
        * ID of quote attached to the order
        */
        @ApiMember(Description="ID of quote attached to the order")
        public UUID QuoteId = null;

        /**
        * ID of order
        */
        @ApiMember(Description="ID of order")
        public UUID OrderId = null;

        /**
        * User friendly order identifier
        */
        @ApiMember(Description="User friendly order identifier")
        public String Waybill = null;

        /**
        * Invoice number for the order
        */
        @ApiMember(Description="Invoice number for the order")
        public String InvoiceNumber = 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")
        public String ScheduledDate = null;

        /**
        * Order status number
        */
        @ApiMember(Description="Order status number")
        public OrderStatus OrderStatus = null;

        /**
        * String value of order status
        */
        @ApiMember(Description="String value of order status")
        public String OrderStatusValue = null;

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

        /**
        * List of sections between waypoints
        */
        @ApiMember(Description="List of sections between waypoints")
        public ArrayList<OrderTransitPoint> TransitPoints = null;

        /**
        * Order Final price including VAT
        */
        @ApiMember(Description="Order Final price including VAT")
        public BigDecimal FinalPrice = null;

        /**
        * Final price formatted as ZA currency
        */
        @ApiMember(Description="Final price formatted as ZA currency")
        public String FinalPriceValue = null;

        /**
        * Total distance for the order in km
        */
        @ApiMember(Description="Total distance for the order in km")
        public Double TotalDistance = null;

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

        /**
        * Date order was placed
        */
        @ApiMember(Description="Date order was placed")
        public String Date = 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")
        public String EncodedPolyPath = 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")
        public ArrayList<EventDetail> Events = null;
        
        public UUID getQuoteId() { return QuoteId; }
        public OrderDetail setQuoteId(UUID value) { this.QuoteId = value; return this; }
        public UUID getOrderId() { return OrderId; }
        public OrderDetail setOrderId(UUID value) { this.OrderId = value; return this; }
        public String getWaybill() { return Waybill; }
        public OrderDetail setWaybill(String value) { this.Waybill = value; return this; }
        public String getInvoiceNumber() { return InvoiceNumber; }
        public OrderDetail setInvoiceNumber(String value) { this.InvoiceNumber = value; return this; }
        public String getScheduledDate() { return ScheduledDate; }
        public OrderDetail setScheduledDate(String value) { this.ScheduledDate = value; return this; }
        public OrderStatus getOrderStatus() { return OrderStatus; }
        public OrderDetail setOrderStatus(OrderStatus value) { this.OrderStatus = value; return this; }
        public String getOrderStatusValue() { return OrderStatusValue; }
        public OrderDetail setOrderStatusValue(String value) { this.OrderStatusValue = value; return this; }
        public ArrayList<OrderItemWaypoint> getWaypoints() { return Waypoints; }
        public OrderDetail setWaypoints(ArrayList<OrderItemWaypoint> value) { this.Waypoints = value; return this; }
        public ArrayList<OrderTransitPoint> getTransitPoints() { return TransitPoints; }
        public OrderDetail setTransitPoints(ArrayList<OrderTransitPoint> value) { this.TransitPoints = value; return this; }
        public BigDecimal getFinalPrice() { return FinalPrice; }
        public OrderDetail setFinalPrice(BigDecimal value) { this.FinalPrice = value; return this; }
        public String getFinalPriceValue() { return FinalPriceValue; }
        public OrderDetail setFinalPriceValue(String value) { this.FinalPriceValue = value; return this; }
        public Double getTotalDistance() { return TotalDistance; }
        public OrderDetail setTotalDistance(Double value) { this.TotalDistance = value; return this; }
        public String getTotalDistanceValue() { return TotalDistanceValue; }
        public OrderDetail setTotalDistanceValue(String value) { this.TotalDistanceValue = value; return this; }
        public String getDate() { return Date; }
        public OrderDetail setDate(String value) { this.Date = value; return this; }
        public String getEncodedPolyPath() { return EncodedPolyPath; }
        public OrderDetail setEncodedPolyPath(String value) { this.EncodedPolyPath = value; return this; }
        public ArrayList<EventDetail> getEvents() { return Events; }
        public OrderDetail setEvents(ArrayList<EventDetail> value) { this.Events = value; return this; }
    }

    public static enum OrderStatus
    {
        @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);

        private final int value;
        OrderStatus(final int intValue) { value = intValue; }
        public int getValue() { return value; }
    }

    public static class OrderItemWaypoint
    {
        /**
        * Has the driver completed this waypoint
        */
        @ApiMember(Description="Has the driver completed this waypoint")
        public Boolean Completed = null;

        public Double Latitude = null;
        public Double Longitude = null;
        public String Address = null;
        public String ContactName = null;
        public String ContactNumber = null;
        public String DeliveryInstructions = null;
        /**
        * Details captured at waypoint
        */
        @ApiMember(Description="Details captured at waypoint")
        public ScanDetail ScanDetail = null;
        
        public Boolean isCompleted() { return Completed; }
        public OrderItemWaypoint setCompleted(Boolean value) { this.Completed = value; return this; }
        public Double getLatitude() { return Latitude; }
        public OrderItemWaypoint setLatitude(Double value) { this.Latitude = value; return this; }
        public Double getLongitude() { return Longitude; }
        public OrderItemWaypoint setLongitude(Double value) { this.Longitude = value; return this; }
        public String getAddress() { return Address; }
        public OrderItemWaypoint setAddress(String value) { this.Address = value; return this; }
        public String getContactName() { return ContactName; }
        public OrderItemWaypoint setContactName(String value) { this.ContactName = value; return this; }
        public String getContactNumber() { return ContactNumber; }
        public OrderItemWaypoint setContactNumber(String value) { this.ContactNumber = value; return this; }
        public String getDeliveryInstructions() { return DeliveryInstructions; }
        public OrderItemWaypoint setDeliveryInstructions(String value) { this.DeliveryInstructions = value; return this; }
        public ScanDetail getScanDetail() { return ScanDetail; }
        public OrderItemWaypoint setScanDetail(ScanDetail value) { this.ScanDetail = value; return this; }
    }

    public static class ScanDetail
    {
        /**
        * List of URLs for images captured at the waypoint
        */
        @ApiMember(Description="List of URLs for images captured at the waypoint")
        public ArrayList<String> PhotoUrls = null;

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

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

        /**
        * The date the driver interacted with the person
        */
        @ApiMember(Description="The date the driver interacted with the person")
        public String ReceivedDate = null;

        /**
        * Number of packages collected by the driver
        */
        @ApiMember(Description="Number of packages collected by the driver")
        public Integer PackagesCollected = null;
        
        public ArrayList<String> getPhotoUrls() { return PhotoUrls; }
        public ScanDetail setPhotoUrls(ArrayList<String> value) { this.PhotoUrls = value; return this; }
        public ArrayList<String> getSignatureUrls() { return SignatureUrls; }
        public ScanDetail setSignatureUrls(ArrayList<String> value) { this.SignatureUrls = value; return this; }
        public String getReceivedBy() { return ReceivedBy; }
        public ScanDetail setReceivedBy(String value) { this.ReceivedBy = value; return this; }
        public String getReceivedDate() { return ReceivedDate; }
        public ScanDetail setReceivedDate(String value) { this.ReceivedDate = value; return this; }
        public Integer getPackagesCollected() { return PackagesCollected; }
        public ScanDetail setPackagesCollected(Integer value) { this.PackagesCollected = value; return this; }
    }

    public static class OrderTransitPoint
    {
        /**
        * Origin waypoint number
        */
        @ApiMember(Description="Origin waypoint number")
        public Integer FromWaypointNumber = null;

        /**
        * Destination waypoint number
        */
        @ApiMember(Description="Destination waypoint number")
        public Integer ToWaypointNumber = null;

        /**
        * Distance between waypoints
        */
        @ApiMember(Description="Distance between waypoints")
        public Double Distance = null;

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

        /**
        * Price calculated between waypoints
        */
        @ApiMember(Description="Price calculated between waypoints")
        public BigDecimal Price = null;

        /**
        * Price calculated between waypoints formatted as ZA currency
        */
        @ApiMember(Description="Price calculated between waypoints formatted as ZA currency")
        public String PriceValue = null;
        
        public Integer getFromWaypointNumber() { return FromWaypointNumber; }
        public OrderTransitPoint setFromWaypointNumber(Integer value) { this.FromWaypointNumber = value; return this; }
        public Integer getToWaypointNumber() { return ToWaypointNumber; }
        public OrderTransitPoint setToWaypointNumber(Integer value) { this.ToWaypointNumber = value; return this; }
        public Double getDistance() { return Distance; }
        public OrderTransitPoint setDistance(Double value) { this.Distance = value; return this; }
        public String getDistanceValue() { return DistanceValue; }
        public OrderTransitPoint setDistanceValue(String value) { this.DistanceValue = value; return this; }
        public BigDecimal getPrice() { return Price; }
        public OrderTransitPoint setPrice(BigDecimal value) { this.Price = value; return this; }
        public String getPriceValue() { return PriceValue; }
        public OrderTransitPoint setPriceValue(String value) { this.PriceValue = value; return this; }
    }

    public static class EventDetail
    {
        public String Description = null;
        public String Time = null;
        public Date EventDateTime = null;
        
        public String getDescription() { return Description; }
        public EventDetail setDescription(String value) { this.Description = value; return this; }
        public String getTime() { return Time; }
        public EventDetail setTime(String value) { this.Time = value; return this; }
        public Date getEventDateTime() { return EventDateTime; }
        public EventDetail setEventDateTime(Date value) { this.EventDateTime = value; return this; }
    }

}

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

GET /order HTTP/1.1 
Host: api.1fetch.co.za 
Accept: text/csv
HTTP/1.1 200 OK
Content-Type: text/csv
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}