AddressLookupService

<back to all web services

AddressRequest

Requires Authentication
The following routes are available for this service:
GET/2.0/address/{Postcode}
GET/2.0/address/{Postcode}/{HouseNo}
import java.math.*;
import java.util.*;
import net.servicestack.client.*;

public class dtos
{

    public static class AddressRequest implements IHasVersion
    {
        public Integer Version = null;
        /**
        * Using a Postcode to return addresses.
        */
        @ApiMember(DataType="string", Description="Using a Postcode to return addresses.", IsRequired=true, Name="Postcode", ParameterType="path")
        public String Postcode = null;

        /**
        * 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 String HouseNo = null;
        
        public Integer getVersion() { return Version; }
        public AddressRequest setVersion(Integer value) { this.Version = value; return this; }
        public String getPostcode() { return Postcode; }
        public AddressRequest setPostcode(String value) { this.Postcode = value; return this; }
        public String getHouseNo() { return HouseNo; }
        public AddressRequest setHouseNo(String value) { this.HouseNo = value; return this; }
    }

    @DataContract(Name="LookupResult", Namespace="http://schemas.datacontract.org/2004/07/PostcodeLookupService")
    public static class LookupResult
    {
        @DataMember
        public ArrayList<Address> Addresses = null;

        @DataMember
        public String errormsg = null;
        
        public ArrayList<Address> getAddresses() { return Addresses; }
        public LookupResult setAddresses(ArrayList<Address> value) { this.Addresses = value; return this; }
        public String getErrormsg() { return errormsg; }
        public LookupResult setErrormsg(String value) { this.errormsg = value; return this; }
    }

    @DataContract(Name="Address", Namespace="http://schemas.datacontract.org/2004/07/PostcodeLookupService")
    public static class Address
    {
        @DataMember
        public String County = null;

        @DataMember
        public Integer Id = null;

        @DataMember
        public String Locality = null;

        @DataMember
        public String Organisation = null;

        @DataMember
        public String Postcode = null;

        @DataMember
        public String Property = null;

        @DataMember
        public Integer RAPPPremiseId = null;

        @DataMember
        public String Street = null;

        @DataMember
        public String Town = null;

        @DataMember
        public String FullAddress = null;
        
        public String getCounty() { return County; }
        public Address setCounty(String value) { this.County = value; return this; }
        public Integer getId() { return Id; }
        public Address setId(Integer value) { this.Id = value; return this; }
        public String getLocality() { return Locality; }
        public Address setLocality(String value) { this.Locality = value; return this; }
        public String getOrganisation() { return Organisation; }
        public Address setOrganisation(String value) { this.Organisation = value; return this; }
        public String getPostcode() { return Postcode; }
        public Address setPostcode(String value) { this.Postcode = value; return this; }
        public String getProperty() { return Property; }
        public Address setProperty(String value) { this.Property = value; return this; }
        public Integer getRappPremiseId() { return RAPPPremiseId; }
        public Address setRappPremiseId(Integer value) { this.RAPPPremiseId = value; return this; }
        public String getStreet() { return Street; }
        public Address setStreet(String value) { this.Street = value; return this; }
        public String getTown() { return Town; }
        public Address setTown(String value) { this.Town = value; return this; }
        public String getFullAddress() { return FullAddress; }
        public Address setFullAddress(String value) { this.FullAddress = value; return this; }
    }

}

Java AddressRequest 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.

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"}