Skip to content

Commit

Permalink
Minor doc tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesmacwhite committed Dec 14, 2024
1 parent bac1037 commit 3049074
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion 404.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ <h1 class="h2">Page not found</h1>
<li><a href="https://github.com/jamesmacwhite/gedling-borough-council-bin-calendars">View the source/repository</a></li>
</ul>

<p><strong>Please note:</strong> This is not an official Gedling Borough Council website. If you are looking for Gedling Borough Council services, please go to the gedling.gov.uk website for more information.</p>
<p><strong>Please note:</strong> This is not an official Gedling Borough Council website or service. If you are looking for Gedling Borough Council services, please go to the gedling.gov.uk website for more information.</p>

<div class="d-grid gap-2 d-md-block mb-4">
<a href="{{ site.url }}" class="btn btn-lg btn-dark">Back to the homepage</a>
Expand Down
8 changes: 4 additions & 4 deletions API.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
# API

To provide a dynamic bin collection search on the GitHub pages site an API exists at api.gbcbincalendars.co.uk, which is designed to proxy requests to the [Gedling Borough Council refuse collection days search](https://apps.gedling.gov.uk/refuse/search.aspx) and return the data as JSON.
To provide a dynamic bin collection search an API exists at api.gbcbincalendars.co.uk, which is designed to proxy requests to the [Gedling Borough Council refuse collection days search](https://apps.gedling.gov.uk/refuse/search.aspx) and return the data as JSON.

The API is powered by a Cloudflare Worker and the source code for this worker is available at [worker.js](worker.js).

This worker will make search queries and scrape the results to return the data formatted as JSON. The origin data behind the search is not published as open data, which is why DOM/HTML scraping is used. The Gedling refuse search site uses ASP.NET and in order to send a valid POST request the __VIEWSTATE and __EVENTVALIDATION values must be scraped and passed in the request to be valid.

Gedling Borough Council do not appear to have any rate limiting or bot protection on this tool, which fortunately for this API, removes most typical scraping issues/limitations, however please be respectful and do not hammer their website through this API, as it could get the Cloudflare Worker blocked.
Gedling Borough Council do not appear to have any rate limiting or bot protection on this tool, which fortunately for this API, removes most typical scraping issues/limitations, however please be respectful and do not hammer the apps.gedling.gov.uk site through this API, as it could get the Cloudflare Worker blocked.

## Using the API

The API accepts GET requests only and requires the URL query parameter `streetName`.
The API accepts GET requests only and requires the URL query parameter `streetName` for any requests.

The following additional validation requirements are defined for the street name query parameter value provided:

Expand Down Expand Up @@ -156,7 +156,7 @@ If using the API response data, you should always ensure the `refuseCollections`

## Running the API locally

You can locally run the Cloudflare Worker which the API uses through wrangler.
You can locally run the Cloudflare Worker through wrangler.

```
npx wrangler dev
Expand Down
22 changes: 11 additions & 11 deletions USAGE.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,19 @@ All calendars are [available to be viewed as HTML](https://www.gbcbincalendars.c

## Importing to a calendar

You can import any calendar as static or subscribe using the iCal URL for a dynamic endpoint, an example for the Wednesday G2 bin collection:
You can import any calendar as a static one time import or subscribe using the iCal URL for a dynamic calendar URL, an example iCal URL for the Wednesday G2 bin collection:

```
https://www.gbcbincalendars.co.uk/ical/gedling_borough_council_wednesday_g2_bin_schedule.ics
```

The .ics files have been tested with multiple calendar software applications to ensure compatibility.

[A GitHub pages site](https://www.gbcbincalendars.co.uk) exists to display all calendars in a logical structure offering the .ics calendar for each schedule available to download and the iCal subscribe URL to use in any calendar software to automatically receive updates.
[A GitHub pages site](https://www.gbcbincalendars.co.uk) exists to display all calendars in a logical structure offering the .ics calendar for each schedule available to download or the iCal subscribe URL to use in any calendar software to automatically receive yearly updates.

## JSON calendar APIs
## Calendar data as JSON

Using the [ical.js library](https://github.com/kewisch/ical.js) all calendars are also available as JSON endpoints, published under: `https://www.gbcbincalendars.co.uk/json/`, with the filename being the same as ical path with the exception of being `.json` instead of `.ical`. E.g. `https://www.gbcbincalendars.co.uk/json/gedling_borough_council_wednesday_g2_bin_schedule.json`.
Using the [ical.js library](https://github.com/kewisch/ical.js) all calendars are also available as JSON data, published under: `https://www.gbcbincalendars.co.uk/json/`, with the filename being the same as ical path with the exception of being `.json` instead of `.ics`. E.g. `https://www.gbcbincalendars.co.uk/json/gedling_borough_council_wednesday_g2_bin_schedule.json`.

The HTML calendars are derived from the same JSON data. You can find further [documentation about the JSON endpoints](https://www.gbcbincalendars.co.uk/json-endpoints) on the GitHub pages site.

Expand All @@ -47,32 +47,32 @@ Multiple sources are supported e.g. if you also use the Garden Waste Collection
```yaml
waste_collection_schedule:
# Wednesday G2 collection
# Refuse/Recyling Wednesday G2 collection
sources:
- name: ics
calendar_title: Gedling Borough Council bin collection
args:
url: https://www.gbcbincalendars.co.uk/ical/gedling_borough_council_wednesday_g2_bin_schedule.ics
# Tuesday B collection
# Garden Tuesday B collection
- name: ics
calendar_title: Gedling Borough Council garden waste collection
args:
url: https://www.gbcbincalendars.co.uk/ical/gedling_borough_council_tuesday_b_garden_bin_schedule.ics
```
The HACS Waste Collection Schedule integration also supports parsing another widely used project [UK Bin Collection Data (UKBCD)](https://github.com/mampfes/hacs_waste_collection_schedule/blob/master/doc/source/ukbcd.md). This project is supported as data sources for both.
The HACS Waste Collection Schedule integration also supports parsing another widely used project [UK Bin Collection Data (UKBCD)](https://github.com/mampfes/hacs_waste_collection_schedule/blob/master/doc/source/ukbcd.md).
## HomeAssistant: UKBinCollectionData (UKBCD)
The [UK Bin Collection Data](https://github.com/robbrad/UKBinCollectionData) project aims to create a way of providing bin collection data in JSON format from UK councils which have no direct API to do so.
The JSON API data provided for each bin collection calendar by this project is directly used for the [GedlingBoroughCouncil.py parser](https://github.com/robbrad/UKBinCollectionData/blob/master/uk_bin_collection/uk_bin_collection/councils/GedlingBoroughCouncil.py).
The JSON API data provided for each bin collection calendar by this project is directly used for the [GedlingBoroughCouncil.py parser](https://github.com/robbrad/UKBinCollectionData/blob/master/uk_bin_collection/uk_bin_collection/councils/GedlingBoroughCouncil.py) in the UKBCD project.
## Open Bin collection street search API
## Open bin collection street search API
Using a Cloudflare Worker, an API is available at api.gbcbincalendars.co.uk which provides bin collection search, using street name values. The source of this data is from [Gedling Borough Council directly](https://apps.gedling.gov.uk/refuse/search.aspx). This is the only official data source from Gedling, however it lacks any form of usable API/endpoint. The Cloudflare worker performs searches and scrapes the results to return as JSON. You can read more about this on the [API docs](API.md).
## Other
## Other use cases
Everything within this project is open source and published under the [General Public License GPLv3](LICENSE). You are more than welcome to use any of the data and contents in other software for any purpose.
Everything within this project is open source and published under the [General Public License GPLv3](LICENSE). If you are using the data from this project in other software or applications, I'd love to hear about it!

0 comments on commit 3049074

Please sign in to comment.