Northwind Web Services

<back to all web services

CachedGetAllCustomers

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

public class CachedGetAllCustomers : 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 CachedGetAllCustomers DTOs

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

HTTP + JSV

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

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

{
	
}
HTTP/1.1 200 OK
Content-Type: text/jsv
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
		}
	}
}