All Projects → mpolden → Atbapi

mpolden / Atbapi

Licence: bsd-3-clause
Sane API for bus data in Trondheim, Norway

Programming Languages

go
31211 projects - #10 most used programming language

Labels

Projects that are alternatives of or similar to Atbapi

Reactjs Tmdb App
Responsive React 'The Movie Database' (TMDb) App
Stars: ✭ 830 (+4782.35%)
Mutual labels:  api
Sparkling Water
Sparkling Water provides H2O functionality inside Spark cluster
Stars: ✭ 887 (+5117.65%)
Mutual labels:  api
Orbit Db Http Api
A HTTP API Server for the OrbitDB distributed peer-to-peer database
Stars: ✭ 17 (+0%)
Mutual labels:  api
Apispec
A pluggable API specification generator. Currently supports the OpenAPI Specification (f.k.a. the Swagger specification)..
Stars: ✭ 831 (+4788.24%)
Mutual labels:  api
Exiftool
ExifTool meta information reader/writer
Stars: ✭ 832 (+4794.12%)
Mutual labels:  api
Notetoself
Command line note taking app
Stars: ✭ 16 (-5.88%)
Mutual labels:  api
Duckduckgo
An unofficial DuckDuckGo search API.
Stars: ✭ 6 (-64.71%)
Mutual labels:  api
Django rest example
Django/DRF rest application example.
Stars: ✭ 17 (+0%)
Mutual labels:  api
Api Guidelines
BC Government API Guidelines
Stars: ✭ 16 (-5.88%)
Mutual labels:  api
Github Funding Yml Updater
Update multiple repositories's `.github/FUNDING.yml` via GitHub API
Stars: ✭ 17 (+0%)
Mutual labels:  api
Pix Api
API Pix: a API do Arranjo de Pagamentos Instantâneos Brasileiro.
Stars: ✭ 832 (+4794.12%)
Mutual labels:  api
Forbes400
JSON Api Of The Forbes 400 Richest People List
Stars: ✭ 7 (-58.82%)
Mutual labels:  api
Pwnedornot
OSINT Tool for Finding Passwords of Compromised Email Addresses
Stars: ✭ 888 (+5123.53%)
Mutual labels:  api
Jso
Easy to use OAuth 2.0 javascript library for use in your javascript application.
Stars: ✭ 830 (+4782.35%)
Mutual labels:  api
Hacker News Api
JavaScript wrapper for the official Hacker News API
Stars: ✭ 17 (+0%)
Mutual labels:  api
Github Create Token
Create a Github OAuth access token.
Stars: ✭ 6 (-64.71%)
Mutual labels:  api
Zato
ESB, SOA, REST, APIs and Cloud Integrations in Python
Stars: ✭ 889 (+5129.41%)
Mutual labels:  api
Wykop Es6
Wykop.pl API library
Stars: ✭ 17 (+0%)
Mutual labels:  api
Cv4pve Api Java
Proxmox VE Client API JAVA
Stars: ✭ 17 (+0%)
Mutual labels:  api
Go Api Boilerplate
Exemplo de API utilizando a linguagem Go e a biblioteca Gorilla Mux
Stars: ✭ 17 (+0%)
Mutual labels:  api

atbapi

Build Status

A minimal API for bus data in Trondheim, Norway. This API proxies requests to the AtB public API and converts the responses into a sane JSON format.

Responses from AtBs public API are cached. By default bus stops will be cached for 1 week and departures for 1 minute.

If you want to setup this service yourself, you need to request access to the SOAP API provided by AtB (Norwegian). When granted access, you'll receive a username and password (see config example below).

The API aims to be compatible with BusBuddy (which appears to be defunct).

Usage

$ atbapi -h
Usage:
  atbapi [OPTIONS]

Application Options:
  -l, --listen=ADDRESS               Listen address (:8080)
  -c, --config=FILE                  Path to config file (config.json)
  -s, --cache-stops=DURATION         Bus stops cache duration (168h)
  -d, --cache-departures=DURATION    Departures cache duration (1m)
  -x, --cors                         Allow requests from other domains (false)

Help Options:
  -h, --help                         Show this help message

Example config

{
  "Username": "username",
  "Password": "password"
}

API

/

Lists all available API routes.

Example:

$ curl https://atbapi.tar.io | jq .
{
  "urls": [
    "https://atbapi.tar.io/api/v1/busstops",
    "https://atbapi.tar.io/api/v1/departures"
  ]
}

/api/v1/busstops

Lists all known bus stops.

Example:

$ curl https://atbapi.tar.io/api/v1/busstops | jq .
{
  "stops": [
    {
      "stopId": 100633,
      "nodeId": 16011376,
      "description": "Prof. Brochs gt",
      "longitude": 10.398125177823237,
      "latitude": 63.4155348940887,
      "mobileCode": "16011376 (Prof.)",
      "mobileName": "Prof. (16011376)"
    },
    ...
  ]
}

/api/v1/busstops/{node-id}

Information about the given bus stop, identified by a node ID.

Example:

$ curl https://atbapi.tar.io/api/v1/busstops/16011376 | jq .
{
  "stopId": 100633,
  "nodeId": 16011376,
  "description": "Prof. Brochs gt",
  "longitude": 10.398126,
  "latitude": 63.415535,
  "mobileCode": "16011376 (Prof.)",
  "mobileName": "Prof. (16011376)"
}

As GeoJSON:

$ curl https://atbapi.tar.io/api/v1/busstops/16011376?geojson | jq .
{
  "type": "Feature",
  "geometry": {
    "type": "Point",
    "coordinates": [
      10.398126,
      63.415535
    ]
  },
  "properties": {
    "busstop": {
      "stopId": 100633,
      "nodeId": 16011376,
      "description": "Prof. Brochs gt",
      "longitude": 10.398126,
      "latitude": 63.415535,
      "mobileCode": "16011376 (Prof.)",
      "mobileName": "Prof. (16011376)"
    },
    "name": "Prof. Brochs gt"
  }
}

/api/v1/departures

Lists departure URLs for all known bus stops.

Example:

$ curl -s https://atbapi.tar.io/api/v1/departures | jq .
{
  "urls": [
    "https://atbapi.tar.io/api/v1/departures/15057011",
    ...
  ]
}

/api/v1/departures/{node-id}

Lists all departures for the given bus stop, identified by a node ID.

Example:

$ curl https://atbapi.tar.io/api/v1/departures/16011376 | jq .
{
  "isGoingTowardsCentrum": true,
  "departures": [
    {
      "line": "36",
      "registeredDepartureTime": "2015-02-26T22:55:00.000",
      "scheduledDepartureTime": "2015-02-26T22:54:00.000",
      "destination": "Munkegata M4",
      "isRealtimeData": true
    },
    ...
  ]
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].