Developer API - Guide

To use any of our services, you must first have or sign up for a free account.  PDF Guide

Create a Product Key


To use the Postcodes4u service a key is required.  To create a key, visit the Product Keys tab in the My Account section of the website.

Click the Postcode Finder button.
 
You will be requested to enter a descriptive name for your key.  This key name helps to track usage and also provides you with a unique key to access the service.  Also enter a daily limit for the number of credits that this key can use.

Postcode Lookup

Once this information has been entered, the Products Keys tab will display the key XXXX-XXXX-XXXX-XXXX that can be used to access the service.


Creating a web form


The next thing to do is to create a webform that can use the service.
The script below should be placed in the <head> section of your nominated html file.


<script type="text/javascript" src="http://www.postcodes4u.co.uk/postcodes4u.js"></script>



Alternatively download the required script for more flexibility from here

The second section of these scripts details the user interface or controls that will be used to operate the service. This section of code should be placed between the <body> tags of your form.

 <form name="" action="post" target="#">
<h2>Address details</h2>
<div id='postcodes4ukey' style='display: none;'> product key goes here </div>
<div id='postcodes4uuser' style='display: none;'>account username goes here</div>
<table>
<tr>
<td>postcode</td>
<td><input type="text" value="" id="postcode"/></td>
<td><input type="submit" value="lookup" onclick="SearchBegin();return false;"/>
<select id="dropdown" style='display:none;' onchange="SearchIdBegin()">
<option>Select an address:</option>
</select>
</td>
</tr>
<tr>
<td>company</td>
<td><input type="text" value="" id="company"/></td>
</tr>
<tr>
<td>address 1</td>
<td><input type="text" value="" id="address1"/></td>
</tr>
<tr>
<tr>
<td>address 2</td><td><input type="text" value="" id="address2"/></td>
</tr>
<tr>
<td>town</td><td><input type="text" value="" id="town"/></td>
</tr>
<tr>
<td>county</td><td><input type="text" value="" id="county"/></td>
</tr>
</table>
</form>


The only changes required to the code above is to add your product key and username to the elements indicated below i.e.

<div id=”postcodes4ukey” style=”display: none;”> product key goes here </div>
<div id=”postcodes4uuser” style=”display: none;”>account username goes here</div>


Don’t forget to save your work when finished. Refreshing the page in your browser afterwards should result in Postcode4u functionality in your website.

A more detailed guide of the web service that powers our addressing solution can be found in pdf format here