| POST | /stock/{brand}/export | Export Stock Data |
|---|
import Foundation
import ServiceStack
public class ExportStock : StockRequest
{
/**
* Product Categories
*/
// @ApiMember(Description="Product Categories")
public var productCategories:[ProductCategory] = []
/**
* Export Request ID of the API Consumers
*/
// @ApiMember(Description="Export Request ID of the API Consumers", IsRequired=true)
public var downloadRequestId:String
required public init(){ super.init() }
private enum CodingKeys : String, CodingKey {
case productCategories
case downloadRequestId
}
required public init(from decoder: Decoder) throws {
try super.init(from: decoder)
let container = try decoder.container(keyedBy: CodingKeys.self)
productCategories = try container.decodeIfPresent([ProductCategory].self, forKey: .productCategories) ?? []
downloadRequestId = try container.decodeIfPresent(String.self, forKey: .downloadRequestId)
}
public override func encode(to encoder: Encoder) throws {
try super.encode(to: encoder)
var container = encoder.container(keyedBy: CodingKeys.self)
if productCategories.count > 0 { try container.encode(productCategories, forKey: .productCategories) }
if downloadRequestId != nil { try container.encode(downloadRequestId, forKey: .downloadRequestId) }
}
}
public class StockRequest : Codable
{
/**
* Brand
*/
// @ApiMember(Description="Brand", IsRequired=true)
public var brand:String
/**
* POS Legacy
*/
// @ApiMember(Description="POS Legacy")
public var posCodes:[String] = []
/**
* Article Codes
*/
// @ApiMember(Description="Article Codes")
public var articleCodes:[String] = []
/**
* Include Extra Info
*/
// @ApiMember(Description="Include Extra Info")
public var includeExtraInfo:Bool
/**
* Cluster Id
*/
// @ApiMember(Description="Cluster Id")
public var clusterIds:[String] = []
/**
* Include Consignment NotAuthorized POS
*/
// @ApiMember(Description="Include Consignment NotAuthorized POS")
public var includeConsignmentNotAuthorizedPOS:Bool
/**
* Include Retail Sales Price in the Output, by default: false
*/
// @ApiMember(Description="Include Retail Sales Price in the Output, by default: false")
public var includeRSP:Bool
/**
* In Stock Since date from
*/
// @ApiMember(Description="In Stock Since date from ")
public var dateFrom:Date?
/**
* In Stock Since date to
*/
// @ApiMember(Description="In Stock Since date to")
public var dateTo:Date?
/**
* Item type, 'standard' OR 'consigned'. By default, all are coming
*/
// @ApiMember(Description="Item type, 'standard' OR 'consigned'. By default, all are coming")
public var type:String
required public init(){}
}
public class ProductCategory : Codable
{
/**
* Brand Category ID
*/
// @ApiMember(Description="Brand Category ID")
public var brandCategoryId:String
/**
* Grand Category ID
*/
// @ApiMember(Description="Grand Category ID", IsRequired=true)
public var grandCategoryId:String
/**
* Master Category ID
*/
// @ApiMember(Description="Master Category ID")
public var masterCategoryId:String
/**
* Category ID
*/
// @ApiMember(Description="Category ID")
public var categoryId:String
/**
* Sub Category ID
*/
// @ApiMember(Description="Sub Category ID")
public var subCategoryId:String
required public init(){}
}
public class ExportStockResponse : Codable
{
/**
* Unique Identifier of the Export Request created
*/
// @ApiMember(Description="Unique Identifier of the Export Request created", IsRequired=true)
public var asyncTaskId: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.
POST /stock/{brand}/export HTTP/1.1
Host: dev-api-booster.richemont.com
Accept: application/xml
Content-Type: application/xml
Content-Length: length
<ExportStock xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Richemont.Booster2.PublicApi.Stock.ServiceModel">
<articleCodes xmlns:d2p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<d2p1:string>String</d2p1:string>
</articleCodes>
<brand>String</brand>
<clusterIds xmlns:d2p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<d2p1:string>String</d2p1:string>
</clusterIds>
<dateFrom>0001-01-01T00:00:00</dateFrom>
<dateTo>0001-01-01T00:00:00</dateTo>
<includeConsignmentNotAuthorizedPOS>false</includeConsignmentNotAuthorizedPOS>
<includeExtraInfo>false</includeExtraInfo>
<includeRSP>false</includeRSP>
<posCodes xmlns:d2p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<d2p1:string>String</d2p1:string>
</posCodes>
<type>String</type>
<downloadRequestId>String</downloadRequestId>
<productCategories>
<ProductCategory>
<brandCategoryId>String</brandCategoryId>
<categoryId>String</categoryId>
<grandCategoryId>String</grandCategoryId>
<masterCategoryId>String</masterCategoryId>
<subCategoryId>String</subCategoryId>
</ProductCategory>
</productCategories>
</ExportStock>
HTTP/1.1 200 OK Content-Type: application/xml Content-Length: length <ExportStockResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Richemont.Booster2.PublicApi.Stock.ServiceModel"> <asyncTaskId>00000000-0000-0000-0000-000000000000</asyncTaskId> </ExportStockResponse>