get_civic_api: GET from Civic API

Description Usage Arguments Value Examples

View source: R/api_utils.R

Description

GETs data from a Civic API endpoint

Usage

1
get_civic_api(url, verbose)

Arguments

url

the URL to GET

verbose

print status info

Value

a list of two items

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
## Not run: 
url_base <- "http://service.civicpdx.org/transportation2019/v1/toad"
endpoint <- "busPassengerStops"
query <- "?limit=10000&lines=10,14&stops=3637,3641,3633&time_range=9,10&service_key=W"
url <- paste(url_base, endpoint, query, sep = "/")
print(url)
response <- rcivicapi::get_civic_api(url, verbose = TRUE)
if (response[["status_code"]] == 200) {
  View(response[["data"]][["results"]][["features"]])
} else {
  print(response)
}

## End(Not run)

hackoregon/rcivicapi documentation built on Nov. 4, 2019, 1:26 p.m.