trakt_get | R Documentation |
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.
trakt_get(url, client_id = Sys.getenv("trakt_client_id"), HEAD = FALSE)
url |
|
client_id |
|
HEAD |
|
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.
The parsed (jsonlite::fromJSON()
) content of the API response.
An empty tibble() if the response is an empty
JSON
array.
No OAuth2 methods are supported yet, meaning you don't have access to
POST
methods or user information of non-public profiles.
Other API-basics:
trakt_credentials()
,
trakt_get_token()
# A simple request to a direct URL
trakt_get("https://api.trakt.tv/shows/breaking-bad")
# A HEAD-only request
# useful for validating a URL exists or the API is accessible
trakt_get("https://api.trakt.tv/users/jemus42", HEAD = TRUE)
# Optionally be lazy about URL specification by dropping the hostname:
trakt_get("shows/game-of-thrones")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.