Skip to contents

This function creates a pre-configured HTTP request object for interacting with the LinkedIn API. It sets the API endpoint version, essential headers, and includes authentication.

Usage

li_req(endpoint_version = "rest", ...)

Arguments

endpoint_version

A string specifying the LinkedIn API endpoint version. Defaults to "rest". Other possible values include "v2" for specific API versions.

...

Additional arguments passed to the li_req_auth() function for authentication configuration.

Value

An HTTP request object with default headers and authentication configured, which can be used with other httr2 methods to perform API queries.

Details

The function initializes a request targeting the LinkedIn API's base URL (https://api.linkedin.com) and appends the specified endpoint version to the URL path. It sets headers for API versioning, protocol compatibility, and Content-Type. Authentication is handled through li_req_auth().

Examples

if (FALSE) { # \dontrun{
# Create a request with default settings
req <- li_req()

# Create a request object
req <- li_req(
    endpoint_version = "v2",
    token = Sys.getenv("LI_TOKEN")
)
} # }