{"id":22457660,"url":"https://github.com/coatless-r-n-d/r-web-api","last_synced_at":"2026-07-03T16:05:01.612Z","repository":{"id":92015602,"uuid":"171721174","full_name":"coatless-r-n-d/r-web-api","owner":"coatless-r-n-d","description":"R and httr: Pulling data from a Web API to obtain realtime bus transit information from Champaign–Urbana Mass Transit District (CUMTD).","archived":false,"fork":false,"pushed_at":"2024-10-30T08:33:12.000Z","size":1020,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-27T13:43:51.370Z","etag":null,"topics":["httr","r","rstats","web-api"],"latest_commit_sha":null,"homepage":"http://rd.thecoatlessprofessor.com/r-web-api/","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/coatless-r-n-d.png","metadata":{"files":{"readme":"README.Rmd","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-02-20T17:45:34.000Z","updated_at":"2024-10-30T08:30:59.000Z","dependencies_parsed_at":null,"dependency_job_id":"7e9c55ae-90fe-4484-8df2-7593277ea677","html_url":"https://github.com/coatless-r-n-d/r-web-api","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/coatless-r-n-d/r-web-api","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coatless-r-n-d%2Fr-web-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coatless-r-n-d%2Fr-web-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coatless-r-n-d%2Fr-web-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coatless-r-n-d%2Fr-web-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/coatless-r-n-d","download_url":"https://codeload.github.com/coatless-r-n-d/r-web-api/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coatless-r-n-d%2Fr-web-api/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264029567,"owners_count":23546491,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["httr","r","rstats","web-api"],"created_at":"2024-12-06T08:09:00.516Z","updated_at":"2025-10-13T03:09:30.867Z","avatar_url":"https://github.com/coatless-r-n-d.png","language":"R","funding_links":[],"categories":[],"sub_categories":[],"readme":"---\noutput: github_document\n---\n\n\u003c!-- README.md is generated from README.Rmd. Please edit that file --\u003e\n\n```{r, include = FALSE}\nknitr::opts_chunk$set(\n  collapse = TRUE,\n  comment = \"#\u003e\",\n  fig.path = \"man/figures/README-\",\n  out.width = \"100%\"\n)\n```\n\n## Retrieving Data from a Custom Web API  \n\n\u003c!-- badges: start --\u003e\n[![R-CMD-check](https://github.com/coatless-r-n-d/r-web-api/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/coatless-r-n-d/r-web-api/actions/workflows/R-CMD-check.yaml)\n\u003c!-- badges: end --\u003e\n  \nThe `cumtd` _R_ package provides an example of implementing and using a \nWeb API. In particular, the package is a case study in retrieving data from the\n[Champaign-Urbana Mass Transit District ('CUMTD')](https://developer.cumtd.com/)\nWeb API, which provides realtime information for buses. Writing a custom wrapper\nto the API was necessary since there is not a realtime [General Transit Feed Specification (GTFS)](http://code.google.com/transit/spec/transit_feed_specification.html)\navailable via [GTFS Realtime](https://developers.google.com/transit/gtfs-realtime/).\nThus, for those wanting to know if their bus will arrive on time, one must look\nelsewhere.\n\nAs a follow-up, the package is used in \n[`r-shinydashboard`](https://github.com/r-pkg-examples/r-shinydashboard) example\nto illustrate how a real-time API can be used with \n[`shinydashboard`](https://rstudio.github.io/shinydashboard/index.html).\n\n### Installation\n\nTo install the `cumtd` package, use:\n\n```r\nif(!requireNamespace(\"remotes\")) install.packages(\"remotes\")\nremotes::install_github(\"coatless-r-n-d/r-web-api\")\n```\n\nTo access its contents, load it into _R_ with:\n\n```r\nlibrary(\"cumtd\")\n```\n\n### Endpoints\n\nWe have support presently for:\n\n```{r, echo = FALSE}\n# Must be in the environment... \nlibrary(\"cumtd\")\n# Dynamically retrieve package functions\nfuncs = ls(\"package:cumtd\")\nfuncs = matrix(funcs, nrow = length(funcs))\ncolnames(funcs) = c(\"Implemented Functions\")\nknitr::kable(funcs)\n# Shows parameter call\n# lsf.str(\"package:ghapi3\")\n```\n\nEnd points to be added (PRs appreciated!):\n\n```{r, echo = FALSE}\nep = data.frame(Endpoints = c(\"GetCalendarDatesByDate\", \"GetCalendarDatesByService\",\n                         \"GetNews\", \n                         \"GetReroutes\", \"GetReroutesByRoute\",\n                         \"GetRoute\", \"GetRoutesByStop\",\n                         \"GetStop\", \"GetStopsByLatLon\", \"GetStopsBySearch\",\n                         \"GetStopTimesByTrip\", \"GetStopTimesByStop\",\n                         \"GetPlannedTripsByLatLon\", \"GetPlannedTripsByStops\",\n                         \"GetTrip\", \"GetTripsByBlock\", \"GetTripsByRoute\",\n                         \"GetVehicle\", \"GetVehiclesByRoute\",\n                         \"GetLastFeedUpdate\"))\n\nep$`End Point Documentation` = paste0(\"[\", ep$Endpoints,\"]\",\n                \"(https://developer.cumtd.com/documentation/v2.2/method/\", tolower(ep$Endpoints), \")\")\n\nknitr::kable(ep[, -1, drop = FALSE])\n```\n\n\n### Implementation Details\n\nWhen trying to import data into _R_ from a Web API, the preferred approach\nis to use [`httr`](https://cran.r-project.org/package=httr) or [`curl`](https://cran.r-project.org/package=curl). Using either of these\npackages, one can form HTTP requests to send to the Web API and receive\nHTTP responses from it that contain the data. Inside the response, there is\na body portion that contains the desired data and needs to be converted into an\n_R_ data structure.\n\n\n### License\n\nGPL (\\\u003e= 2)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoatless-r-n-d%2Fr-web-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcoatless-r-n-d%2Fr-web-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoatless-r-n-d%2Fr-web-api/lists"}