call_endpoint: Call an API Endpoint

View source: R/client.R

call_endpointR Documentation

Call an API Endpoint

Description

Sends an HTTP request to a specified API endpoint using the stored bearer token for authentication.

Usage

call_endpoint(method, endpoint, params = list(), data = NULL)

Arguments

method

The HTTP method (e.g., "GET", "POST", "PUT", "DELETE").

endpoint

The API endpoint (e.g., '/api/projects').

params

A named list of query parameters (optional).

data

A named list or 'JSON' object to include in the request body (optional).

Value

A list containing the API response.

Examples

## Not run: 
response <- call_endpoint("GET", "/api/projects")
print(response)

## End(Not run)

viafoundry documentation built on April 4, 2025, 12:35 a.m.