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}
using System;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.Serialization;
using ServiceStack;
using ServiceStack.DataAnnotations;
using PostcodeLookupService.ServiceModel.Types;

namespace PostcodeLookupService.ServiceModel.Types
{
    [DataContract(Name="Address", Namespace="http://schemas.datacontract.org/2004/07/PostcodeLookupService")]
    public partial class Address
    {
        [DataMember]
        public virtual string County { get; set; }

        [DataMember]
        public virtual int Id { get; set; }

        [DataMember]
        public virtual string Locality { get; set; }

        [DataMember]
        public virtual string Organisation { get; set; }

        [DataMember]
        public virtual string Postcode { get; set; }

        [DataMember]
        public virtual string Property { get; set; }

        [DataMember]
        public virtual int RAPPPremiseId { get; set; }

        [DataMember]
        public virtual string Street { get; set; }

        [DataMember]
        public virtual string Town { get; set; }

        [DataMember]
        public virtual string FullAddress { get; set; }
    }

    public partial class AddressRequest
        : IHasVersion
    {
        public virtual int Version { 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")]
        public virtual string Postcode { 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")]
        public virtual string HouseNo { get; set; }
    }

    [DataContract(Name="LookupResult", Namespace="http://schemas.datacontract.org/2004/07/PostcodeLookupService")]
    public partial class LookupResult
    {
        public LookupResult()
        {
            Addresses = new Address[]{};
        }

        [DataMember]
        public virtual Address[] Addresses { get; set; }

        [DataMember]
        public virtual string errormsg { get; set; }
    }

}

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