GET | /invoices | ||
---|---|---|---|
GET | /invoices/{InvoiceId} |
// @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); }
}
export class Invoices
{
public invoiceId: number;
public customerId: number;
public invoiceDate: string;
public billingAddress: string;
public billingCity: string;
public billingState: string;
public billingCountry: string;
public billingPostalCode: string;
public total: number;
public constructor(init?: Partial<Invoices>) { (Object as any).assign(this, init); }
}
export class QueryInvoices extends QueryDb<Invoices> implements IGet
{
public invoiceId?: number;
public constructor(init?: Partial<QueryInvoices>) { super(init); (Object as any).assign(this, init); }
}
export class Todo
{
public id: number;
public text: string;
public isFinished: boolean;
public constructor(init?: Partial<Todo>) { (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: Todo[];
// @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.
GET /invoices HTTP/1.1 Host: blazor-gallery.servicestack.net Accept: text/jsv
HTTP/1.1 200 OK Content-Type: text/jsv Content-Length: length { offset: 0, total: 0, results: [ { invoiceId: 0, customerId: 0, invoiceDate: 0001-01-01, billingAddress: String, billingCity: String, billingState: String, billingCountry: String, billingPostalCode: String, total: 0 } ], meta: { String: String }, responseStatus: { errorCode: String, message: String, stackTrace: String, errors: [ { errorCode: String, fieldName: String, message: String, meta: { String: String } } ], meta: { String: String } } }