BambooHR.Reports (BambooHR v0.5.0)

Copy Markdown View Source

Functions for interacting with saved custom reports in the BambooHR API.

Covers the current, non-deprecated "Custom Reports" endpoints only. The older /reports/custom and /reports/{id} endpoints are deprecated in favour of these, and the newer Datasets API (which replaces ad-hoc reporting entirely) lives under /v1_2 and /v2 — a different API version prefix than the rest of this client supports — so it's out of scope here.

Summary

Functions

Executes a saved custom report and returns its data.

Retrieves a paginated list of saved custom reports available in the account.

Functions

get_report(client, report_id, params \\ %{})

@spec get_report(BambooHR.Client.t(), integer(), map()) :: BambooHR.Client.response()

Executes a saved custom report and returns its data.

The "data" array contains one flat map per employee record, keyed by the fields selected when the report was created.

Parameters

  • client - Client configuration created with BambooHR.Client.new/1
  • report_id - The numeric ID of the saved custom report to execute
  • params - Optional query params: "page" (default 1) and "page_size" (default 500, max 1000)

Examples

iex> BambooHR.Reports.get_report(client, 42)
{:ok, %{"data" => [%{"firstName" => "John", "status" => "Active"}], "aggregations" => []}}

list_reports(client, params \\ %{})

@spec list_reports(BambooHR.Client.t(), map()) :: BambooHR.Client.response()

Retrieves a paginated list of saved custom reports available in the account.

Each entry contains an "id" and a "name"; pass the "id" to get_report/3 to execute the report and retrieve its data.

Parameters

  • client - Client configuration created with BambooHR.Client.new/1
  • params - Optional query params: "page" (default 1) and "page_size" (default 500, max 1000)

Examples

iex> BambooHR.Reports.list_reports(client)
{:ok, %{"reports" => [%{"id" => 42, "name" => "Headcount by Department"}]}}