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

Namespace Global

    Namespace BusinessLogic.Entities

        Public Partial Class LinkedWaypoint
            Public Overridable Property FromWaypointNumber As Integer
            Public Overridable Property ToWaypointNumber As Integer
            Public Overridable Property FromLatitude As Double
            Public Overridable Property FromLongitude As Double
            Public Overridable Property ToLatitude As Double
            Public Overridable Property ToLongitude As Double
        End Class
    End Namespace

    Namespace WebService.ClientServiceModel

        Public Partial Class RequestQuote
            Inherits ApiServiceRequest
            Implements ILogRequest
            Public Sub New()
                Waypoints = New List(Of RequestQuoteWaypoint)
            End Sub

            '''<Summary>
            '''Array of waypoints
            '''</Summary>
            <ApiMember(Description:="Array of waypoints", IsRequired:=true)>
            Public Overridable Property Waypoints As List(Of RequestQuoteWaypoint)

            '''<Summary>
            '''Is this a scheduled order?
            '''</Summary>
            <ApiMember(Description:="Is this a scheduled order?", IsRequired:=true)>
            Public Overridable Property IsScheduled As Boolean

            '''<Summary>
            '''Specify the scheduling type, required if IsScheduled is true
            '''</Summary>
            <ApiMember(Description:="Specify the scheduling type, required if IsScheduled is true")>
            Public Overridable Property ScheduleType As ScheduleType

            '''<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 Overridable Property ScheduledDate As String

            '''<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 Overridable Property QuoteId As Guid

            '''<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 Overridable Property Test As Boolean
        End Class

        Public Partial Class RequestQuoteResponse
            Inherits ApiServiceResponse
            Public Sub New()
                Waypoints = New List(Of WaypointQuoteInformation)
                WaypointValidations = New List(Of WaypointValidationInformation)
            End Sub

            '''<Summary>
            '''Is there an issue for the waypoints details specified?
            '''</Summary>
            <ApiMember(Description:="Is there an issue for the waypoints details specified?")>
            Public Overridable Property WaypointIssue As Boolean

            '''<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 Overridable Property QuoteReady As Boolean

            '''<Summary>
            '''Is the quote expired?
            '''</Summary>
            <ApiMember(Description:="Is the quote expired?")>
            Public Overridable Property QuoteExpired As Boolean

            '''<Summary>
            '''The total distance for the quote
            '''</Summary>
            <ApiMember(Description:="The total distance for the quote")>
            Public Overridable Property TotalDistance As Double

            '''<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 Overridable Property TotalDistanceValue As String

            '''<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 Overridable Property ScheduledDate As String

            '''<Summary>
            '''The subtotal of the order before VAT
            '''</Summary>
            <ApiMember(Description:="The subtotal of the order before VAT")>
            Public Overridable Property SubTotal As String

            '''<Summary>
            '''The total of the order after VAT
            '''</Summary>
            <ApiMember(Description:="The total of the order after VAT")>
            Public Overridable Property FinalPrice As String

            '''<Summary>
            '''The amount of VAT 
            '''</Summary>
            <ApiMember(Description:="The amount of VAT ")>
            Public Overridable Property VATValue As String

            '''<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 Overridable Property SchedulingNotice As String

            '''<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 Overridable Property SchedulingError As String

            '''<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 Overridable Property QuoteId As Guid

            '''<Summary>
            '''User friendly waybill number
            '''</Summary>
            <ApiMember(Description:="User friendly waybill number")>
            Public Overridable Property WayBill As String

            '''<Summary>
            '''The date this order was created
            '''</Summary>
            <ApiMember(Description:="The date this order was created")>
            Public Overridable Property DateCreated As String

            '''<Summary>
            '''The date this quote was last changed
            '''</Summary>
            <ApiMember(Description:="The date this quote was last changed")>
            Public Overridable Property LastUpdated As String

            '''<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 Overridable Property Waypoints As List(Of WaypointQuoteInformation)

            '''<Summary>
            '''List with validation information for each waypoint
            '''</Summary>
            <ApiMember(Description:="List with validation information for each waypoint")>
            Public Overridable Property WaypointValidations As List(Of WaypointValidationInformation)
        End Class

        Public Partial Class RequestQuoteWaypoint
            Implements IRequestWaypoint
            '''<Summary>
            '''Number of waypoint for ordering
            '''</Summary>
            <ApiMember(Description:="Number of waypoint for ordering", IsRequired:=true)>
            Public Overridable Property WaypointNumber As Integer

            '''<Summary>
            '''Waypoint Latitude
            '''</Summary>
            <ApiMember(Description:="Waypoint Latitude", IsRequired:=true)>
            Public Overridable Property Latitude As Double

            '''<Summary>
            '''Waypoint Longitude
            '''</Summary>
            <ApiMember(Description:="Waypoint Longitude", IsRequired:=true)>
            Public Overridable Property Longitude As Double

            '''<Summary>
            '''Name of contact person at waypoint
            '''</Summary>
            <ApiMember(Description:="Name of contact person at waypoint", IsRequired:=true)>
            Public Overridable Property ContactName As String

            '''<Summary>
            '''Telephone number of contact person at waypoint
            '''</Summary>
            <ApiMember(Description:="Telephone number of contact person at waypoint", IsRequired:=true)>
            Public Overridable Property ContactNumber As String

            '''<Summary>
            '''Instructions for driver to follow at waypoint
            '''</Summary>
            <ApiMember(Description:="Instructions for driver to follow at waypoint", IsRequired:=true)>
            Public Overridable Property DeliveryInstructions As String

            '''<Summary>
            '''Waypoint address
            '''</Summary>
            <ApiMember(Description:="Waypoint address", IsRequired:=true)>
            Public Overridable Property Address As String
        End Class

        Public Enum ScheduleType
            NextAvailable = 0
            SpecificTime = 1
        End Enum

        Public Partial Class WaypointQuoteInformation
            Inherits LinkedWaypoint
            Public Sub New()
                ErrorDetails = New List(Of String)
            End Sub

            '''<Summary>
            '''Distance between waypoints as a number
            '''</Summary>
            <ApiMember(Description:="Distance between waypoints as a number")>
            Public Overridable Property Distance As Double

            '''<Summary>
            '''String formatted distance
            '''</Summary>
            <ApiMember(Description:="String formatted distance")>
            Public Overridable Property DistanceValue As String

            Public Overridable Property WaypointValid As Boolean
            Public Overridable Property Message As String
            Public Overridable Property ErrorDetails As List(Of String)
            '''<Summary>
            '''Caculated price between waypoints excluding vat
            '''</Summary>
            <ApiMember(Description:="Caculated price between waypoints excluding vat")>
            Public Overridable Property Price As Decimal

            '''<Summary>
            '''Price excluding vat formatted as a string rand value
            '''</Summary>
            <ApiMember(Description:="Price excluding vat formatted as a string rand value")>
            Public Overridable Property PriceValue As String

            '''<Summary>
            '''The price between waypoints including vat
            '''</Summary>
            <ApiMember(Description:="The price between waypoints including vat")>
            Public Overridable Property PriceWithVAT As Decimal

            '''<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 Overridable Property PriceValueWithVAT As String
        End Class

        Public Partial Class WaypointValidationInformation
            Public Sub New()
                ErrorMessages = New List(Of String)
            End Sub

            Public Overridable Property WaypointNumber As Integer
            Public Overridable Property IsValid As Boolean
            Public Overridable Property ErrorMessages As List(Of String)
        End Class
    End Namespace

    Namespace WebService.ClientServiceModel.Base

        Public Partial Class ApiServiceRequest
            Implements IServiceRequest
            Implements IHasApiKey
            '''<Summary>
            '''The API Key required for authentication
            '''</Summary>
            <ApiMember(DataType:="string", Description:="The API Key required for authentication", IsRequired:=true)>
            Public Overridable Property ApiKey As String
        End Class

        Public Partial Class ApiServiceResponse
            Implements IServiceResponse
            '''<Summary>
            '''Information about the response.
            '''</Summary>
            <ApiMember(Description:="Information about the response.", IsRequired:=true)>
            Public Overridable Property Description As String

            '''<Summary>
            '''Heading or summary of the response.
            '''</Summary>
            <ApiMember(Description:="Heading or summary of the response.", IsRequired:=true)>
            Public Overridable Property Heading As String

            '''<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 Overridable Property WasSuccessful As Boolean
        End Class
    End Namespace
End Namespace

VB.NET 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: api.1fetch.co.za 
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.)