Skip to contents

Retrieves 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. Falls back to customer_id; one of the two is required.

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"

Value

Data frame containing boat information

Two API limitations

There is no way to query without a customer filter, so customers and customer_id cannot both be NULL. Supplying imeis also appears to override customers server-side, so a request scoped to one customer can return another's boats — do not trust the two together.

Examples

if (FALSE) { # \dontrun{
# One customer's boats
boats <- get_pelagic_boats(
  token = auth_response$token,
  customers = "customer1-id"
)

# Several customers, with only the columns needed
boats_minimal <- get_pelagic_boats(
  token = auth_response$token,
  customers = c("customer1-id", "customer2-id"),
  columns = c("id", "name", "devices.imei")
)
} # }