| POST | /quote | Provide waypoints for a route and return a quote. |
|---|
import java.math.*;
import java.util.*;
import net.servicestack.client.*;
public class dtos
{
public static class RequestQuote extends ApiServiceRequest implements ILogRequest
{
/**
* Array of waypoints
*/
@ApiMember(Description="Array of waypoints", IsRequired=true)
public ArrayList<RequestQuoteWaypoint> Waypoints = null;
/**
* Is this a scheduled order?
*/
@ApiMember(Description="Is this a scheduled order?", IsRequired=true)
public Boolean IsScheduled = null;
/**
* Specify the scheduling type, required if IsScheduled is true
*/
@ApiMember(Description="Specify the scheduling type, required if IsScheduled is true")
public 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")
public String ScheduledDate = 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.")
public UUID QuoteId = null;
/**
* Set this to true to prevent creating the quote
*/
@ApiMember(Description="Set this to true to prevent creating the quote", IsRequired=true)
public Boolean Test = null;
public ArrayList<RequestQuoteWaypoint> getWaypoints() { return Waypoints; }
public RequestQuote setWaypoints(ArrayList<RequestQuoteWaypoint> value) { this.Waypoints = value; return this; }
public Boolean getIsScheduled() { return IsScheduled; }
public RequestQuote setIsScheduled(Boolean value) { this.IsScheduled = value; return this; }
public ScheduleType getScheduleType() { return ScheduleType; }
public RequestQuote setScheduleType(ScheduleType value) { this.ScheduleType = value; return this; }
public String getScheduledDate() { return ScheduledDate; }
public RequestQuote setScheduledDate(String value) { this.ScheduledDate = value; return this; }
public UUID getQuoteId() { return QuoteId; }
public RequestQuote setQuoteId(UUID value) { this.QuoteId = value; return this; }
public Boolean isTest() { return Test; }
public RequestQuote setTest(Boolean value) { this.Test = value; return this; }
}
public static class ApiServiceRequest implements IServiceRequest, IHasApiKey
{
/**
* The API Key required for authentication
*/
@ApiMember(DataType="string", Description="The API Key required for authentication", IsRequired=true)
public String ApiKey = null;
public String getApiKey() { return ApiKey; }
public ApiServiceRequest setApiKey(String value) { this.ApiKey = value; return this; }
}
public static class RequestQuoteWaypoint implements IRequestWaypoint
{
/**
* Number of waypoint for ordering
*/
@ApiMember(Description="Number of waypoint for ordering", IsRequired=true)
public Integer WaypointNumber = null;
/**
* Waypoint Latitude
*/
@ApiMember(Description="Waypoint Latitude", IsRequired=true)
public Double Latitude = null;
/**
* Waypoint Longitude
*/
@ApiMember(Description="Waypoint Longitude", IsRequired=true)
public Double Longitude = null;
/**
* Name of contact person at waypoint
*/
@ApiMember(Description="Name of contact person at waypoint", IsRequired=true)
public String ContactName = null;
/**
* Telephone number of contact person at waypoint
*/
@ApiMember(Description="Telephone number of contact person at waypoint", IsRequired=true)
public String ContactNumber = null;
/**
* Instructions for driver to follow at waypoint
*/
@ApiMember(Description="Instructions for driver to follow at waypoint", IsRequired=true)
public String DeliveryInstructions = null;
/**
* Waypoint address
*/
@ApiMember(Description="Waypoint address", IsRequired=true)
public String Address = null;
public Integer getWaypointNumber() { return WaypointNumber; }
public RequestQuoteWaypoint setWaypointNumber(Integer value) { this.WaypointNumber = value; return this; }
public Double getLatitude() { return Latitude; }
public RequestQuoteWaypoint setLatitude(Double value) { this.Latitude = value; return this; }
public Double getLongitude() { return Longitude; }
public RequestQuoteWaypoint setLongitude(Double value) { this.Longitude = value; return this; }
public String getContactName() { return ContactName; }
public RequestQuoteWaypoint setContactName(String value) { this.ContactName = value; return this; }
public String getContactNumber() { return ContactNumber; }
public RequestQuoteWaypoint setContactNumber(String value) { this.ContactNumber = value; return this; }
public String getDeliveryInstructions() { return DeliveryInstructions; }
public RequestQuoteWaypoint setDeliveryInstructions(String value) { this.DeliveryInstructions = value; return this; }
public String getAddress() { return Address; }
public RequestQuoteWaypoint setAddress(String value) { this.Address = value; return this; }
}
public static enum ScheduleType
{
@SerializedName("0") NextAvailable(0),
@SerializedName("1") SpecificTime(1);
private final int value;
ScheduleType(final int intValue) { value = intValue; }
public int getValue() { return value; }
}
public static class RequestQuoteResponse extends ApiServiceResponse
{
/**
* Is there an issue for the waypoints details specified?
*/
@ApiMember(Description="Is there an issue for the waypoints details specified?")
public Boolean WaypointIssue = 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?")
public Boolean QuoteReady = null;
/**
* Is the quote expired?
*/
@ApiMember(Description="Is the quote expired?")
public Boolean QuoteExpired = null;
/**
* The total distance for the quote
*/
@ApiMember(Description="The total distance for the quote")
public Double TotalDistance = null;
/**
* The total distance for the quote, formatted as a string
*/
@ApiMember(Description="The total distance for the quote, formatted as a string")
public String TotalDistanceValue = 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")
public String ScheduledDate = null;
/**
* The subtotal of the order before VAT
*/
@ApiMember(Description="The subtotal of the order before VAT")
public String SubTotal = null;
/**
* The total of the order after VAT
*/
@ApiMember(Description="The total of the order after VAT")
public String FinalPrice = null;
/**
* The amount of VAT
*/
@ApiMember(Description="The amount of VAT ")
public String VATValue = 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")
public String SchedulingNotice = 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")
public String SchedulingError = 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")
public UUID QuoteId = null;
/**
* User friendly waybill number
*/
@ApiMember(Description="User friendly waybill number")
public String WayBill = null;
/**
* The date this order was created
*/
@ApiMember(Description="The date this order was created")
public String DateCreated = null;
/**
* The date this quote was last changed
*/
@ApiMember(Description="The date this quote was last changed")
public String LastUpdated = null;
/**
* List of quote information for pricing etc between each waypoint
*/
@ApiMember(Description="List of quote information for pricing etc between each waypoint")
public ArrayList<WaypointQuoteInformation> Waypoints = null;
/**
* List with validation information for each waypoint
*/
@ApiMember(Description="List with validation information for each waypoint")
public ArrayList<WaypointValidationInformation> WaypointValidations = null;
public Boolean isWaypointIssue() { return WaypointIssue; }
public RequestQuoteResponse setWaypointIssue(Boolean value) { this.WaypointIssue = value; return this; }
public Boolean isQuoteReady() { return QuoteReady; }
public RequestQuoteResponse setQuoteReady(Boolean value) { this.QuoteReady = value; return this; }
public Boolean isQuoteExpired() { return QuoteExpired; }
public RequestQuoteResponse setQuoteExpired(Boolean value) { this.QuoteExpired = value; return this; }
public Double getTotalDistance() { return TotalDistance; }
public RequestQuoteResponse setTotalDistance(Double value) { this.TotalDistance = value; return this; }
public String getTotalDistanceValue() { return TotalDistanceValue; }
public RequestQuoteResponse setTotalDistanceValue(String value) { this.TotalDistanceValue = value; return this; }
public String getScheduledDate() { return ScheduledDate; }
public RequestQuoteResponse setScheduledDate(String value) { this.ScheduledDate = value; return this; }
public String getSubTotal() { return SubTotal; }
public RequestQuoteResponse setSubTotal(String value) { this.SubTotal = value; return this; }
public String getFinalPrice() { return FinalPrice; }
public RequestQuoteResponse setFinalPrice(String value) { this.FinalPrice = value; return this; }
public String getVatValue() { return VATValue; }
public RequestQuoteResponse setVatValue(String value) { this.VATValue = value; return this; }
public String getSchedulingNotice() { return SchedulingNotice; }
public RequestQuoteResponse setSchedulingNotice(String value) { this.SchedulingNotice = value; return this; }
public String getSchedulingError() { return SchedulingError; }
public RequestQuoteResponse setSchedulingError(String value) { this.SchedulingError = value; return this; }
public UUID getQuoteId() { return QuoteId; }
public RequestQuoteResponse setQuoteId(UUID value) { this.QuoteId = value; return this; }
public String getWayBill() { return WayBill; }
public RequestQuoteResponse setWayBill(String value) { this.WayBill = value; return this; }
public String getDateCreated() { return DateCreated; }
public RequestQuoteResponse setDateCreated(String value) { this.DateCreated = value; return this; }
public String getLastUpdated() { return LastUpdated; }
public RequestQuoteResponse setLastUpdated(String value) { this.LastUpdated = value; return this; }
public ArrayList<WaypointQuoteInformation> getWaypoints() { return Waypoints; }
public RequestQuoteResponse setWaypoints(ArrayList<WaypointQuoteInformation> value) { this.Waypoints = value; return this; }
public ArrayList<WaypointValidationInformation> getWaypointValidations() { return WaypointValidations; }
public RequestQuoteResponse setWaypointValidations(ArrayList<WaypointValidationInformation> value) { this.WaypointValidations = value; return this; }
}
public static class ApiServiceResponse implements IServiceResponse
{
/**
* Information about the response.
*/
@ApiMember(Description="Information about the response.", IsRequired=true)
public String Description = null;
/**
* Heading or summary of the response.
*/
@ApiMember(Description="Heading or summary of the response.", IsRequired=true)
public String Heading = 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)
public Boolean WasSuccessful = null;
public String getDescription() { return Description; }
public ApiServiceResponse setDescription(String value) { this.Description = value; return this; }
public String getHeading() { return Heading; }
public ApiServiceResponse setHeading(String value) { this.Heading = value; return this; }
public Boolean isWasSuccessful() { return WasSuccessful; }
public ApiServiceResponse setWasSuccessful(Boolean value) { this.WasSuccessful = value; return this; }
}
public static class WaypointQuoteInformation extends LinkedWaypoint
{
/**
* Distance between waypoints as a number
*/
@ApiMember(Description="Distance between waypoints as a number")
public Double Distance = null;
/**
* String formatted distance
*/
@ApiMember(Description="String formatted distance")
public String DistanceValue = null;
public Boolean WaypointValid = null;
public String Message = null;
public ArrayList<String> ErrorDetails = null;
/**
* Caculated price between waypoints excluding vat
*/
@ApiMember(Description="Caculated price between waypoints excluding vat")
public BigDecimal Price = null;
/**
* Price excluding vat formatted as a string rand value
*/
@ApiMember(Description="Price excluding vat formatted as a string rand value")
public String PriceValue = null;
/**
* The price between waypoints including vat
*/
@ApiMember(Description="The price between waypoints including vat")
public BigDecimal PriceWithVAT = null;
/**
* The price including vat formatted as a rand value string
*/
@ApiMember(Description="The price including vat formatted as a rand value string")
public String PriceValueWithVAT = null;
public Double getDistance() { return Distance; }
public WaypointQuoteInformation setDistance(Double value) { this.Distance = value; return this; }
public String getDistanceValue() { return DistanceValue; }
public WaypointQuoteInformation setDistanceValue(String value) { this.DistanceValue = value; return this; }
public Boolean isWaypointValid() { return WaypointValid; }
public WaypointQuoteInformation setWaypointValid(Boolean value) { this.WaypointValid = value; return this; }
public String getMessage() { return Message; }
public WaypointQuoteInformation setMessage(String value) { this.Message = value; return this; }
public ArrayList<String> getErrorDetails() { return ErrorDetails; }
public WaypointQuoteInformation setErrorDetails(ArrayList<String> value) { this.ErrorDetails = value; return this; }
public BigDecimal getPrice() { return Price; }
public WaypointQuoteInformation setPrice(BigDecimal value) { this.Price = value; return this; }
public String getPriceValue() { return PriceValue; }
public WaypointQuoteInformation setPriceValue(String value) { this.PriceValue = value; return this; }
public BigDecimal getPriceWithVAT() { return PriceWithVAT; }
public WaypointQuoteInformation setPriceWithVAT(BigDecimal value) { this.PriceWithVAT = value; return this; }
public String getPriceValueWithVAT() { return PriceValueWithVAT; }
public WaypointQuoteInformation setPriceValueWithVAT(String value) { this.PriceValueWithVAT = value; return this; }
}
public static class LinkedWaypoint
{
public Integer FromWaypointNumber = null;
public Integer ToWaypointNumber = null;
public Double FromLatitude = null;
public Double FromLongitude = null;
public Double ToLatitude = null;
public Double ToLongitude = null;
public Integer getFromWaypointNumber() { return FromWaypointNumber; }
public LinkedWaypoint setFromWaypointNumber(Integer value) { this.FromWaypointNumber = value; return this; }
public Integer getToWaypointNumber() { return ToWaypointNumber; }
public LinkedWaypoint setToWaypointNumber(Integer value) { this.ToWaypointNumber = value; return this; }
public Double getFromLatitude() { return FromLatitude; }
public LinkedWaypoint setFromLatitude(Double value) { this.FromLatitude = value; return this; }
public Double getFromLongitude() { return FromLongitude; }
public LinkedWaypoint setFromLongitude(Double value) { this.FromLongitude = value; return this; }
public Double getToLatitude() { return ToLatitude; }
public LinkedWaypoint setToLatitude(Double value) { this.ToLatitude = value; return this; }
public Double getToLongitude() { return ToLongitude; }
public LinkedWaypoint setToLongitude(Double value) { this.ToLongitude = value; return this; }
}
public static class WaypointValidationInformation
{
public Integer WaypointNumber = null;
public Boolean IsValid = null;
public ArrayList<String> ErrorMessages = null;
public Integer getWaypointNumber() { return WaypointNumber; }
public WaypointValidationInformation setWaypointNumber(Integer value) { this.WaypointNumber = value; return this; }
public Boolean getIsValid() { return IsValid; }
public WaypointValidationInformation setIsValid(Boolean value) { this.IsValid = value; return this; }
public ArrayList<String> getErrorMessages() { return ErrorMessages; }
public WaypointValidationInformation setErrorMessages(ArrayList<String> value) { this.ErrorMessages = value; return this; }
}
}
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: 1fetch.api.client.prod.86degrees.com
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.)