| All Verbs | /api/suburbs |
|---|
import Foundation
import ServiceStack
/**
* Get all suburbs for the specified country, state and/or postcode
*/
// @Api(Description="Get all suburbs for the specified country, state and/or postcode")
public class GetSuburbs : Codable
{
/**
* Get suburbs matching the specified search text criteria.
*/
// @ApiMember(Description="Get suburbs matching the specified search text criteria.", Name="SearchText")
public var searchText:String
/**
* State to get suburbs for
*/
// @ApiMember(Description="State to get suburbs for", Name="StateName")
public var stateName:String
/**
* Postcode to get suburbs for
*/
// @ApiMember(Description="Postcode to get suburbs for", Name="Postcode")
public var postCode:String
/**
* Country to get suburbs for
*/
// @ApiMember(Description="Country to get suburbs for", Name="CountryId")
public var countryId:String
/**
* Country to get suburbs for
*/
// @ApiMember(Description="Country to get suburbs for", Name="CountryName")
public var countryName:String
required public init(){}
}
// @ApiResponse(Description="List of suburbs matching the criteria")
public class GetSuburbsResponse : Codable
{
public var suburbs:[SuburbModel]
public var responseStatus:ResponseStatus
required public init(){}
}
public class SuburbModel : Codable
{
public var suburbId:String
public var name:String
public var stateId:String
public var stateName:String
public var postCode:String
public var countryId:String
public var countryName:String
required public 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.
POST /api/suburbs HTTP/1.1
Host: pfapi.pstpf.com.au
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length
{
SearchText: String,
StateName: String,
PostCode: String,
CountryName: String
}
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length
{
Suburbs:
[
{
Name: String,
StateName: String,
PostCode: String,
CountryName: String
}
],
ResponseStatus:
{
ErrorCode: String,
Message: String,
StackTrace: String,
Errors:
[
{
ErrorCode: String,
FieldName: String,
Message: String,
Meta:
{
String: String
}
}
],
Meta:
{
String: String
}
}
}