Which Bin

Documentation

Introduction

Which Bin has two modes of operation: next and all.

Using next will return all the collection dates for your bins that are in the future, sorted by nearest first. This means that the number of bins returned may vary.

Using all will return the next collection dates for all of your bins, even if those dates are in the past. Because the data source doesn't update immediately, sometimes the collection dates will be in the past.

Authentication: Getting your UPRN

Although the API does not require an account or authentication, it uses your UPRN (Unique Property Reference Number) for location lookup.

To find out your UPRN:
  1. Visit Eastleigh Council's Website and enter your postcode.
  2. Click your address
  3. When the page with your bin dates loads, your UPRN will be in your browser's URL bar at the end of the URL. E.g.
     https://www.eastleigh.gov.uk/waste-bins-and-recycling/waste-bin-and-recycling-collection-dates/your-waste-bin-and-recycling-collections?uprn=1234 
    where 1234 is your UPRN. Copy it, as you'll need to use this to make requests to the API.

Calling the API

To make things as simple as possible, the API is just a GET API. Your UPRN forms part of the URL.
Next bin collections
API URL:https://whichb.in/next/{uprn}
Example Request:curl -s https://whichb.in/next/10091132558/
Example Response:[{"name":"Garden Waste Bin","date":"01 Jan 2020"},{"name":"Recycling Bin","date":"08 Jan 2020"}]
All bin collections
API URL:https://whichb.in/all/{uprn}
Example Request:curl -s https://whichb.in/all/10091132558/
Example Response:[{"name": "Household Waste Bin", "date": "25 Dec 2020"}, {"name":"Garden Waste Bin","date":"01 Jan 2020"},{"name":"Recycling Bin","date":"08 Jan 2020"}]

Limiting the objects returned

You might want to limit the number of items returned in the array. To do this, just append another slash and then the limit amount. I.e.
 https://whichb.in/next/10091132558/2/ 
will return the next 2 bins to be collected.

Setting the limit to 1 will return an array with 1 object in. Setting the limit to 0 will return just the first object, not in an array.

Rate Limiting

Rate limiting on a UPRN-by-UPRN may be enforced. Considering the data will never change within the same calendar day, there's no need to call this API every 5 seconds. Please use responsibly.

Further Questions

Got any more questions? Email me at mail @ willow . systems
Let me know if you use this API, it's fun to share.



A project by Will Murphy | Donate