| GET | /order | Get order information. | If you do not specify an OrderId, the results will be paged. |
|---|
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 enum OrderStatus
{
AwaitingPayment = 0,
ProcessingPayment = 1,
AwaitingDispatch = 2,
DriverDispatched = 3,
PackageEnRoute = 4,
Completed = 5,
Cancelled = 6,
DeliveryFailed = 7,
}
}
namespace WebService.ClientServiceModel
{
public partial class EventDetail
{
public virtual string Description { get; set; }
public virtual string Time { get; set; }
public virtual DateTime EventDateTime { get; set; }
}
public partial class Order
: ApiServiceRequest, ILogRequest
{
///<summary>
///The ID if getting specific order
///</summary>
[ApiMember(Description="The ID if getting specific order")]
public virtual string OrderId { get; set; }
///<summary>
///The amount of elements to offset the index by
///</summary>
[ApiMember(Description="The amount of elements to offset the index by")]
public virtual int Offset { get; set; }
///<summary>
///The number of elements to be returned, defaults to 10
///</summary>
[ApiMember(Description="The number of elements to be returned, defaults to 10")]
public virtual int Count { get; set; }
}
public partial class OrderDetail
{
public OrderDetail()
{
Waypoints = new List<OrderItemWaypoint>{};
TransitPoints = new List<OrderTransitPoint>{};
Events = new List<EventDetail>{};
}
///<summary>
///ID of quote attached to the order
///</summary>
[ApiMember(Description="ID of quote attached to the order")]
public virtual Guid QuoteId { get; set; }
///<summary>
///ID of order
///</summary>
[ApiMember(Description="ID of order")]
public virtual Guid OrderId { get; set; }
///<summary>
///User friendly order identifier
///</summary>
[ApiMember(Description="User friendly order identifier")]
public virtual string Waybill { get; set; }
///<summary>
///Invoice number for the order
///</summary>
[ApiMember(Description="Invoice number for the order")]
public virtual string InvoiceNumber { 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>
///Order status number
///</summary>
[ApiMember(Description="Order status number")]
public virtual OrderStatus OrderStatus { get; set; }
///<summary>
///String value of order status
///</summary>
[ApiMember(Description="String value of order status")]
public virtual string OrderStatusValue { get; set; }
///<summary>
///List of waypoints for this order
///</summary>
[ApiMember(Description="List of waypoints for this order")]
public virtual List<OrderItemWaypoint> Waypoints { get; set; }
///<summary>
///List of sections between waypoints
///</summary>
[ApiMember(Description="List of sections between waypoints")]
public virtual List<OrderTransitPoint> TransitPoints { get; set; }
///<summary>
///Order Final price including VAT
///</summary>
[ApiMember(Description="Order Final price including VAT")]
public virtual decimal FinalPrice { get; set; }
///<summary>
///Final price formatted as ZA currency
///</summary>
[ApiMember(Description="Final price formatted as ZA currency")]
public virtual string FinalPriceValue { get; set; }
///<summary>
///Total distance for the order in km
///</summary>
[ApiMember(Description="Total distance for the order in km")]
public virtual double TotalDistance { get; set; }
///<summary>
///Total distance for the order formatted as a string
///</summary>
[ApiMember(Description="Total distance for the order formatted as a string")]
public virtual string TotalDistanceValue { get; set; }
///<summary>
///Date order was placed
///</summary>
[ApiMember(Description="Date order was placed")]
public virtual string Date { get; set; }
///<summary>
///Google encoded maps polyline path for drawing route on a google map
///</summary>
[ApiMember(Description="Google encoded maps polyline path for drawing route on a google map")]
public virtual string EncodedPolyPath { get; set; }
///<summary>
///List of events as they occurred while the order was in progress
///</summary>
[ApiMember(Description="List of events as they occurred while the order was in progress")]
public virtual List<EventDetail> Events { get; set; }
}
public partial class OrderItemWaypoint
{
///<summary>
///Has the driver completed this waypoint
///</summary>
[ApiMember(Description="Has the driver completed this waypoint")]
public virtual bool Completed { get; set; }
public virtual double Latitude { get; set; }
public virtual double Longitude { get; set; }
public virtual string Address { get; set; }
public virtual string ContactName { get; set; }
public virtual string ContactNumber { get; set; }
public virtual string DeliveryInstructions { get; set; }
///<summary>
///Details captured at waypoint
///</summary>
[ApiMember(Description="Details captured at waypoint")]
public virtual ScanDetail ScanDetail { get; set; }
}
public partial class OrderResponse
: ApiServiceResponse
{
public OrderResponse()
{
OrderItems = new List<OrderDetail>{};
}
///<summary>
///List with order details, will only contain one item if requested with order id
///</summary>
[ApiMember(Description="List with order details, will only contain one item if requested with order id")]
public virtual List<OrderDetail> OrderItems { get; set; }
///<summary>
///Total number of items in order collection
///</summary>
[ApiMember(Description="Total number of items in order collection")]
public virtual int TotalCount { get; set; }
///<summary>
///Used to indicate if there are more items available
///</summary>
[ApiMember(Description="Used to indicate if there are more items available")]
public virtual bool LastPage { get; set; }
}
public partial class OrderTransitPoint
{
///<summary>
///Origin waypoint number
///</summary>
[ApiMember(Description="Origin waypoint number")]
public virtual int FromWaypointNumber { get; set; }
///<summary>
///Destination waypoint number
///</summary>
[ApiMember(Description="Destination waypoint number")]
public virtual int ToWaypointNumber { get; set; }
///<summary>
///Distance between waypoints
///</summary>
[ApiMember(Description="Distance between waypoints")]
public virtual double Distance { get; set; }
///<summary>
///Distance between waypoints rounded and converted to a string
///</summary>
[ApiMember(Description="Distance between waypoints rounded and converted to a string")]
public virtual string DistanceValue { get; set; }
///<summary>
///Price calculated between waypoints
///</summary>
[ApiMember(Description="Price calculated between waypoints")]
public virtual decimal Price { get; set; }
///<summary>
///Price calculated between waypoints formatted as ZA currency
///</summary>
[ApiMember(Description="Price calculated between waypoints formatted as ZA currency")]
public virtual string PriceValue { get; set; }
}
public partial class ScanDetail
{
public ScanDetail()
{
PhotoUrls = new List<string>{};
SignatureUrls = new List<string>{};
}
///<summary>
///List of URLs for images captured at the waypoint
///</summary>
[ApiMember(Description="List of URLs for images captured at the waypoint")]
public virtual List<string> PhotoUrls { get; set; }
///<summary>
///List of URLs for images of signatures captured at the waypoint
///</summary>
[ApiMember(Description="List of URLs for images of signatures captured at the waypoint")]
public virtual List<string> SignatureUrls { get; set; }
///<summary>
///Name of person the driver interacted with at the waypoint
///</summary>
[ApiMember(Description="Name of person the driver interacted with at the waypoint")]
public virtual string ReceivedBy { get; set; }
///<summary>
///The date the driver interacted with the person
///</summary>
[ApiMember(Description="The date the driver interacted with the person")]
public virtual string ReceivedDate { get; set; }
///<summary>
///Number of packages collected by the driver
///</summary>
[ApiMember(Description="Number of packages collected by the driver")]
public virtual int PackagesCollected { 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; }
}
}
To override the Content-type in your clients, use the HTTP Accept Header, append the .jsv suffix or ?format=jsv
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
GET /order HTTP/1.1 Host: api.1fetch.co.za Accept: text/jsv
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length
{
OrderItems:
[
{
QuoteId: 00000000-0000-0000-0000-000000000000,
OrderId: 00000000-0000-0000-0000-000000000000,
Waybill: String,
InvoiceNumber: String,
ScheduledDate: String,
OrderStatus: 0,
OrderStatusValue: String,
Waypoints:
[
{
}
],
TransitPoints:
[
{
}
],
FinalPrice: 0,
FinalPriceValue: String,
TotalDistance: 0,
TotalDistanceValue: String,
Date: String,
EncodedPolyPath: String,
Events:
[
{
}
]
}
],
TotalCount: 0,
LastPage: False,
Description: String,
Heading: String,
WasSuccessful: False
}