GET | /2.0/address/{Postcode} | ||
---|---|---|---|
GET | /2.0/address/{Postcode}/{HouseNo} |
Imports System
Imports System.Collections
Imports System.Collections.Generic
Imports System.Runtime.Serialization
Imports ServiceStack
Imports ServiceStack.DataAnnotations
Imports PostcodeLookupService.ServiceModel.Types
Namespace Global
Namespace PostcodeLookupService.ServiceModel.Types
<DataContract(Name:="Address", Namespace:="http://schemas.datacontract.org/2004/07/PostcodeLookupService")>
Public Partial Class Address
<DataMember>
Public Overridable Property County As String
<DataMember>
Public Overridable Property Id As Integer
<DataMember>
Public Overridable Property Locality As String
<DataMember>
Public Overridable Property Organisation As String
<DataMember>
Public Overridable Property Postcode As String
<DataMember>
Public Overridable Property Property As String
<DataMember>
Public Overridable Property RAPPPremiseId As Integer
<DataMember>
Public Overridable Property Street As String
<DataMember>
Public Overridable Property Town As String
<DataMember>
Public Overridable Property FullAddress As String
End Class
Public Partial Class AddressRequest
Implements IHasVersion
Public Overridable Property Version As Integer
'''<Summary>
'''Using a Postcode to return addresses.
'''</Summary>
<ApiMember(DataType:="string", Description:="Using a Postcode to return addresses.", IsRequired:=true, Name:="Postcode", ParameterType:="path")>
Public Overridable Property Postcode As String
'''<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")>
Public Overridable Property HouseNo As String
End Class
<DataContract(Name:="LookupResult", Namespace:="http://schemas.datacontract.org/2004/07/PostcodeLookupService")>
Public Partial Class LookupResult
Public Sub New()
Addresses = New Address(){}
End Sub
<DataMember>
Public Overridable Property Addresses As Address()
<DataMember>
Public Overridable Property errormsg As String
End Class
End Namespace
End Namespace
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"}