Get JSON from an API
Examples
## 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))
}
#> [1] "downloadTime" "downloadTimeStamp" "dataTime"
#> [4] "dataTimeStamp" "ucscGenomes"
## 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))
## > }