getJson | R Documentation |
Get JSON from an API
getJson(url)
url |
|
Requires httr2 package to be installed.
list
.
Updated 2023-09-14.
## Access the UCSC Genome Browser API.
url <- pasteUrl(
"api.genome.ucsc.edu",
"list",
"ucscGenomes",
protocol = "https"
)
if (goalie::isAnExistingUrl(url)) {
json <- getJson(url)
print(names(json))
}
## Access Ensembl genome assembly metadata.
## The Ensembl REST API server is prone to connection issues, so keeping
## disabled here in the working example.
## > url <- pasteUrl(
## > "rest.ensembl.org",
## > "info",
## > "assembly",
## > paste0(
## > "Homo sapiens",
## > "?", "content-type=application/json"
## > ),
## > protocol = "https"
## > )
## > if (goalie::isAnExistingUrl(url)) {
## > json <- getJson(url)
## > print(names(json))
## > }
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.