List report presets
const url = 'https://apibase.ecomweb.app/api/v1/stores/example/reports/presets';const options = {method: 'GET', headers: {'x-api-key': '<x-api-key>'}};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request GET \ --url https://apibase.ecomweb.app/api/v1/stores/example/reports/presets \ --header 'x-api-key: <x-api-key>'Returns the built-in reports. Each preset carries a definition you can run as it is after replacing its placeholder date_range. last_viewed_at and pinned are personal to the user the API key acts as.
Required scopes: read:analytics
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”The store’s ref, as returned by GET /stores.
Responses
Section titled “Responses”object
The presets.
object
Group the preset belongs to.
The preset’s definition. Its date_range is a placeholder: replace it with the days you want before running it.
object
Dimensions to group by.
object
Time grain for a date dimension: day, week, month, quarter or year.
Key of a dimension of the report’s dataset.
Conditions that narrow the rows.
object
How the values are compared.
Key of a filter of the report’s dataset.
The values to compare with. is and is_not match any of the values.
The days the report covers.
object
First day, inclusive, as YYYY-MM-DD in the store’s time zone.
Last day, inclusive, as YYYY-MM-DD in the store’s time zone.
How the rows are sorted.
object
Sort direction.
Key of a selected measure or dimension.
How the dashboard draws the report. It does not change the rows.
Version of the definition format.
Key of the dataset the report reads, such as orders.
Keys of the measures to calculate.
Maximum number of rows.
Stable preset key.
Translation key of the preset’s name.
When the user behind the key last viewed the preset, as an ISO 8601 timestamp, or null.
Whether that user pinned the preset.
Example
{ "data": [ { "category": "sales", "definition": { "dimensions": [ { "grain": "day" } ], "filters": [ { "operator": "is" } ], "sort": [ { "order": "asc" } ], "visualization": "table" } } ]}The key is missing, invalid, revoked or expired.
object
The HTTP status code.
What went wrong; validation failures list one message per problem.
The HTTP status text, such as Bad Request.
object
A stable, machine-readable error code.
A human-readable explanation.
Extra context about the error, when there is any.
object
When the error happened, as an ISO 8601 timestamp.
Example generated
{ "statusCode": 1, "message": [ "example" ], "error": "example"}The key may not do this: a missing scope, a readonly key, a publishable key on a Store API route, or a disallowed origin.
object
The HTTP status code.
What went wrong; validation failures list one message per problem.
The HTTP status text, such as Bad Request.
object
A stable, machine-readable error code.
A human-readable explanation.
Extra context about the error, when there is any.
object
When the error happened, as an ISO 8601 timestamp.
Example generated
{ "statusCode": 1, "message": [ "example" ], "error": "example"}