You can search for addresses using an HTTP GET call:
{index:'postCode',value:'GY1 2ET'}
You need to specify some fields in the include parameter, otherwise you will receive back only a list of identifiers without any text or other address details.
Note that, generally, you should also add a term of {index:'active',value:'true'}
unless
you want to receive inactive addresses in your results. E.g.:
The full list of term types and includable fields are documented at /v3/search/addresses. In addition, the full documentation shows how to sort results, limit the number of results and skip a number of results for windowed searching (e.g. for paginated display).
The same style of API can be used for searching the road list:
cURL is a widely available command line tool which is useful for testing web service calls.
To test a simple GET request, simply specify the URL:
> curl https://cafv3.gov.gg/v3/lastRef
132811
This request works without authentication (the /v3/lastRef call does not require authentication).
All other calls require authentication and will return a 401 HTTP status code response without it:
> curl https://cafv3.gov.gg/v3/addresses/35368/current?include=business,subElementDesc
{
"message": "No authentication details provided. Please use HTTP Basic authentication, supplying your API key as your username."
}
To specify your API key, use curl's -u <user:password> switch, specifying your API key and a blank password:
> curl https://cafv3.gov.gg/v3/addresses/35368/current?include=business,subElementDesc -u {apiKey}:
{
"journal": "Addresses",
"doc": 35368,
"rev": 1,
"ref": 124224,
"attributes": {
"business": "Digimap Ltd",
"subElementDesc": ""
},
"from": "2018-11-28T05:06:39.419664",
"predecessorRef": 35368
}
Every object returned by the CAF v3 API contains properties 'Doc', 'Rev' and 'Ref':