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.
using System;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.Serialization;
using ServiceStack;
using ServiceStack.DataAnnotations;
using WebService.ClientServiceModel;
using WebService.ClientServiceModel.Base;
using BusinessLogic.Entities;

namespace BusinessLogic.Entities
{
    public partial class LinkedWaypoint
    {
        public virtual int FromWaypointNumber { get; set; }
        public virtual int ToWaypointNumber { get; set; }
        public virtual double FromLatitude { get; set; }
        public virtual double FromLongitude { get; set; }
        public virtual double ToLatitude { get; set; }
        public virtual double ToLongitude { get; set; }
    }

}

namespace WebService.ClientServiceModel
{
    public partial class PlaceOrder
        : ApiServiceRequest, ILogRequest
    {
        public PlaceOrder()
        {
            Waypoints = new List<RequestQuoteWaypoint>{};
        }

        ///<summary>
        ///Optionally provide your own reference identifier
        ///</summary>
        [ApiMember(Description="Optionally provide your own reference identifier")]
        public virtual string ClientReference { get; set; }

        ///<summary>
        ///Optionally provide a reference for the customer/business
        ///</summary>
        [ApiMember(Description="Optionally provide a reference for the customer/business")]
        public virtual string CustomerReference { get; set; }

        ///<summary>
        ///Array of waypoints
        ///</summary>
        [ApiMember(Description="Array of waypoints", IsRequired=true)]
        public virtual List<RequestQuoteWaypoint> Waypoints { get; set; }

        ///<summary>
        ///Is this a scheduled order?
        ///</summary>
        [ApiMember(Description="Is this a scheduled order?", IsRequired=true)]
        public virtual bool IsScheduled { get; set; }

        ///<summary>
        ///Specify the scheduling type, required if IsScheduled is true
        ///</summary>
        [ApiMember(Description="Specify the scheduling type, required if IsScheduled is true")]
        public virtual ScheduleType ScheduleType { get; set; }

        ///<summary>
        ///Specify the scheduled date for this delivery in ISO 8601 string format, required if IsScheduled is true and ScheduleType is SpecificTime
        ///</summary>
        [ApiMember(Description="Specify the scheduled date for this delivery in ISO 8601 string format, required if IsScheduled is true and ScheduleType is SpecificTime")]
        public virtual string ScheduledDate { get; set; }

        ///<summary>
        ///Set this to true to prevent creating an order and billing for it
        ///</summary>
        [ApiMember(Description="Set this to true to prevent creating an order and billing for it", IsRequired=true)]
        public virtual bool Test { get; set; }

        ///<summary>
        ///Is your account allows Urgent Orders, you can use this flag to indicate when an Order is urgent.
        ///</summary>
        [ApiMember(Description="Is your account allows Urgent Orders, you can use this flag to indicate when an Order is urgent.")]
        public virtual bool IsUrgent { get; set; }
    }

