request: call API with authentication and specified filters (GET or...

View source: R/http.r

requestR Documentation

call API with authentication and specified filters (GET or POST)

Description

Either provide the branch and param, or provide a full url with param included (ignoring param). If post is used, it is possible to provide the json_data directly (ignoring param)

Usage

request(
  branch = NULL,
  param = list(),
  json_data = NULL,
  post = FALSE,
  post_options = list(),
  read = T,
  conn = conn_from_env(),
  ...
)

Arguments

branch

a character vector with the names of the API resources. For example, use c('projects','articlesets') for the url host/api/v4/projects/articlesets

param

a named vector or list of parameters, e.g. c(project=2, articleset=3)

json_data

For sending (post = TRUE) data, directly provide the json body. If used, the param argument is ignored.

post

use HTTP POST instead of GET

post_options

a list with options for HTTP POST (if post is TRUE)

read

If TRUE, read the content from the response. Otherwise, return the response object

conn

an API connection

...

parameters (param) in name-value pairs

Value

the response


ccs-amsterdam/ccsAnnotator documentation built on March 19, 2024, 2:14 a.m.