Coder Social home page Coder Social logo

pbadams / bc-ferries-api Goto Github PK

View Code? Open in Web Editor NEW

This project forked from samuel-pratt/bc-ferries-api

0.0 0.0 0.0 2.44 MB

๐Ÿ›ณ The only public API for retrieving current data on BC Ferries sailings.

Home Page: https://bcferriesapi.ca

License: MIT License

Go 82.23% CSS 7.68% HTML 10.09%

bc-ferries-api's Introduction

BC Ferries API - bcferriesapi.ca

The BC Ferries API provides current data on BC Ferries sailings and schedules for all routes.

Running Locally

To run locally you must have a postgres database set up with the tables in db_setup.sql included. Create a .env file from the .ev.sample and fill it with the database info.

Once that's set up just build the project with:

go build

And run it with:

./bc-ferries-api

And you're good to go!

API Reference

V2

Version 2 of the API includes data for all terminals and routes served by BC Ferries. The response is structured as an array of "route" objects, each defining departure and arrival terminals, along with a JSON object containing sailings for that specific route.

Endpoints:

  • Root Endpoint: https://www.bcferriesapi.ca/v2/
  • Capacity Endpoint: https://www.bcferriesapi.ca/v2/capacity/
  • Non-Capacity Endpoint: https://www.bcferriesapi.ca/v2/noncapacity/

The root /v2/ route provides data for both capacity and non-capacity sailings. Non-capacity includes information on all BC Ferries routes, while capacity data covers routes with vessel fill data reported by BC Ferries.

Capacity Route Codes:

  • "TSA": Routes to terminals "SWB", "SGI", "DUK"
  • "SWB": Routes to terminals "TSA", "FUL", "SGI"
  • "HSB": Routes to terminals "NAN", "LNG", "BOW"
  • "DUK": Route to terminal "TSA"
  • "LNG": Route to terminal "HSB"
  • "NAN": Route to terminal "HSB"

V1

This API uses the following route codes used by BC Ferries:

  • "TSA" -> Tsawwassen
  • "SWB" -> Swartz Bay
  • "SGI" -> Southern Gulf Islands
  • "DUK" -> Duke Point (Nanaimo)
  • "FUL" -> Fulford Harbour (Salt Spring Island)
  • "HSB" -> Horseshoe Bay
  • "NAN" -> Departure Bay (Nanaimo)
  • "LNG" -> Langdale
  • "BOW" -> Bowen Island

The API endpoint format is:

https://www.bcferriesapi.ca/api/<departure-terminal>/<destination-terminal>

You can specify departure and destination terminals to get relevant data.

Available Departure Terminals:

  • "TSA", "SWB", "HSB", "DUK", "LNG", "NAN", "FUL", "BOW"

Available Destination Terminals:

Please note that the destination terminal must correspond to the departure terminal, incorrect pairings will return an error.

  • "TSA": ["SWB", "SGI", "DUK"]
  • "SWB": ["TSA", "FUL", "SGI"]
  • "HSB": ["NAN", "LNG", "BOW"]
  • "DUK": ["TSA"]
  • "LNG": ["HSB"]
  • "NAN": ["HSB"]
  • "FUL": ["SWB"]
  • "BOW": ["HSB"]

Used By

Projects using the BC Ferries API:

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.