api_query: Wrapper for sending queries and payloads to API

View source: R/query.R

api_queryR Documentation

Wrapper for sending queries and payloads to API

Description

There are a number of different GET and POST endpoints in the GWAS database API. This is a generic way to access them.

Usage

api_query(
  path,
  query = NULL,
  opengwas_jwt = get_opengwas_jwt(),
  method = "GET",
  silent = TRUE,
  encode = "json",
  timeout = 300
)

Arguments

path

Either a full query path (e.g. for get) or an endpoint (e.g. for post) queries

query

If post query, provide a list of arguments as the payload. NULL by default

opengwas_jwt

Used to authenticate protected endpoints. Login to https://api.opengwas.io to obtain a jwt. Provide the jwt string here, or store in .Renviron under the keyname OPENGWAS_JWT.

method

"GET" (default) or "POST", "DELETE" etc

silent

TRUE/FALSE to be passed to httr call. TRUE by default

encode

Default = "json", see httr::POST for options

timeout

Default = 300, avoid increasing this, preferentially simplify the query first.

Value

httr response object


MRCIEU/ieugwasr documentation built on April 25, 2024, 8:32 p.m.