PTVGET: Submit a GET request to the PTV API

View source: R/ptv-verbs.R

PTVGETR Documentation

Submit a GET request to the PTV API

Description

Submit a GET request to the PTV API

Usage

PTVGET(
  request,
  user_id = determine_user_id(),
  api_key = determine_api_key(),
  ...
)

Arguments

request

A request or path for the API, eg. "routes".

user_id

Integer or character. A user ID or devid provided by Public Transport Victoria. Refer to ?ptvapi for more details.

api_key

Character. An API key, with dashes, provided by Public Transport Victoria. Refer to ?ptvapi for more details.

...

Additional arguments passed to httr::GET.

Value

A HTTP response. Content can be accessed with httr::content.

Obtaining API authentication details

You will need to obtain a user ID (also called a devid) and an API key from Public Transport Victoria. These are obtained by email. Instructions are available at https://www.ptv.vic.gov.au/footer/data-and-reporting/datasets/ptv-timetable-api/. You may pass these two pieces of information directly to the function, or you can set the PTV_USER_ID and PTV_API_KEY environment variables.


ptvapi documentation built on Aug. 15, 2022, 5:09 p.m.