openpolicedata / openpolicedata

The OpenPoliceData (OPD) Python library is the most comprehensive centralized public access point for incident-level police data in the United States. OPD provides easy access to 425+ incident-level datasets for about 4800 police agencies. Types of data include traffic stops, use of force, officer-involved shootings, and complaints.
BSD 3-Clause "New" or "Revised" License
17 stars 3 forks source link

Implement Junar API to access Palo Alto Data #142

Open sowdm opened 1 year ago

sowdm commented 1 year ago

https://data.cityofpaloalto.org/developers/

sowdm commented 1 year ago

Need to get an API key here: https://data.cityofpaloalto.org/developers/

Will have to throw errors if user does not have it and tell them to get one

sowdm commented 1 year ago

From: http://api.dev:8080/api/v2/datasets/?auth_key=576bba0dd5a27df9aaac12d1d7ec25c8411fe29e&limit=2&offset=2

A typical request will look like this:

http://paloalto.cloudapi.junar.com/api/v2/datastreams/GENER-RESID-WATER-SERVI-UTILI/data.json/?auth_key=YOUR_API_KEY

A few things to note in the request above:

/api/v2/datastreams/ This is an invoke request, that will return a json response. The entire resources descriptions are available in the API resource documentation.

GENER-RESID-WATER-SERVI-UTILI This is the GUID of the data stream you are accessing. You will always find this GUID in the Data Stream Details page, making a data stream search through the API, or in many other places.

auth_key=YOUR_API_KEY This is the key from step 1. You'll need it for every request.

sowdm commented 1 year ago

Pagination: https://junar.github.io/docs/en/_sections/02-topics.html#pagination

Basic example: http://api.dev:8080/api/v2/datasets/?auth_key=576bba0dd5a27df9aaac12d1d7ec25c8411fe29e&limit=2&offset=2

Can also uses pages with limit: https://junar.github.io/docs/en/_sections/04-dataviews.html#results-per-page https://junar.github.io/docs/en/_sections/04-dataviews.html#results-per-page

sowdm commented 1 year ago

Output types (data views): https://junar.github.io/docs/en/_sections/04-dataviews.html data.json gives data in JSON format

Data filtering: https://junar.github.io/docs/en/_sections/04-dataviews.html#filtering-data-view-results If data columns needs formatting prior to query (such as if date is not formatted properly: https://junar.github.io/docs/en/_sections/04-dataviews.html#data-column-formatting Data sorting: https://junar.github.io/docs/en/_sections/04-dataviews.html#data-sorting