| GET | /dealers/shipment/{ShipmentId} | Retrieves shipment based on it's ID. |
|---|
import Foundation
import ServiceStack
public class GetShipment : AuthenticatedRequest
{
/**
* Shipment ID to retrieve the status for.
*/
// @ApiMember(Description="Shipment ID to retrieve the status for.", IsRequired=true, ParameterType="path")
public var shipmentId:Int
required public init(){ super.init() }
private enum CodingKeys : String, CodingKey {
case shipmentId
}
required public init(from decoder: Decoder) throws {
try super.init(from: decoder)
let container = try decoder.container(keyedBy: CodingKeys.self)
shipmentId = try container.decodeIfPresent(Int.self, forKey: .shipmentId)
}
public override func encode(to encoder: Encoder) throws {
try super.encode(to: encoder)
var container = encoder.container(keyedBy: CodingKeys.self)
if shipmentId != nil { try container.encode(shipmentId, forKey: .shipmentId) }
}
}
public class AuthenticatedRequest : Codable
{
/**
* Session token received from successful authentication.
*/
// @ApiMember(Description="Session token received from successful authentication.", IsRequired=true, ParameterType="query")
public var sessionToken:String
required public init(){}
}
public class ShipmentResponse : OperationResult_1<ShipmentResult>
{
required public init(){ super.init() }
required public init(from decoder: Decoder) throws {
try super.init(from: decoder)
}
public override func encode(to encoder: Encoder) throws {
try super.encode(to: encoder)
}
}
public class OperationResult_1<T : Codable> : OperationResult
{
/**
* Result value
*/
// @ApiMember(Description="Result value", ParameterType="model")
public var result:PartResults
required public init(){ super.init() }
private enum CodingKeys : String, CodingKey {
case result
}
required public init(from decoder: Decoder) throws {
try super.init(from: decoder)
let container = try decoder.container(keyedBy: CodingKeys.self)
result = try container.decodeIfPresent(PartResults.self, forKey: .result)
}
public override func encode(to encoder: Encoder) throws {
try super.encode(to: encoder)
var container = encoder.container(keyedBy: CodingKeys.self)
if result != nil { try container.encode(result, forKey: .result) }
}
}
public class OperationResult : Codable
{
/**
* Specifies if the operation was successful.
*/
// @ApiMember(Description="Specifies if the operation was successful.", ParameterType="model")
public var isSuccessful:Bool
/**
* States error message in case of unsuccessful operation.
*/
// @ApiMember(Description="States error message in case of unsuccessful operation.", ParameterType="model")
public var errorMessage:String
required public init(){}
}
public class PartResults : Codable
{
/**
* Total number of parts available.
*/
// @ApiMember(Description="Total number of parts available.")
public var totalNumberOfParts:Int
/**
* Indication if there are more parts to retrieve.
*/
// @ApiMember(Description="Indication if there are more parts to retrieve.")
public var hasMoreRecords:Bool
/**
* Part records.
*/
// @ApiMember(Description="Part records.")
public var parts:[PartInfoResult]
required public init(){}
}
public class PartInfoResult : Codable
{
/**
* Unique ID for the part.
*/
// @ApiMember(Description="Unique ID for the part.")
public var id:Int
/**
* Part number.
*/
// @ApiMember(Description="Part number.")
public var partNumber:String
/**
* Description of the part.
*/
// @ApiMember(Description="Description of the part.")
public var Description:String
/**
* Part manufacturer.
*/
// @ApiMember(Description="Part manufacturer.")
public var manufacturer:String
/**
* Determines if the part can be ordered.
*/
// @ApiMember(Description="Determines if the part can be ordered.")
public var canBeOrdered:Bool
/**
* Textual representation of the status of the part.
*/
// @ApiMember(Description="Textual representation of the status of the part.")
public var statusText:String
/**
* Available stock to order.
*/
// @ApiMember(Description="Available stock to order.")
public var availableStockQuantity:Int
/**
* Average days needed for delivery.
*/
// @ApiMember(Description="Average days needed for delivery.")
public var averageDeliveryInDays:Int?
/**
* Price of a single unit, excluding VAT.
*/
// @ApiMember(Description="Price of a single unit, excluding VAT.")
public var unitPrice:Double?
/**
* EAN number.
*/
// @ApiMember(Description="EAN number.")
public var eanNumber:String
/**
* Images
*/
// @ApiMember(Description="Images")
public var images:[PartInfoResultImage]
/**
* Secondary article numbers
*/
// @ApiMember(Description="Secondary article numbers")
public var secondaryArticleNumbers:[String]
/**
* Replacement article numbers
*/
// @ApiMember(Description="Replacement article numbers")
public var replacementArticleNumbers:[String]
/**
* Stock quantities
*/
// @ApiMember(Description="Stock quantities")
public var stockQuantities:[PartStockQuantity]
required public init(){}
}
public class PartInfoResultImage : Codable
{
/**
* Image number
*/
// @ApiMember(Description="Image number")
public var imageNumber:Int
/**
* Image URL
*/
// @ApiMember(Description="Image URL")
public var imageUrl:String
required public init(){}
}
public class PartStockQuantity : Codable
{
/**
* Location ID
*/
// @ApiMember(Description="Location ID")
public var locationId:Int
/**
* Location code
*/
// @ApiMember(Description="Location code")
public var locationCode:String
/**
* Stock quantity in location
*/
// @ApiMember(Description="Stock quantity in location")
public var stockQuantity:Int
required public init(){}
}
public class ShipmentResult : Codable
{
/**
* ID of the shipment.
*/
// @ApiMember(Description="ID of the shipment.")
public var shipmentId:Int
/**
* Determines of the shipment has been dispatched.
*/
// @ApiMember(Description="Determines of the shipment has been dispatched.")
public var hasBeenDispatched:Bool
/**
* Date/time of dispatch.
*/
// @ApiMember(Description="Date/time of dispatch.")
public var dispatchDate:Date?
/**
* List of articles in shipment.
*/
// @ApiMember(Description="List of articles in shipment.")
public var articles:[ShipmentArticleResult]
/**
* List of packages for shipment.
*/
// @ApiMember(Description="List of packages for shipment.")
public var packages:[ShipmentPackageResult]
required public init(){}
}
public class ShipmentArticleResult : Codable
{
/**
* Order number.
*/
// @ApiMember(Description="Order number.")
public var orderNumber:String
/**
* Article number.
*/
// @ApiMember(Description="Article number.")
public var articleNumber:String
/**
* Quantity.
*/
// @ApiMember(Description="Quantity.")
public var quantity:Int
/**
* Custom reference.
*/
// @ApiMember(Description="Custom reference.")
public var customReference:String
required public init(){}
}
public class ShipmentPackageResult : Codable
{
/**
* Shipment method.
*/
// @ApiMember(Description="Shipment method.")
public var shipmentMethod:String
/**
* Tracking number.
*/
// @ApiMember(Description="Tracking number.")
public var trackingNumber:String
/**
* Tracking URL.
*/
// @ApiMember(Description="Tracking URL.")
public var trackingUrl:String
required public init(){}
}
To override the Content-type in your clients, use the HTTP Accept Header, append the .xml suffix or ?format=xml
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
GET /dealers/shipment/{ShipmentId} HTTP/1.1
Host: services.acct.2service.nl
Accept: application/xml
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length
<ShipmentResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/_2Service.Webservices.ServiceModel.Dealers">
<ErrorMessage xmlns="http://schemas.datacontract.org/2004/07/_2Service.Webservices.ServiceModel">String</ErrorMessage>
<IsSuccessful xmlns="http://schemas.datacontract.org/2004/07/_2Service.Webservices.ServiceModel">false</IsSuccessful>
<Result xmlns:d2p1="http://schemas.datacontract.org/2004/07/_2Service.Webservices.ServiceModel.Dealers" xmlns="http://schemas.datacontract.org/2004/07/_2Service.Webservices.ServiceModel">
<d2p1:Articles>
<d2p1:ShipmentArticleResult>
<d2p1:ArticleNumber>String</d2p1:ArticleNumber>
<d2p1:CustomReference>String</d2p1:CustomReference>
<d2p1:OrderNumber>String</d2p1:OrderNumber>
<d2p1:Quantity>0</d2p1:Quantity>
</d2p1:ShipmentArticleResult>
</d2p1:Articles>
<d2p1:DispatchDate>0001-01-01T00:00:00</d2p1:DispatchDate>
<d2p1:HasBeenDispatched>false</d2p1:HasBeenDispatched>
<d2p1:Packages>
<d2p1:ShipmentPackageResult>
<d2p1:ShipmentMethod>String</d2p1:ShipmentMethod>
<d2p1:TrackingNumber>String</d2p1:TrackingNumber>
<d2p1:TrackingUrl>String</d2p1:TrackingUrl>
</d2p1:ShipmentPackageResult>
</d2p1:Packages>
<d2p1:ShipmentId>0</d2p1:ShipmentId>
</Result>
</ShipmentResponse>