| GET | /2.0/address/{Postcode} | ||
|---|---|---|---|
| GET | /2.0/address/{Postcode}/{HouseNo} |
import datetime
import decimal
from marshmallow.fields import *
from servicestack import *
from typing import *
from dataclasses import dataclass, field
from dataclasses_json import dataclass_json, LetterCase, Undefined, config
from enum import Enum, IntEnum
Object = TypeVar('Object')
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class Address:
county: Optional[str] = None
id: int = 0
locality: Optional[str] = None
organisation: Optional[str] = None
postcode: Optional[str] = None
property: Optional[str] = None
rapp_premise_id: int = 0
street: Optional[str] = None
town: Optional[str] = None
full_address: Optional[str] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class LookupResult:
addresses: Optional[List[Address]] = None
errormsg: Optional[str] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class AddressRequest(IHasVersion):
version: int = 0
# @ApiMember(DataType="string", Description="Using a Postcode to return addresses.", IsRequired=true, Name="Postcode", ParameterType="path")
postcode: Optional[str] = None
"""
Using a Postcode to return addresses.
"""
# @ApiMember(DataType="string", Description="Optional input value to limit the return data to a specific address.", Name="House Name or Number", ParameterType="path")
house_no: Optional[str] = None
"""
Optional input value to limit the return data to a specific address.
"""
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.
GET /2.0/address/{Postcode} HTTP/1.1
Host: webservices.mbukdatabase.co.uk
Accept: text/jsv
HTTP/1.1 200 OK
Content-Type: text/jsv
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
}