1Fetch Client API

<back to all web services

RequestQuote

The following routes are available for this service:
POST/quoteProvide waypoints for a route and return a quote.
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 RequestQuote
        : ApiServiceRequest, ILogRequest
    {
        public RequestQuote()
        {
            Waypoints = new List<RequestQuoteWaypoint>{};
        }

        ///<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>
        ///Specify a quote Id to amend a quote. Required when amending an existing quote.
        ///</summary>
        [ApiMember(Description="Specify a quote Id to amend a quote. Required when amending an existing quote.")]
        public virtual Guid QuoteId { get; set; }

        ///<summary>
        ///Set this to true to prevent creating the quote
        ///</summary>
        [ApiMember(Description="Set this to true to prevent creating the quote", IsRequired=true)]
        public virtual bool Test { get; set; }
    }

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

        ///<summary>
        ///Is there an issue for the waypoints details specified?
        ///</summary>
        [ApiMember(Description="Is there an issue for the waypoints details specified?")]
        public virtual bool WaypointIssue { get; set; }

        ///<summary>
        ///Is the quote created successfully and ready to be placed as an order?
        ///</summary>
        [ApiMember(Description="Is the quote created successfully and ready to be placed as an order?")]
        public virtual bool QuoteReady { get; set; }

        ///<summary>
        ///Is the quote expired?
        ///</summary>
        [ApiMember(Description="Is the quote expired?")]
        public virtual bool QuoteExpired { get; set; }

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

        ///<summary>
        ///The total distance for the quote, formatted as a string
        ///</summary>
        [ApiMember(Description="The total distance for the quote, 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 might be a problem with a scheduled quote
        ///</summary>
        [ApiMember(Description="Will contain a message if there might be a problem with a scheduled quote")]
        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>
        ///The ID of the generated quote, needed when you want to change this quote later
        ///</summary>
        [ApiMember(Description="The ID of the generated quote, needed when you want to change this quote later")]
        public virtual Guid QuoteId { get; set; }

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

        ///<summary>
        ///The date this order was created
        ///</summary>
        [ApiMember(Description="The date this order was created")]
        public virtual string DateCreated { get; set; }

        ///<summary>
        ///The date this quote was last changed
        ///</summary>
        [ApiMember(Description="The date this quote was last changed")]
        public virtual string LastUpdated { get; set; }

        ///<summary>
        ///List of quote information for pricing etc between each waypoint
        ///</summary>
        [ApiMember(Description="List of quote 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# RequestQuote 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.

POST /quote HTTP/1.1 
Host: 1fetch.api.client.prod.86degrees.com 
Accept: text/csv
Content-Type: text/csv
Content-Length: length

{"Waypoints":[{"WaypointNumber":0,"Latitude":0,"Longitude":0,"ContactName":"String","ContactNumber":"String","DeliveryInstructions":"String","Address":"String"}],"IsScheduled":false,"ScheduleType":0,"ScheduledDate":"String","QuoteId":"00000000-0000-0000-0000-000000000000","Test":false,"ApiKey":"String"}
HTTP/1.1 200 OK
Content-Type: text/csv
Content-Length: length

{Unable to show example output for type 'RequestQuoteResponse' using the custom 'csv' filter}One or more errors occurred. (Object reference not set to an instance of an object.)