Skip to content

Playground

The playground runs @gatepost/core in your browser. It checks the form of the text as you type, and it shows the forms and the segments of a postcode. It sends nothing to any server, and it keeps nothing.

Type or paste a postcode, such as ek 01 a03 fk 01. Nothing you type leaves this page.

The playground checks the form of the text as you type.

Segments

    Forms of the postcode

    Match a GPS fix

    A phone reports the accuracy of each GPS fix.

    The playground checks the form only. Only NIPOST’s gateway can say whether a building has a postcode. The TypeScript guide shows the same functions in code.

    @gatepost/client needs a key and a network, so the playground does not run it. These are the answers that the client gave to Gatepost’s mock gateway when this site was built. The answers use synthetic postcodes with the district Z99. The API reference explains each field.

    await client.lookup('FC-01-Z99-ZZ-01')
    {
    "postcode": {
    "compact": "FC01Z99ZZ01",
    "canonical": "FC-01-Z99-ZZ-01",
    "display": "FC 01 Z99 ZZ 01",
    "segments": {
    "state": "FC",
    "lga": "01",
    "district": "Z99",
    "area": "ZZ",
    "unit": "01"
    },
    "precision": "unit"
    },
    "valid": true,
    "status": "valid",
    "levelRequested": 1,
    "levelReceived": 1,
    "administrativeAddress": null,
    "recentHouseAddress": null,
    "buildingUseStatus": null
    }
    await client.lookup('FC-01-Z99-ZZ-01', { level: 2 })
    {
    "postcode": {
    "compact": "FC01Z99ZZ01",
    "canonical": "FC-01-Z99-ZZ-01",
    "display": "FC 01 Z99 ZZ 01",
    "segments": {
    "state": "FC",
    "lga": "01",
    "district": "Z99",
    "area": "ZZ",
    "unit": "01"
    },
    "precision": "unit"
    },
    "valid": true,
    "status": null,
    "levelRequested": 2,
    "levelReceived": 2,
    "administrativeAddress": {
    "stateName": "FEDERAL CAPITAL TERRITORY",
    "lgaName": "SYNTHETIC LGA",
    "localityName": "SYNTHETIC LOCALITY",
    "zone": "NORTH CENTRAL"
    },
    "recentHouseAddress": "1 SYNTHETIC STREET, SYNTHETIC LOCALITY",
    "buildingUseStatus": null
    }
    await client.lookup('FC-01-Z99-ZZ-02')
    {
    "postcode": {
    "compact": "FC01Z99ZZ02",
    "canonical": "FC-01-Z99-ZZ-02",
    "display": "FC 01 Z99 ZZ 02",
    "segments": {
    "state": "FC",
    "lga": "01",
    "district": "Z99",
    "area": "ZZ",
    "unit": "02"
    },
    "precision": "unit"
    },
    "valid": false,
    "status": "not_found",
    "levelRequested": 1,
    "levelReceived": 1,
    "administrativeAddress": null,
    "recentHouseAddress": null,
    "buildingUseStatus": null
    }
    await client.reverse(9, 7)
    {
    "found": true,
    "radiusM": 25,
    "unit": {
    "postcode": {
    "compact": "FC01Z99ZZ01",
    "canonical": "FC-01-Z99-ZZ-01",
    "display": "FC 01 Z99 ZZ 01",
    "segments": {
    "state": "FC",
    "lga": "01",
    "district": "Z99",
    "area": "ZZ",
    "unit": "01"
    },
    "precision": "unit"
    },
    "distanceM": 4.2,
    "confidence": "low",
    "stateName": null,
    "lgaName": null,
    "localityName": null,
    "address": null
    },
    "area": "FC-01-Z99-ZZ",
    "district": "FC-01-Z99",
    "state": "FC"
    }
    await client.autocomplete('fc 01 z')
    {
    "segment": "district",
    "suggestions": [
    {
    "code": "Z99",
    "label": null,
    "postcode": {
    "compact": "FC01Z99",
    "canonical": "FC-01-Z99",
    "display": "FC 01 Z99",
    "segments": {
    "state": "FC",
    "lga": "01",
    "district": "Z99",
    "area": null,
    "unit": null
    },
    "precision": "district"
    }
    }
    ]
    }
    await client.lookup('FC-01-Z99-ZZ-01', { level: 2 }) // a key with no credits
    {
    "name": "PostcodeError",
    "code": "insufficient_credits",
    "status": 402,
    "apiCode": "insufficient_credits",
    "retryAfterMs": null
    }

    Unofficial. Not made or endorsed by NIPOST.