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.
"use strict";
export class ApiServiceRequest {
    /** @param {{ApiKey?:string}} [init] */
    constructor(init) { Object.assign(this, init) }
    /**
     * @type {string}
     * @description The API Key required for authentication */
    ApiKey;
}
export class ApiServiceResponse {
    /** @param {{Description?:string,Heading?:string,WasSuccessful?:boolean}} [init] */
    constructor(init) { Object.assign(this, init) }
    /**
     * @type {string}
     * @description Information about the response. */
    Description;
    /**
     * @type {string}
     * @description Heading or summary of the response. */
    Heading;
    /**
     * @type {boolean}
     * @description Did the intended operation for this response complete successfully? */
    WasSuccessful;
}
/** @typedef {number} */
export var OrderStatus;
(function (OrderStatus) {
    OrderStatus[OrderStatus["AwaitingPayment"] = 0] = "AwaitingPayment"
    OrderStatus[OrderStatus["ProcessingPayment"] = 1] = "ProcessingPayment"
    OrderStatus[OrderStatus["AwaitingDispatch"] = 2] = "AwaitingDispatch"
    OrderStatus[OrderStatus["DriverDispatched"] = 3] = "DriverDispatched"
    OrderStatus[OrderStatus["PackageEnRoute"] = 4] = "PackageEnRoute"
    OrderStatus[OrderStatus["Completed"] = 5] = "Completed"
    OrderStatus[OrderStatus["Cancelled"] = 6] = "Cancelled"
    OrderStatus[OrderStatus["DeliveryFailed"] = 7] = "DeliveryFailed"
})(OrderStatus || (OrderStatus = {}));
export class ScanDetail {
    /** @param {{PhotoUrls?:string[],SignatureUrls?:string[],ReceivedBy?:string,ReceivedDate?:string,PackagesCollected?:number}} [init] */
    constructor(init) { Object.assign(this, init) }
    /**
     * @type {string[]}
     * @description List of URLs for images captured at the waypoint */
    PhotoUrls;
    /**
     * @type {string[]}
     * @description List of URLs for images of signatures captured at the waypoint */
    SignatureUrls;
    /**
     * @type {string}
     * @description Name of person the driver interacted with at the waypoint */
    ReceivedBy;
    /**
     * @type {string}
     * @description The date the driver interacted with the person */
    ReceivedDate;
    /**
     * @type {number}
     * @description Number of packages collected by the driver */
    PackagesCollected;
}
export class OrderItemWaypoint {
    /** @param {{Completed?:boolean,Latitude?:number,Longitude?:number,Address?:string,ContactName?:string,ContactNumber?:string,DeliveryInstructions?:string,ScanDetail?:ScanDetail}} [init] */
    constructor(init) { Object.assign(this, init) }
    /**
     * @type {boolean}
     * @description Has the driver completed this waypoint */
    Completed;
    /** @type {number} */
    Latitude;
    /** @type {number} */
    Longitude;
    /** @type {string} */
    Address;
    /** @type {string} */
    ContactName;
    /** @type {string} */
    ContactNumber;
    /** @type {string} */
    DeliveryInstructions;
    /**
     * @type {ScanDetail}
     * @description Details captured at waypoint */
    ScanDetail;
}
export class OrderTransitPoint {
    /** @param {{FromWaypointNumber?:number,ToWaypointNumber?:number,Distance?:number,DistanceValue?:string,Price?:number,PriceValue?:string}} [init] */
    constructor(init) { Object.assign(this, init) }
    /**
     * @type {number}
     * @description Origin waypoint number */
    FromWaypointNumber;
    /**
     * @type {number}
     * @description Destination waypoint number */
    ToWaypointNumber;
    /**
     * @type {number}
     * @description Distance between waypoints */
    Distance;
    /**
     * @type {string}
     * @description Distance between waypoints rounded and converted to a string */
    DistanceValue;
    /**
     * @type {number}
     * @description Price calculated between waypoints */
    Price;
    /**
     * @type {string}
     * @description Price calculated between waypoints formatted as ZA currency */
    PriceValue;
}
export class EventDetail {
    /** @param {{Description?:string,Time?:string,EventDateTime?:string}} [init] */
    constructor(init) { Object.assign(this, init) }
    /** @type {string} */
    Description;
    /** @type {string} */
    Time;
    /** @type {string} */
    EventDateTime;
}
export class OrderDetail {
    /** @param {{QuoteId?:string,OrderId?:string,Waybill?:string,InvoiceNumber?:string,ScheduledDate?:string,OrderStatus?:OrderStatus,OrderStatusValue?:string,Waypoints?:OrderItemWaypoint[],TransitPoints?:OrderTransitPoint[],FinalPrice?:number,FinalPriceValue?:string,TotalDistance?:number,TotalDistanceValue?:string,Date?:string,EncodedPolyPath?:string,Events?:EventDetail[]}} [init] */
    constructor(init) { Object.assign(this, init) }
    /**
     * @type {string}
     * @description ID of quote attached to the order */
    QuoteId;
    /**
     * @type {string}
     * @description ID of order */
    OrderId;
    /**
     * @type {string}
     * @description User friendly order identifier */
    Waybill;
    /**
     * @type {string}
     * @description Invoice number for the order */
    InvoiceNumber;
    /**
     * @type {string}
     * @description The date and time the order is scheduled for in ISO 8601 string format, will be set if IsScheduled is true */
    ScheduledDate;
    /**
     * @type {OrderStatus}
     * @description Order status number */
    OrderStatus;
    /**
     * @type {string}
     * @description String value of order status */
    OrderStatusValue;
    /**
     * @type {OrderItemWaypoint[]}
     * @description List of waypoints for this order */
    Waypoints;
    /**
     * @type {OrderTransitPoint[]}
     * @description List of sections between waypoints */
    TransitPoints;
    /**
     * @type {number}
     * @description Order Final price including VAT */
    FinalPrice;
    /**
     * @type {string}
     * @description Final price formatted as ZA currency */
    FinalPriceValue;
    /**
     * @type {number}
     * @description Total distance for the order in km */
    TotalDistance;
    /**
     * @type {string}
     * @description Total distance for the order formatted as a string */
    TotalDistanceValue;
    /**
     * @type {string}
     * @description Date order was placed */
    Date;
    /**
     * @type {string}
     * @description Google encoded maps polyline path for drawing route on a google map */
    EncodedPolyPath;
    /**
     * @type {EventDetail[]}
     * @description List of events as they occurred while the order was in progress */
    Events;
}
export class OrderResponse extends ApiServiceResponse {
    /** @param {{OrderItems?:OrderDetail[],TotalCount?:number,LastPage?:boolean,Description?:string,Heading?:string,WasSuccessful?:boolean}} [init] */
    constructor(init) { super(init); Object.assign(this, init) }
    /**
     * @type {OrderDetail[]}
     * @description List with order details, will only contain one item if requested with order id */
    OrderItems;
    /**
     * @type {number}
     * @description Total number of items in order collection */
    TotalCount;
    /**
     * @type {boolean}
     * @description Used to indicate if there are more items available */
    LastPage;
}
export class Order extends ApiServiceRequest {
    /** @param {{OrderId?:string,Offset?:number,Count?:number,ApiKey?:string}} [init] */
    constructor(init) { super(init); Object.assign(this, init) }
    /**
     * @type {string}
     * @description The ID if getting specific order */
    OrderId;
    /**
     * @type {number}
     * @description The amount of elements to offset the index by */
    Offset;
    /**
     * @type {number}
     * @description The number of elements to be returned, defaults to 10 */
    Count;
}

JavaScript 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}