Skip to content

Latest commit

 

History

History
39 lines (30 loc) · 1.24 KB

README.md

File metadata and controls

39 lines (30 loc) · 1.24 KB

ukpd

npm version CI

A Node.js client for the UK Police API.

Installation

  • npm install ukpd --save
const UKPD = require('ukpd')

try {
  const data = await UKPD.streetLevel(52.629729, -1.131592)
  console.log('data!', data)
} catch (err) {
  console.error('An error occurred', err)
}

To retrieve crimes within a street-level custom area, pass a polygon as colon-separated latitude/longitude pairs to streetLevelCustomArea:

const poly = '52.629729,-1.131592:52.630729,-1.131592:52.630729,-1.130592:52.629729,-1.130592'
const data = await UKPD.streetLevelCustomArea(poly)

Rate-limited requests are retried up to three times after waiting for the number of seconds returned in the API response's retry_after field.

You can find more information by looking at any of the available methods, or the examples.

Acknowledgements

All data is provided by data.police.uk under the Open Government Licence v3.0