| Required role: | API |
| All Verbs | /api/Query/Product |
|---|
import Foundation
import ServiceStack
// @AutoQueryViewer(Description="", IconUrl="octicon:database", Title="Product")
public class FindProduct : QueryDb<ProductInstance>
{
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 ProductInstance : Codable
{
public var productId:Int?
public var group:String?
public var name:String?
public var Description:String?
public var price:Double?
public var vat:Double?
public var totalPrice:Double?
public var productType:Int?
public var deleted:Bool?
public var demo:Bool?
public var usageCount:Int?
public var stockLevel:Int?
public var reorderFlag:Int?
public var visibleOnline:Bool?
required public init(){}
}
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.
POST /api/Query/Product HTTP/1.1
Host: api.clubmanagercentral.com
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length
{
Skip: 0,
Take: 0,
OrderBy: String,
OrderByDesc: String,
Include: String,
Fields: String,
Meta:
{
String: String
}
}
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length
{
Offset: 0,
Total: 0,
Results:
[
{
ProductId: 0,
Group: String,
Name: String,
Description: String,
Price: 0,
VAT: 0,
TotalPrice: 0,
ProductType: 0,
Deleted: False,
Demo: False,
UsageCount: 0,
StockLevel: 0,
ReorderFlag: 0,
VisibleOnline: False
}
],
Meta:
{
String: String
},
ResponseStatus:
{
ErrorCode: String,
Message: String,
StackTrace: String,
Errors:
[
{
ErrorCode: String,
FieldName: String,
Message: String,
Meta:
{
String: String
}
}
],
Meta:
{
String: String
}
}
}