| POST | /order | Provide waypoints for a route and place an order. This will bill the order to your account. |
|---|
import java.math.*;
import java.util.*;
import net.servicestack.client.*;
public class dtos
{
public static class PlaceOrder extends ApiServiceRequest implements ILogRequest
{
/**
* Optionally provide your own reference identifier
*/
@ApiMember(Description="Optionally provide your own reference identifier")
public String ClientReference = null;
/**
* Optionally provide a reference for the customer/business
*/
@ApiMember(Description="Optionally provide a reference for the customer/business")
public String CustomerReference = null;
/**
* 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;
/**
* Set this to true to prevent creating an order and billing for it
*/
@ApiMember(Description="Set this to true to prevent creating an order and billing for it", IsRequired=true)
public Boolean Test = null;
/**
* Is your account allows Urgent Orders, you can use this flag to indicate when an Order is urgent.
*/
@ApiMember(Description="Is your account allows Urgent Orders, you can use this flag to indicate when an Order is urgent.")
public Boolean IsUrgent = null;
public String getClientReference() { return ClientReference; }
public PlaceOrder setClientReference(String value) { this.ClientReference = value; return this; }
public String getCustomerReference() { return CustomerReference; }
public PlaceOrder setCustomerReference(String value) { this.CustomerReference = value; return this; }
public ArrayList<RequestQuoteWaypoint> getWaypoints() { return Waypoints; }
public PlaceOrder setWaypoints(ArrayList<RequestQuoteWaypoint> value) { this.Waypoints = value; return this; }
public Boolean getIsScheduled() { return IsScheduled; }
public PlaceOrder setIsScheduled(Boolean value) { this.IsScheduled = value; return this; }
public ScheduleType getScheduleType() { return ScheduleType; }
public PlaceOrder setScheduleType(ScheduleType value) { this.ScheduleType = value; return this; }
public String getScheduledDate() { return ScheduledDate; }
public PlaceOrder setScheduledDate(String value) { this.ScheduledDate = value; return this; }
public Boolean isTest() { return Test; }
public PlaceOrder setTest(Boolean value) { this.Test = value; return this; }
public Boolean getIsUrgent() { return IsUrgent; }
public PlaceOrder setIsUrgent(Boolean value) { this.IsUrgent = 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 PlaceOrderResponse extends ApiServiceResponse
{
/**
* The ID of the order.
*/
@ApiMember(Description="The ID of the order.")
public UUID OrderId = null;
/**
* Were there any validation issues for any waypoints
*/
@ApiMember(Description="Were there any validation issues for any waypoints")
public Boolean WaypointIssue = null;
/**
* The total distance for the order
*/
@ApiMember(Description="The total distance for the order")
public Double TotalDistance = null;
/**
* The total distance for the order, formatted as a string
*/
@ApiMember(Description="The total distance for the order, 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 a problem with a scheduled order
*/
@ApiMember(Description="Will contain a message if there a problem with a scheduled order")
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;
/**
* User friendly waybill number
*/
@ApiMember(Description="User friendly waybill number")
public String WayBill = null;
/**
* List of order information for pricing etc between each waypoint
*/
@ApiMember(Description="List of order 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 UUID getOrderId() { return OrderId; }
public PlaceOrderResponse setOrderId(UUID value) { this.OrderId = value; return this; }
public Boolean isWaypointIssue() { return WaypointIssue; }
public PlaceOrderResponse setWaypointIssue(Boolean value) { this.WaypointIssue = value; return this; }
public Double getTotalDistance() { return TotalDistance; }
public PlaceOrderResponse setTotalDistance(Double value) { this.TotalDistance = value; return this; }
public String getTotalDistanceValue() { return TotalDistanceValue; }
public PlaceOrderResponse setTotalDistanceValue(String value) { this.TotalDistanceValue = value; return this; }
public String getScheduledDate() { return ScheduledDate; }
public PlaceOrderResponse setScheduledDate(String value) { this.ScheduledDate = value; return this; }
public String getSubTotal() { return SubTotal; }
public PlaceOrderResponse setSubTotal(String value) { this.SubTotal = value; return this; }
public String getFinalPrice() { return FinalPrice; }
public PlaceOrderResponse setFinalPrice(String value) { this.FinalPrice = value; return this; }
public String getVatValue() { return VATValue; }
public PlaceOrderResponse setVatValue(String value) { this.VATValue = value; return this; }
public String getSchedulingNotice() { return SchedulingNotice; }
public PlaceOrderResponse setSchedulingNotice(String value) { this.SchedulingNotice = value; return this; }
public String getSchedulingError() { return SchedulingError; }
public PlaceOrderResponse setSchedulingError(String value) { this.SchedulingError = value; return this; }
public String getWayBill() { return WayBill; }
public PlaceOrderResponse setWayBill(String value) { this.WayBill = value; return this; }
public ArrayList<WaypointQuoteInformation> getWaypoints() { return Waypoints; }
public PlaceOrderResponse setWaypoints(ArrayList<WaypointQuoteInformation> value) { this.Waypoints = value; return this; }
public ArrayList<WaypointValidationInformation> getWaypointValidations() { return WaypointValidations; }
public PlaceOrderResponse 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 /order HTTP/1.1
Host: 1fetch.api.client.prod.86degrees.com
Accept: text/jsonl
Content-Type: text/jsonl
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: text/jsonl
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}