| GET | /2.0/address/{Postcode} | ||
|---|---|---|---|
| GET | /2.0/address/{Postcode}/{HouseNo} |
// @DataContract(Name="Address", Namespace="http://schemas.datacontract.org/2004/07/PostcodeLookupService")
export class Address
{
// @DataMember
public County: string;
// @DataMember
public Id: number;
// @DataMember
public Locality: string;
// @DataMember
public Organisation: string;
// @DataMember
public Postcode: string;
// @DataMember
public Property: string;
// @DataMember
public RAPPPremiseId: number;
// @DataMember
public Street: string;
// @DataMember
public Town: string;
// @DataMember
public FullAddress: string;
public constructor(init?: Partial<Address>) { (Object as any).assign(this, init); }
}
// @DataContract(Name="LookupResult", Namespace="http://schemas.datacontract.org/2004/07/PostcodeLookupService")
export class LookupResult
{
// @DataMember
public Addresses: Address[];
// @DataMember
public errormsg: string;
public constructor(init?: Partial<LookupResult>) { (Object as any).assign(this, init); }
}
export class AddressRequest implements IHasVersion
{
public Version: number;
/** @description Using a Postcode to return addresses. */
// @ApiMember(DataType="string", Description="Using a Postcode to return addresses.", IsRequired=true, Name="Postcode", ParameterType="path")
public Postcode: string;
/** @description Optional input value to limit the return data to a specific address. */
// @ApiMember(DataType="string", Description="Optional input value to limit the return data to a specific address.", Name="House Name or Number", ParameterType="path")
public HouseNo: string;
public constructor(init?: Partial<AddressRequest>) { (Object as any).assign(this, init); }
}
TypeScript AddressRequest DTOs
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
}