build_monarch_url: Builds URL for a monarch GET request.

View source: R/utils.R

build_monarch_urlR Documentation

Builds URL for a monarch GET request.

Description

The path needs to be safely encoded.

Usage

build_monarch_url(path, query = NULL)

Arguments

path

A path as a list to the monarch resource to use.

query

A list of url parameter settings. TRUE FALSE set to "true" "false".

Details

But the query apparently will be re-encoded, even if it is already encoded. So it is best not to do any or our own encoding on the query list.

url <- httr::modify_url("https://api.monarchinitiative.org", path = "test query = list(x='this_is:ok', y="but_this_is "https://api.monarchinitiative.org/test

Value

URL as a safely encoded string.

See Also

URLencode

Examples

m_path <- "/api/bioentity/gene"
gene <- "NCBIGene%3A8314"
url <- build_monarch_url(path = list(m_path, gene),
                         query = list(rows = 100,
                         fetch_objects = "true",
                         format = "json"))
url <- build_monarch_url(path = list(m_path, gene),
                         query = list(rows = 100,
                         fetch_objects = TRUE,
                         unselect_evidence=FALSE,
                         format = "json"))
url <- build_monarch_url(path = list(m_path, gene),
                         query = list(rows = 100,
                         fetch_objects = TRUE,
                         unselect_evidence=NULL,
                         format = "json"))

charlieccarey/monarchr documentation built on Dec. 12, 2023, 12:57 p.m.