BC Ferries API

Overview

The BC Ferries API is an open-source service that scrapes sailing schedule and capacity information from the BC Ferries website. It provides developers with easy access to BC Ferries data via a simple, RESTful API. The service is fully Dockerized, making it easy to deploy and manage, and it is hosted on a DigitalOcean droplet for anyone to use.

Development & Implementation

Technologies used

  • Server: The API server is built using Go.
  • Scraping: The API scrapes data from the BC Ferries website using goquery.
  • Database: Data is stored in a PostgreSQL database.
  • Docker: The API is containerized with Docker and uses Docker Compose for setup.
  • Hosting: The API is hosted on a DigitalOcean droplet for anyone to use for free.

API Endpoints

Here are some of the key API routes provided by the BC Ferries API:

  • GET /v2/capacity
    • Returns all sailings for capacity routes, including information on vehicle and passenger fill rates.
  • GET /v2/noncapacity
    • Returns schedules for all non-capacity routes, which do not track vehicle/passenger fill rates.
  • GET /api/:departureTerminal
    • Returns sailings from a specific departure terminal.
  • GET /api/:departureTerminal/destination/:destinationTerminal
    • Returns sailings between a specific departure and destination terminal.

The API is open-source and available for anyone to use, offering a free and simple way to access BC Ferries schedules and capacity information.

Building it

The BC Ferries API was developed to fill the need for a reliable and easy-to-use service to access ferry sailing information programmatically. I built this API to serve both my own applications, such as BC Ferry Times, and to provide open access to anyone else needing BC Ferries data. The API scrapes data from the BC Ferries website, processes it, and makes it available through a REST API.

Links