| POST | /quote | Provide waypoints for a route and return a quote. |
|---|
import java.math.*
import java.util.*
import net.servicestack.client.*
open class RequestQuote : ApiServiceRequest(), ILogRequest
{
/**
* Array of waypoints
*/
@ApiMember(Description="Array of waypoints", IsRequired=true)
var Waypoints:ArrayList<RequestQuoteWaypoint> = ArrayList<RequestQuoteWaypoint>()
/**
* Is this a scheduled order?
*/
@ApiMember(Description="Is this a scheduled order?", IsRequired=true)
var IsScheduled:Boolean? = null
/**
* Specify the scheduling type, required if IsScheduled is true
*/
@ApiMember(Description="Specify the scheduling type, required if IsScheduled is true")
var ScheduleType:ScheduleType? = null
/**
* 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")
var ScheduledDate:String? = null
/**
* Specify a quote Id to amend a quote. Required when amending an existing quote.
*/
@ApiMember(Description="Specify a quote Id to amend a quote. Required when amending an existing quote.")
var QuoteId:UUID? = null
/**
* Set this to true to prevent creating the quote
*/
@ApiMember(Description="Set this to true to prevent creating the quote", IsRequired=true)
var Test:Boolean? = null
}
open class ApiServiceRequest : IServiceRequest, IHasApiKey
{
/**
* The API Key required for authentication
*/
@ApiMember(DataType="string", Description="The API Key required for authentication", IsRequired=true)
var ApiKey:String? = null
}
open class RequestQuoteWaypoint : IRequestWaypoint
{
/**
* Number of waypoint for ordering
*/
@ApiMember(Description="Number of waypoint for ordering", IsRequired=true)
var WaypointNumber:Int? = null
/**
* Waypoint Latitude
*/
@ApiMember(Description="Waypoint Latitude", IsRequired=true)
var Latitude:Double? = null
/**
* Waypoint Longitude
*/
@ApiMember(Description="Waypoint Longitude", IsRequired=true)
var Longitude:Double? = null
/**
* Name of contact person at waypoint
*/
@ApiMember(Description="Name of contact person at waypoint", IsRequired=true)
var ContactName:String? = null
/**
* Telephone number of contact person at waypoint
*/
@ApiMember(Description="Telephone number of contact person at waypoint", IsRequired=true)
var ContactNumber:String? = null
/**
* Instructions for driver to follow at waypoint
*/
@ApiMember(Description="Instructions for driver to follow at waypoint", IsRequired=true)
var DeliveryInstructions:String? = null
/**
* Waypoint address
*/
@ApiMember(Description="Waypoint address", IsRequired=true)
var Address:String? = null
}
enum class ScheduleType(val value:Int)
{
@SerializedName("0") NextAvailable(0),
@SerializedName("1") SpecificTime(1),
}
open class RequestQuoteResponse : ApiServiceResponse()
{
/**
* Is there an issue for the waypoints details specified?
*/
@ApiMember(Description="Is there an issue for the waypoints details specified?")
var WaypointIssue:Boolean? = null
/**
* Is the quote created successfully and ready to be placed as an order?
*/
@ApiMember(Description="Is the quote created successfully and ready to be placed as an order?")
var QuoteReady:Boolean? = null
/**
* Is the quote expired?
*/
@ApiMember(Description="Is the quote expired?")
var QuoteExpired:Boolean? = null
/**
* The total distance for the quote
*/
@ApiMember(Description="The total distance for the quote")
var TotalDistance:Double? = null
/**
* The total distance for the quote, formatted as a string
*/
@ApiMember(Description="The total distance for the quote, formatted as a string")
var TotalDistanceValue:String? = null
/**
* 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")
var ScheduledDate:String? = null
/**
* The subtotal of the order before VAT
*/
@ApiMember(Description="The subtotal of the order before VAT")
var SubTotal:String? = null
/**
* The total of the order after VAT
*/
@ApiMember(Description="The total of the order after VAT")
var FinalPrice:String? = null
/**
* The amount of VAT
*/
@ApiMember(Description="The amount of VAT ")
var VATValue:String? = null
/**
* Will contain a message if there might be a problem with a scheduled quote
*/
@ApiMember(Description="Will contain a message if there might be a problem with a scheduled quote")
var SchedulingNotice:String? = null
/**
* 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")
var SchedulingError:String? = null
/**
* The ID of the generated quote, needed when you want to change this quote later
*/
@ApiMember(Description="The ID of the generated quote, needed when you want to change this quote later")
var QuoteId:UUID? = null
/**
* User friendly waybill number
*/
@ApiMember(Description="User friendly waybill number")
var WayBill:String? = null
/**
* The date this order was created
*/
@ApiMember(Description="The date this order was created")
var DateCreated:String? = null
/**
* The date this quote was last changed
*/
@ApiMember(Description="The date this quote was last changed")
var LastUpdated:String? = null
/**
* List of quote information for pricing etc between each waypoint
*/
@ApiMember(Description="List of quote information for pricing etc between each waypoint")
var Waypoints:ArrayList<WaypointQuoteInformation> = ArrayList<WaypointQuoteInformation>()
/**
* List with validation information for each waypoint
*/
@ApiMember(Description="List with validation information for each waypoint")
var WaypointValidations:ArrayList<WaypointValidationInformation> = ArrayList<WaypointValidationInformation>()
}
open class ApiServiceResponse : IServiceResponse
{
/**
* Information about the response.
*/
@ApiMember(Description="Information about the response.", IsRequired=true)
var Description:String? = null
/**
* Heading or summary of the response.
*/
@ApiMember(Description="Heading or summary of the response.", IsRequired=true)
var Heading:String? = null
/**
* Did the intended operation for this response complete successfully?
*/
@ApiMember(DataType="boolean", Description="Did the intended operation for this response complete successfully?", IsRequired=true)
var WasSuccessful:Boolean? = null
}
open class WaypointQuoteInformation : LinkedWaypoint()
{
/**
* Distance between waypoints as a number
*/
@ApiMember(Description="Distance between waypoints as a number")
var Distance:Double? = null
/**
* String formatted distance
*/
@ApiMember(Description="String formatted distance")
var DistanceValue:String? = null
var WaypointValid:Boolean? = null
var Message:String? = null
var ErrorDetails:ArrayList<String> = ArrayList<String>()
/**
* Caculated price between waypoints excluding vat
*/
@ApiMember(Description="Caculated price between waypoints excluding vat")
var Price:BigDecimal? = null
/**
* Price excluding vat formatted as a string rand value
*/
@ApiMember(Description="Price excluding vat formatted as a string rand value")
var PriceValue:String? = null
/**
* The price between waypoints including vat
*/
@ApiMember(Description="The price between waypoints including vat")
var PriceWithVAT:BigDecimal? = null
/**
* The price including vat formatted as a rand value string
*/
@ApiMember(Description="The price including vat formatted as a rand value string")
var PriceValueWithVAT:String? = null
}
open class LinkedWaypoint
{
var FromWaypointNumber:Int? = null
var ToWaypointNumber:Int? = null
var FromLatitude:Double? = null
var FromLongitude:Double? = null
var ToLatitude:Double? = null
var ToLongitude:Double? = null
}
open class WaypointValidationInformation
{
var WaypointNumber:Int? = null
var IsValid:Boolean? = null
var ErrorMessages:ArrayList<String> = ArrayList<String>()
}
To override the Content-type in your clients, use the HTTP Accept Header, append the .other suffix or ?format=other
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/jsonl
Content-Type: text/jsonl
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/jsonl
Content-Length: length
{Unable to show example output for type 'RequestQuoteResponse' using the custom 'other' filter}One or more errors occurred. (Object reference not set to an instance of an object.)