PTVGET: Submit a GET request to the PTV API

Description Usage Arguments Value Obtaining API authentication details

View source: R/ptv-verbs.R

Description

Submit a GET request to the PTV API

Usage

1
2
3
4
5
6
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 May 2, 2021, 9:06 a.m.