trakt_get: Make an API call and receive parsed output

View source: R/api-requests.R

trakt_getR Documentation

Make an API call and receive parsed output

Description

The most basic form of API interaction: Querying a specific URL and getting its parsed result. If the response is empty, the function returns an empty tibble(), and if there are date-time variables present in the response, they are converted to POSIXct via lubridate::ymd_hms() or to Date via lubridate::as_date() if the variable only contains date information.

Usage

trakt_get(url)

Arguments

url

character(1): The API endpoint. Either a full URL like "https://api.trakt.tv/shows/breaking-bad" or just the endpoint like shows/breaking-bad.

Details

See the official API reference for a detailed overview of available methods. Most methods of potential interest for data collection have dedicated functions in this package.

Value

The parsed content of the API response. An empty tibble() if the response is an empty JSON array.

Examples

# A simple request to a direct URL
trakt_get("https://api.trakt.tv/shows/breaking-bad")

# Optionally be lazy about URL specification by dropping the hostname:
trakt_get("shows/game-of-thrones")

jemus42/tRakt documentation built on June 13, 2025, 10:18 p.m.