GET | /2.0/address/{Postcode} | ||
---|---|---|---|
GET | /2.0/address/{Postcode}/{HouseNo} |
namespace PostcodeLookupService.ServiceModel.Types
open System
open System.Collections
open System.Collections.Generic
open System.Runtime.Serialization
open ServiceStack
open ServiceStack.DataAnnotations
[<DataContract(Name="LookupResult", Namespace="http://schemas.datacontract.org/2004/07/PostcodeLookupService")>]
[<AllowNullLiteral>]
type LookupResult() =
[<DataMember>]
member val Addresses:Address[] = [||] with get,set
[<DataMember>]
member val errormsg:String = null with get,set
[<AllowNullLiteral>]
type AddressRequest() =
member val Version:Int32 = new Int32() with get,set
///<summary>
///Using a Postcode to return addresses.
///</summary>
[<ApiMember(DataType="string", Description="Using a Postcode to return addresses.", IsRequired=true, Name="Postcode", ParameterType="path")>]
member val Postcode:String = null with get,set
///<summary>
///Optional input value to limit the return data to a specific address.
///</summary>
[<ApiMember(DataType="string", Description="Optional input value to limit the return data to a specific address.", Name="House Name or Number", ParameterType="path")>]
member val HouseNo:String = null with get,set
[<DataContract(Name="Address", Namespace="http://schemas.datacontract.org/2004/07/PostcodeLookupService")>]
[<AllowNullLiteral>]
type Address() =
[<DataMember>]
member val County:String = null with get,set
[<DataMember>]
member val Id:Int32 = new Int32() with get,set
[<DataMember>]
member val Locality:String = null with get,set
[<DataMember>]
member val Organisation:String = null with get,set
[<DataMember>]
member val Postcode:String = null with get,set
[<DataMember>]
member val Property:String = null with get,set
[<DataMember>]
member val RAPPPremiseId:Int32 = new Int32() with get,set
[<DataMember>]
member val Street:String = null with get,set
[<DataMember>]
member val Town:String = null with get,set
[<DataMember>]
member val FullAddress:String = null with get,set
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
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
GET /2.0/address/{Postcode} HTTP/1.1 Host: webservices.mbukdatabase.co.uk Accept: application/json
HTTP/1.1 200 OK Content-Type: application/json Content-Length: length {"Addresses":[{"County":"String","Id":0,"Locality":"String","Organisation":"String","Postcode":"String","Property":"String","RAPPPremiseId":0,"Street":"String","Town":"String","FullAddress":"String, String, String, String, String, String"}],"errormsg":"String"}