Skip to contents

Core function to retrieve data from cBioPortal API.

Usage

cbp_api(
  url_path,
  method = NULL,
  token = get_cbioportal_token(),
  body = NULL,
  extra_box = FALSE,
  quiet = TRUE,
  base_url = NULL
)

Arguments

url_path

The url path for API call

method

Which API method to use. Must be "get" or "post". Default is "get".

token

Authentication token, if needed. Default is get_cbioportal_token()

body

Arguments passed to API call (e.g. sample ID or gene IDs)

extra_box

Some functions require an additional list() wrapping around body idk why

quiet

Returns queried URL. Default is TRUE

base_url

The database URL to query

Value

A parsed API response

Examples

# \dontrun{
cbp_api(url_path = "genes/TP53", base_url = "public")
#> $content
#> $content$entrezGeneId
#> [1] 7157
#> 
#> $content$hugoGeneSymbol
#> [1] "TP53"
#> 
#> $content$type
#> [1] "protein-coding"
#> 
#> 
#> $path
#> [1] "api/genes/TP53"
#> 
#> $response
#> Response [https://www.cbioportal.org/api/genes/TP53]
#>   Date: 2024-11-25 16:44
#>   Status: 200
#>   Content-Type: application/json
#>   Size: 69 B
#> 
#> 
#> attr(,"class")
#> [1] "cbp_api"
# }