All Verbs | /query/orders |
---|
// @DataContract
export class QueryBase
{
// @DataMember(Order=1)
public skip?: number;
// @DataMember(Order=2)
public take?: number;
// @DataMember(Order=3)
public orderBy: string;
// @DataMember(Order=4)
public orderByDesc: string;
// @DataMember(Order=5)
public include: string;
// @DataMember(Order=6)
public fields: string;
// @DataMember(Order=7)
public meta: { [index:string]: string; };
public constructor(init?: Partial<QueryBase>) { (Object as any).assign(this, init); }
}
export class QueryDb<T> extends QueryBase
{
public constructor(init?: Partial<QueryDb<T>>) { super(init); (Object as any).assign(this, init); }
}
// @DataContract
export class Order
{
// @DataMember
public id: number;
// @DataMember
public customerId: string;
// @DataMember
public employeeId: number;
// @DataMember
public orderDate?: string;
// @DataMember
public requiredDate?: string;
// @DataMember
public shippedDate?: string;
// @DataMember
public shipVia?: number;
// @DataMember
public freight: number;
// @DataMember
public shipName: string;
// @DataMember
public shipAddress: string;
// @DataMember
public shipCity: string;
// @DataMember
public shipRegion: string;
// @DataMember
public shipPostalCode: string;
// @DataMember
public shipCountry: string;
public constructor(init?: Partial<Order>) { (Object as any).assign(this, init); }
}
export class QueryOrders extends QueryDb<Order>
{
public freight?: number;
public constructor(init?: Partial<QueryOrders>) { super(init); (Object as any).assign(this, init); }
}
// @DataContract
export class Customer
{
// @DataMember
public id: string;
// @DataMember
public companyName: string;
// @DataMember
public contactName: string;
// @DataMember
public contactTitle: string;
// @DataMember
public address: string;
// @DataMember
public city: string;
// @DataMember
public region: string;
// @DataMember
public postalCode: string;
// @DataMember
public country: string;
// @DataMember
public phone: string;
// @DataMember
public fax: string;
public constructor(init?: Partial<Customer>) { (Object as any).assign(this, init); }
}
// @DataContract
export class QueryResponse<T>
{
// @DataMember(Order=1)
public offset: number;
// @DataMember(Order=2)
public total: number;
// @DataMember(Order=3)
public results: Customer[];
// @DataMember(Order=4)
public meta: { [index:string]: string; };
// @DataMember(Order=5)
public responseStatus: ResponseStatus;
public constructor(init?: Partial<QueryResponse<T>>) { (Object as any).assign(this, 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 /query/orders HTTP/1.1
Host: northwind.netcore.io
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length
{
freight: 0,
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: [ { id: 0, customerId: String, employeeId: 0, orderDate: 0001-01-01, requiredDate: 0001-01-01, shippedDate: 0001-01-01, shipVia: 0, freight: 0, shipName: String, shipAddress: String, shipCity: String, shipRegion: String, shipPostalCode: String, shipCountry: String } ], meta: { String: String }, responseStatus: { errorCode: String, message: String, stackTrace: String, errors: [ { errorCode: String, fieldName: String, message: String, meta: { String: String } } ], meta: { String: String } } }