Skip to main content

Report Service

The report service gives you access to reports generated from the report configurations

Report REST API​

The report REST API is a full CRUD API and is accessed through the following URL:

https://api.opendatadsl.com/api/report

The API consists of the following calls:

MethodPathExampleDescription
GETGet the build information for this service
GET{release}/{source}'v1/public' 'v1/private'List public or private reports
GET{release}/{source}/{key}v1/private/TESTGet a ReportDates timeseries containing the dates for which the report is available
GET{release}/{source}/{key}:{ondate}v1/private/TEST:2024-06-12Retrieve the latest version of the report for the supplied date
GET{release}/{source}/{key}:{ondate}/{version}v1/private/TEST:2024-06-12/1Retrieve a version of a report for the supplied date
GET{release}/{source}/{key}:{ondate}/*v1/private/TEST:2024-06-12/*Get a list of versions for a specific report for the supplied date
PUT{release}/{source}/{key}:{ondate}/{version}/{tag}v1/private/TEST:2024-06-12/1/PRODTag a version with a name (which can be used instead of the version number when retrieving it)
POST{release}/{source}/{key}:{ondate}v1/private/TEST:2024-06-12Update a manual report, the data is in the body of the POST request
POST{release}/{source}/{key}:{ondate}v1/private/TEST:2024-06-12Run the report, the POST body must be empty
POST{release}/{source}?_test=true&_ondate={ondate}v1/private?_test=true&_ondate=2024-06-12Run an unsaved report configuration (the body, with _type VarReportConfiguration) for a date and return the report without saving it
DELETE{release}/{source}/{key}:{ondate}v1/private/TEST:2024-06-12Delete a report version, this has the effect of rolling back to the previous version
DELETE{release}/{source}/{key}:{ondate}/{version}v1/private/TEST:2024-06-12/1Delete a version of a report
DELETE{release}/{source}/{key}:{ondate}/*v1/private/TEST:2024-06-12/*Fully delete a report, including all versions

Report dates​

Instead of a date, the last part of the id can be a relative date:

IdExampleReport
key:LTEST:LThe latest report
key:L-nTEST:L-1The report n dates before the latest one
key:-dateTEST:-2024-06-12The report for the date, or the latest one before it
key:<dateTEST:<2024-06-12The latest report before the date

Query parameters​

ParameterExampleDescription
_run_run=trueRuns the report now for its default range (or _range) and returns it without saving it
_range_range=between(2024-06-01,2024-06-12)The date range used when running a report
_ondate_ondate=2024-06-12The report date used with _test
_properties_properties={"region":"NW"}Properties added to the report's properties, so its template can use them
_template_template=%23MyReportTemplateThe mustache template used when you ask for Accept: text/html. Without it, the report configuration's own template is used
_report_format_report_format=text/csvFormats the report data as CSV, TSV, XML or HTML and returns it as a string in the data property of the JSON response
_element_element=spreadFor a composition report: returns one element (column) of the composition as a curve or timeseries
_indexes_only_indexes_only=trueWith the report dates (key without a date), returns just the dates, with the first and last date
_raw_raw=trueWith a key without a date: returns the report configuration instead of the report dates

When the Excel add-in lists reports (the x-odsl-app header is exceladdin), reports with the hideExcel property are left out.

note

A fixed report with mergeUpdates set to true merges each update for a date into the stored report instead of creating a new version. See Daily status reports.

Entities​

Report​

A report is a Report Configuration with the following additional proeprties:

NameDescriptionType
ondateThe date of the reportString
dataThe actual data for the report, can be any json dataObject
scriptVersionThe version of the script used to run this reportInteger
errorMessageThe error message if this report failed to runString
startThe start date used for the reportString
endThe end date used for the reportString

Examples​

### Get build info
GET {{url}}/report
Authorization: Bearer {{token}}

### List all private reports
GET {{url}}/report/v1/private
Authorization: Bearer {{token}}

### List all private report names
GET {{url}}/report/v1/private?_project=name
Authorization: Bearer {{token}}

### Get a list of report dates
GET {{url}}/report/v1/private/METRICS
Authorization: Bearer {{token}}

### Dynamically run a report using the default range
GET {{url}}/report/v1/private/METRICS
?_run=true
Authorization: Bearer {{token}}

### Dynamically run a report using a specified range
GET {{url}}/report/v1/private/METRICS
?_run=true
&_range=between(2023-01-01,2023-05-28)
Authorization: Bearer {{token}}

### Run and save a report - with ondate and range
POST {{url}}/report/v1/private/TEST3:2023-07-01
?_range=between(2023-05-18,2023-05-18T23:59:59)
Authorization: Bearer {{token}}

### Get a dated report
GET {{url}}/report/v1/private/METRICS:2023-05-18
Authorization: Bearer {{token}}

### Get a dated report HTML
GET {{url}}/report/v1/private/METRICS:2023-05-18
Authorization: Bearer {{token}}
Accept: text/html

### Get a dated report version
GET {{url}}/report/v1/private/METRICS:2023-05-18/1
Authorization: Bearer {{token}}

### Get a list of dated report versions
GET {{url}}/report/v1/private/METRICS:2023-05-18/*
Authorization: Bearer {{token}}

### Tag a dated report version
PUT {{url}}/report/v1/private/METRICS:2023-05-18/1/PROD
Authorization: Bearer {{token}}

### Get a tagged dated report version
GET {{url}}/report/v1/private/METRICS:2023-05-18/PROD
Authorization: Bearer {{token}}

### Delete a version of a report
DELETE {{url}}/report/v1/private/METRICS:2023-05-18
Authorization: Bearer {{token}}

### Fully delete a report date
DELETE {{url}}/report/v1/private/METRICS:2023-05-18/*
Authorization: Bearer {{token}}