| GET | /customers | ||
|---|---|---|---|
| GET | /customers/{CustomerId} |
// @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 Customers
{
public customerId: number;
// @Computed()
public displayName: string;
// @Required()
public firstName: string;
// @Required()
public lastName: string;
public supportRepId?: number;
public company: string;
public address: string;
public city: string;
public state: string;
public country: string;
public postalCode: string;
public phone: string;
public fax: string;
// @Required()
public email: string;
public constructor(init?: Partial<Customers>) { (Object as any).assign(this, init); }
}
export class QueryCustomers extends QueryDb<Customers> implements IGet
{
public customerId?: number;
public constructor(init?: Partial<QueryCustomers>) { super(init); (Object as any).assign(this, init); }
}
export class Albums
{
public albumId: number;
// @Required()
public title: string;
public artistId: number;
public constructor(init?: Partial<Albums>) { (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: Albums[];
// @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); }
}
TypeScript QueryCustomers DTOs
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 /customers HTTP/1.1 Host: chinook.netcore.io Accept: text/jsv
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length
{
offset: 0,
total: 0,
results:
[
{
customerId: 0,
displayName: String String,
firstName: String,
lastName: String,
supportRepId: 0,
company: String,
address: String,
city: String,
state: String,
country: String,
postalCode: String,
phone: String,
fax: String,
email: String
}
],
meta:
{
String: String
},
responseStatus:
{
errorCode: String,
message: String,
stackTrace: String,
errors:
[
{
errorCode: String,
fieldName: String,
message: String,
meta:
{
String: String
}
}
],
meta:
{
String: String
}
}
}