Platform API

<back to all web services

GetSuburbs

Get all suburbs for the specified country, state and/or postcode

The following routes are available for this service:
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(){}
}


Swift GetSuburbs DTOs

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

To embed the response in a jsonp callback, append ?callback=myCallback

HTTP + JSON

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: application/json
Content-Type: application/json
Content-Length: length

{"SearchText":"String","StateName":"String","PostCode":"String","CountryId":"00000000-0000-0000-0000-000000000000","CountryName":"String"}
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: length

{"Suburbs":[{"SuburbId":"00000000-0000-0000-0000-000000000000","Name":"String","StateId":"00000000-0000-0000-0000-000000000000","StateName":"String","PostCode":"String","CountryId":"00000000-0000-0000-0000-000000000000","CountryName":"String"}],"ResponseStatus":{"ErrorCode":"String","Message":"String","StackTrace":"String","Errors":[{"ErrorCode":"String","FieldName":"String","Message":"String","Meta":{"String":"String"}}],"Meta":{"String":"String"}}}