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.

export class ApiServiceRequest implements IServiceRequest, IHasApiKey
{
    /** @description The API Key required for authentication */
    // @ApiMember(DataType="string", Description="The API Key required for authentication", IsRequired=true)
    public ApiKey: string;

    public constructor(init?: Partial<ApiServiceRequest>) { (Object as any).assign(this, init); }
}

export class ApiServiceResponse implements IServiceResponse
{
    /** @description Information about the response. */
    // @ApiMember(Description="Information about the response.", IsRequired=true)
    public Description: string;

    /** @description Heading or summary of the response. */
    // @ApiMember(Description="Heading or summary of the response.", IsRequired=true)
    public Heading: string;

    /** @description 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 WasSuccessful: boolean;

    public constructor(init?: Partial<ApiServiceResponse>) { (Object as any).assign(this, init); }
}

export class LinkedWaypoint
{
    public FromWaypointNumber: number;
    public ToWaypointNumber: number;
    public FromLatitude: number;
    public FromLongitude: number;
    public ToLatitude: number;
    public ToLongitude: number;

    public constructor(init?: Partial<LinkedWaypoint>) { (Object as any).assign(this, init); }
}

export class WaypointQuoteInformation extends LinkedWaypoint
{
    /** @description Distance between waypoints as a number */
    // @ApiMember(Description="Distance between waypoints as a number")
    public Distance: number;

    /** @description String formatted distance */
    // @ApiMember(Description="String formatted distance")
    public DistanceValue: string;

    public WaypointValid: boolean;
    public Message: string;
    public ErrorDetails: string[];
    /** @description Caculated price between waypoints excluding vat */
    // @ApiMember(Description="Caculated price between waypoints excluding vat")
    public Price: number;

    /** @description Price excluding vat formatted as a string rand value */
    // @ApiMember(Description="Price excluding vat formatted as a string rand value")
    public PriceValue: string;

    /** @description The price between waypoints including vat */
    // @ApiMember(Description="The price between waypoints including vat")
    public PriceWithVAT: number;

    /** @description The price including vat formatted as a rand value string */
    // @ApiMember(Description="The price including vat formatted as a rand value string")
    public PriceValueWithVAT: string;

    public constructor(init?: Partial<WaypointQuoteInformation>) { super(init); (Object as any).assign(this, init); }
}

export class WaypointValidationInformation
{
    public WaypointNumber: number;
    public IsValid: boolean;
    public ErrorMessages: string[];

    public constructor(init?: Partial<WaypointValidationInformation>) { (Object as any).assign(this, init); }
}

export class PlaceOrderResponse extends ApiServiceResponse
{
    /** @description The ID of the order. */
    // @ApiMember(Description="The ID of the order.")
    public OrderId: string;

    /** @description Were there any validation issues for any waypoints */
    // @ApiMember(Description="Were there any validation issues for any waypoints")
    public WaypointIssue: boolean;

    /** @description The total distance for the order */
    // @ApiMember(Description="The total distance for the order")
    public TotalDistance: number;

    /** @description The total distance for the order, formatted as a string */
    // @ApiMember(Description="The total distance for the order, formatted as a string")
    public TotalDistanceValue: string;

    /** @description 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 ScheduledDate: string;

    /** @description The subtotal of the order before VAT */
    // @ApiMember(Description="The subtotal of the order before VAT")
    public SubTotal: string;

    /** @description The total of the order after VAT */
    // @ApiMember(Description="The total of the order after VAT")
    public FinalPrice: string;

    /** @description The amount of VAT  */
    // @ApiMember(Description="The amount of VAT ")
    public VATValue: string;

    /** @description 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")
    public SchedulingNotice: string;

    /** @description 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")
    public SchedulingError: string;

    /** @description User friendly waybill number */
    // @ApiMember(Description="User friendly waybill number")
    public WayBill: string;

    /** @description List of order information for pricing etc between each waypoint */
    // @ApiMember(Description="List of order information for pricing etc between each waypoint")
    public Waypoints: WaypointQuoteInformation[];

    /** @description List with validation information for each waypoint */
    // @ApiMember(Description="List with validation information for each waypoint")
    public WaypointValidations: WaypointValidationInformation[];

    public constructor(init?: Partial<PlaceOrderResponse>) { super(init); (Object as any).assign(this, init); }
}

export class RequestQuoteWaypoint implements IRequestWaypoint
{
    /** @description Number of waypoint for ordering */
    // @ApiMember(Description="Number of waypoint for ordering", IsRequired=true)
    public WaypointNumber: number;

    /** @description Waypoint Latitude */
    // @ApiMember(Description="Waypoint Latitude", IsRequired=true)
    public Latitude: number;

    /** @description Waypoint Longitude */
    // @ApiMember(Description="Waypoint Longitude", IsRequired=true)
    public Longitude: number;

    /** @description Name of contact person at waypoint */
    // @ApiMember(Description="Name of contact person at waypoint", IsRequired=true)
    public ContactName: string;

    /** @description Telephone number of contact person at waypoint */
    // @ApiMember(Description="Telephone number of contact person at waypoint", IsRequired=true)
    public ContactNumber: string;

    /** @description Instructions for driver to follow at waypoint */
    // @ApiMember(Description="Instructions for driver to follow at waypoint", IsRequired=true)
    public DeliveryInstructions: string;

    /** @description Waypoint address */
    // @ApiMember(Description="Waypoint address", IsRequired=true)
    public Address: string;

    public constructor(init?: Partial<RequestQuoteWaypoint>) { (Object as any).assign(this, init); }
}

export enum ScheduleType
{
    NextAvailable = 0,
    SpecificTime = 1,
}

export class PlaceOrder extends ApiServiceRequest implements ILogRequest
{
    /** @description Optionally provide your own reference identifier */
    // @ApiMember(Description="Optionally provide your own reference identifier")
    public ClientReference: string;

    /** @description Optionally provide a reference for the customer/business */
    // @ApiMember(Description="Optionally provide a reference for the customer/business")
    public CustomerReference: string;

    /** @description Array of waypoints */
    // @ApiMember(Description="Array of waypoints", IsRequired=true)
    public Waypoints: RequestQuoteWaypoint[];

    /** @description Is this a scheduled order? */
    // @ApiMember(Description="Is this a scheduled order?", IsRequired=true)
    public IsScheduled: boolean;

    /** @description Specify the scheduling type, required if IsScheduled is true */
    // @ApiMember(Description="Specify the scheduling type, required if IsScheduled is true")
    public ScheduleType: ScheduleType;

    /** @description 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")
    public ScheduledDate: string;

    /** @description 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)
    public Test: boolean;

    /** @description 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.")
    public IsUrgent: boolean;

    public constructor(init?: Partial<PlaceOrder>) { super(init); (Object as any).assign(this, init); }
}

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