    public partial class PlaceOrderResponse
        : ApiServiceResponse
    {
        public PlaceOrderResponse()
        {
            Waypoints = new List<WaypointQuoteInformation>{};
            WaypointValidations = new List<WaypointValidationInformation>{};
        }

        ///<summary>
        ///The ID of the order.
        ///</summary>
        [ApiMember(Description="The ID of the order.")]
        public virtual Guid OrderId { get; set; }

        ///<summary>
        ///Were there any validation issues for any waypoints
        ///</summary>
        [ApiMember(Description="Were there any validation issues for any waypoints")]
        public virtual bool WaypointIssue { get; set; }

        ///<summary>
        ///The total distance for the order
        ///</summary>
        [ApiMember(Description="The total distance for the order")]
        public virtual double TotalDistance { get; set; }

        ///<summary>
        ///The total distance for the order, formatted as a string
        ///</summary>
        [ApiMember(Description="The total distance for the order, formatted as a string")]
        public virtual string TotalDistanceValue { get; set; }

        ///<summary>
        ///The date and time the order is scheduled for in ISO 8601 string format, will be set if IsScheduled is true
        ///</summary>
        [ApiMember(Description="The date and time the order is scheduled for in ISO 8601 string format, will be set if IsScheduled is true")]
        public virtual string ScheduledDate { get; set; }

        ///<summary>
        ///The subtotal of the order before VAT
        ///</summary>
        [ApiMember(Description="The subtotal of the order before VAT")]
        public virtual string SubTotal { get; set; }

        ///<summary>
        ///The total of the order after VAT
        ///</summary>
        [ApiMember(Description="The total of the order after VAT")]
        public virtual string FinalPrice { get; set; }

        ///<summary>
        ///The amount of VAT 
        ///</summary>
        [ApiMember(Description="The amount of VAT ")]
        public virtual string VATValue { get; set; }

        ///<summary>
        ///Will contain a message if there a problem with a scheduled order
        ///</summary>
        [ApiMember(Description="Will contain a message if there a problem with a scheduled order")]
        public virtual string SchedulingNotice { get; set; }

        ///<summary>
        ///Will contain a message if there is a problem with a scheduled quote, if the order is scheduled to soon to opening times
        ///</summary>
        [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 virtual string SchedulingError { get; set; }

        ///<summary>
        ///User friendly waybill number
        ///</summary>
        [ApiMember(Description="User friendly waybill number")]
        public virtual string WayBill { get; set; }

        ///<summary>
        ///List of order information for pricing etc between each waypoint
        ///</summary>
        [ApiMember(Description="List of order information for pricing etc between each waypoint")]
        public virtual List<WaypointQuoteInformation> Waypoints { get; set; }

        ///<summary>
        ///List with validation information for each waypoint
        ///</summary>
        [ApiMember(Description="List with validation information for each waypoint")]
        public virtual List<WaypointValidationInformation> WaypointValidations { get; set; }
    }

    public partial class RequestQuoteWaypoint
        : IRequestWaypoint
    {
        ///<summary>
        ///Number of waypoint for ordering
        ///</summary>
        [ApiMember(Description="Number of waypoint for ordering", IsRequired=true)]
        public virtual int WaypointNumber { get; set; }

        ///<summary>
        ///Waypoint Latitude
        ///</summary>
        [ApiMember(Description="Waypoint Latitude", IsRequired=true)]
        public virtual double Latitude { get; set; }

        ///<summary>
        ///Waypoint Longitude
        ///</summary>
        [ApiMember(Description="Waypoint Longitude", IsRequired=true)]
        public virtual double Longitude { get; set; }

        ///<summary>
        ///Name of contact person at waypoint
        ///</summary>
        [ApiMember(Description="Name of contact person at waypoint", IsRequired=true)]
        public virtual string ContactName { get; set; }

        ///<summary>
        ///Telephone number of contact person at waypoint
        ///</summary>
        [ApiMember(Description="Telephone number of contact person at waypoint", IsRequired=true)]
        public virtual string ContactNumber { get; set; }

        ///<summary>
        ///Instructions for driver to follow at waypoint
        ///</summary>
        [ApiMember(Description="Instructions for driver to follow at waypoint", IsRequired=true)]
        public virtual string DeliveryInstructions { get; set; }

        ///<summary>
        ///Waypoint address
        ///</summary>
        [ApiMember(Description="Waypoint address", IsRequired=true)]
        public virtual string Address { get; set; }
    }

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

    public partial class WaypointQuoteInformation
        : LinkedWaypoint
    {
        public WaypointQuoteInformation()
        {
            ErrorDetails = new List<string>{};
        }

        ///<summary>
        ///Distance between waypoints as a number
        ///</summary>
        [ApiMember(Description="Distance between waypoints as a number")]
        public virtual double Distance { get; set; }

        ///<summary>
        ///String formatted distance
        ///</summary>
        [ApiMember(Description="String formatted distance")]
        public virtual string DistanceValue { get; set; }

        public virtual bool WaypointValid { get; set; }
        public virtual string Message { get; set; }
        public virtual List<string> ErrorDetails { get; set; }
        ///<summary>
        ///Caculated price between waypoints excluding vat
        ///</summary>
        [ApiMember(Description="Caculated price between waypoints excluding vat")]
        public virtual decimal Price { get; set; }

        ///<summary>
        ///Price excluding vat formatted as a string rand value
        ///</summary>
        [ApiMember(Description="Price excluding vat formatted as a string rand value")]
        public virtual string PriceValue { get; set; }

        ///<summary>
        ///The price between waypoints including vat
        ///</summary>
        [ApiMember(Description="The price between waypoints including vat")]
        public virtual decimal PriceWithVAT { get; set; }

        ///<summary>
        ///The price including vat formatted as a rand value string
        ///</summary>
        [ApiMember(Description="The price including vat formatted as a rand value string")]
        public virtual string PriceValueWithVAT { get; set; }
    }

    public partial class WaypointValidationInformation
    {
        public WaypointValidationInformation()
        {
            ErrorMessages = new List<string>{};
        }

        public virtual int WaypointNumber { get; set; }
        public virtual bool IsValid { get; set; }
        public virtual List<string> ErrorMessages { get; set; }
    }

}

namespace WebService.ClientServiceModel.Base
{
    public partial class ApiServiceRequest
        : IServiceRequest, IHasApiKey
    {
        ///<summary>
        ///The API Key required for authentication
        ///</summary>
        [ApiMember(DataType="string", Description="The API Key required for authentication", IsRequired=true)]
        public virtual string ApiKey { get; set; }
    }

    public partial class ApiServiceResponse
        : IServiceResponse
    {
        ///<summary>
        ///Information about the response.
        ///</summary>
        [ApiMember(Description="Information about the response.", IsRequired=true)]
        public virtual string Description { get; set; }

        ///<summary>
        ///Heading or summary of the response.
        ///</summary>
        [ApiMember(Description="Heading or summary of the response.", IsRequired=true)]
        public virtual string Heading { get; set; }

        ///<summary>
        ///Did the intended operation for this response complete successfully?
        ///</summary>
        [ApiMember(DataType="boolean", Description="Did the intended operation for this response complete successfully?", IsRequired=true)]
        public virtual bool WasSuccessful { get; set; }
    }

}

C# 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}