Northwind Web Services

<back to all web services

QueryCustomers

AutoQuery
The following routes are available for this service:
All Verbs/query/customers

// @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 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); }
}

export class QueryCustomers extends QueryDb<Customer>
{
    public ids: string[];
    public countryStartsWith: string;

    public constructor(init?: Partial<QueryCustomers>) { super(init); (Object as any).assign(this, init); }
}

// @DataContract
export class QueryResponse<Customer>
{
    // @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<Customer>>) { (Object as any).assign(this, init); }
}

TypeScript QueryCustomers DTOs

To override the Content-type in your clients, use the HTTP Accept Header, append the .csv suffix or ?format=csv

HTTP + CSV

The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.

POST /query/customers HTTP/1.1 
Host: northwind.netcore.io 
Accept: text/csv
Content-Type: text/csv
Content-Length: length

{"ids":["String"],"countryStartsWith":"String","skip":0,"take":0,"orderBy":"String","orderByDesc":"String","include":"String","fields":"String","meta":{"String":"String"}}
HTTP/1.1 200 OK
Content-Type: text/csv
Content-Length: length

{"offset":0,"total":0,"results":[{"id":"String","companyName":"String","contactName":"String","contactTitle":"String","address":"String","city":"String","region":"String","postalCode":"String","country":"String","phone":"String","fax":"String"}],"meta":{"String":"String"},"responseStatus":{"errorCode":"String","message":"String","stackTrace":"String","errors":[{"errorCode":"String","fieldName":"String","message":"String","meta":{"String":"String"}}],"meta":{"String":"String"}}}