Skip to contents

Constructs an API request to the Uppsala Conflict Data Program (UCDP) API using specified parameters, including the resource, API version, page size, and page number(s). This function allows for both single and multiple page requests.

Usage

cl_build_request(resource, version, pagesize, page, params)

Arguments

resource

A character string specifying the resource path for the API (e.g., "conflict", "actor").

version

A character string indicating the version of the API to use (e.g., "v1", "v2").

pagesize

An integer specifying the number of records per page. Must be a positive number.

page

An integer or vector of integers indicating the page number(s) to request. If a single number is provided, the function returns a single request; if a vector of numbers is provided, a list of requests is returned.

params

A list of validated params returned by cl_check_params.

Value

If a single page number is provided, the function returns a httr2_request object. If multiple page numbers are provided, the function returns a list of httr2_request objects.