latestOpenAPI 3.1.02026-08-1031319.3 KB

68d401c79425

Custom reports

Custom report saved in the app

Executes a custom report and returns the results. Custom reports are created at app.swarmia.com/explore. The id parameter expected by the API is the UUID shown in the report's URL in the app (query parameter activeReport=<UUID>).

The response shape (columns, aggregates, grouping) is fully determined by the report. The schema object in the response describes each column so consumers can interpret the dynamic result.

Results are paginated. Use limit / offset to page through the rows; the response carries a pagination object (hasMore, nextOffset, and totalRows when includeTotal=true). When more rows are available, the next page's offset is also returned in the Link: …; rel="next" and X-Swarmia-Next-Offset response headers, which you can follow rather than computing offsets yourself.

CSV output (output=csv) ignores limit/offset and streams the full result set up to a cap of 10000 rows, setting the X-Swarmia-Result-Truncated: true header when the result was capped.

get/reports/custom/{id}

Path parameters

idstring uuid required

UUID of a custom report.

Query parameters

output'json' | 'csv'

Response format.

limitinteger

Maximum number of rows to return in one page. Must be a positive integer no larger than 1000. Defaults to 100 when omitted.

Ignored for output=csv, which always streams the full result set (see the text/csv response).

offsetinteger

Number of rows to skip before the page starts, for paging through a large result set. Must be a non-negative integer no larger than 100000. Defaults to 0.

Prefer following the nextOffset value (or the Link/ X-Swarmia-Next-Offset response header) rather than computing offsets yourself.

Ignored for output=csv.

includeTotalboolean

When true, the response pagination object includes a totalRows count of all rows matching the query (ignoring limit/offset). Computing the total is more expensive, so it is omitted by default.

timeframe.startstring date

Start of the reporting period (inclusive). When provided together with timeframe.end, overrides all timeframe filters embedded in the report. When omitted, the report's original timeframes are used as-is.

timeframe.endstring date

End of the reporting period (inclusive). Must be provided together with timeframe.start.

timezonestring

IANA timezone used to interpret the date-only timeframe.start and timeframe.end values and for time bucketing. Defaults to UTC.

Response

Successful response.

schemaobject required

Describes each property in rows. Keys are property names, values carry things like a human-readable title, description, etc. The exact properties depend on the report's configuration.

summaryRowobject

Aggregate across all rows. Same dynamic properties as each row but without _key. Only present when enabled in the report.