do_query: Execute a query on the remove API

View source: R/utils.R

do_queryR Documentation

Execute a query on the remove API

Description

This function allows you to call methods which are not specifically exposed by this API yet

Usage

do_query(
  endpoint,
  args = NULL,
  method = "GET",
  process_response = (method == "GET")
)

Arguments

endpoint

the API endpoint to call, with or without the canvas domain. You can give a vector of parts which will be joined with slashes.

args

a list of arguments for the call

method

GET or POST

process_response

if TRUE (default for GET requests), paginate results and return a data frame

Value

A data.frame if process_response is TRUE, otherwise an httr response

Examples

# A get request to the announcements endpoint (replicating get_announcements):
do_query("announcements", list(`context_codes[]`="course_1234"))

# A post request to the group membership endpoint (replicating add_group_user):
do_query(c("groups", 123, "memberships"), list(user_id=1), method = "POST")

daranzolin/rcanvas documentation built on May 18, 2024, 2:33 p.m.