1 | github_api(path)
|
path |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | ##---- Should be DIRECTLY executable !! ----
##-- ==> Define data, use random,
##-- or do help(data=index) for the standard data sets.
## The function is currently defined as
function (path)
{
url <- modify_url("https://api.github.com", path = path)
resp <- GET(url)
if (http_type(resp) != "application/json") {
stop("API did not return json", call. = FALSE)
}
parsed <- jsonlite::fromJSON(content(resp, "text"), simplifyVector = FALSE)
if (http_error(resp)) {
stop(sprintf("GitHub API request failed [%s]\n%s\n<%s>",
status_code(resp), parsed$message, parsed$documentation_url),
call. = FALSE)
}
structure(list(content = parsed, path = path, response = resp),
class = "github_api")
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.