Get Boats from Pelagic Analytics API (with server-side filtering)
Source:R/pds-api.R
get_pelagic_boats.RdRetrieves boat information from the Pelagic Analytics API for a specified customer. Supports server-side filtering to reduce data transfer and processing time.
Usage
get_pelagic_boats(
token,
customers = NULL,
boats = NULL,
imeis = NULL,
columns = NULL,
refresh_token = NULL,
username = NULL,
password = NULL,
customer_id = NULL,
base_url = "https://analytics.pelagicdata.com"
)Arguments
- token
Character. Access token obtained from pelagic_auth()
- customers
Character vector. Customer IDs to filter by. If NULL, uses default customer.
- boats
Character/Numeric vector. Boat IDs to filter by. If NULL, returns all boats.
- imeis
Character/Numeric vector. IMEI numbers to filter by. If NULL, returns all devices.
- columns
Character vector. Specific columns to extract. If NULL, returns all columns.
- refresh_token
Character. Optional refresh token for automatic token refresh
- username
Character. Optional username for re-authentication if refresh fails
- password
Character. Optional password for re-authentication if refresh fails
- customer_id
Character. Default customer ID if customers parameter is NULL
- base_url
Character. Base URL for the API. Default is "https://analytics.pelagicdata.com"
Examples
if (FALSE) { # \dontrun{
# Get all boats (default)
boats_all <- get_pelagic_boats(auth_response$token)
# Get boats with specific IMEIs (server-side filtering)
boats_filtered <- get_pelagic_boats(
token = auth_response$token,
imeis = c("864352046XXXX", "1234567890XXXX")
)
# Get boats for multiple customers
boats_multi_customer <- get_pelagic_boats(
token = auth_response$token,
customers = c("customer1-id", "customer2-id")
)
# Combine server-side filtering with column selection
boats_minimal <- get_pelagic_boats(
token = auth_response$token,
imeis = "864352046XXXXX",
columns = c("id", "name", "devices.imei")
)
} # }