Northwind Web Services

<back to all web services

GetAllCustomers

Customers
The following routes are available for this service:
All Verbs/customers
import Foundation
import ServiceStack

public class GetAllCustomers : IGet, Codable
{
    required public init(){}
}

// @DataContract
public class CustomersResponse : Codable
{
    // @DataMember
    public var results:[Customer] = []

    // @DataMember
    public var responseStatus:ResponseStatus

    required public init(){}
}

// @DataContract
public class Customer : Codable
{
    // @DataMember
    public var id:String

    // @DataMember
    public var companyName:String

    // @DataMember
    public var contactName:String

    // @DataMember
    public var contactTitle:String

    // @DataMember
    public var address:String

    // @DataMember
    public var city:String

    // @DataMember
    public var region:String

    // @DataMember
    public var postalCode:String

    // @DataMember
    public var country:String

    // @DataMember
    public var phone:String

    // @DataMember
    public var fax:String

    required public init(){}
}


Swift GetAllCustomers DTOs

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

HTTP + OTHER

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

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

{}
HTTP/1.1 200 OK
Content-Type: text/x-vcard
Content-Length: length

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