TABLE OF CONTENTS



Endpoints

The following endpoints are used to create, update/maintain, and delete report definitions.  For more information about ACME report definitions, including information about query types and available fields, please review the ACME Reporting documentation.


Method


Endpoint


Actions


Request Payload


Response Payload


GET

/v2/b2b/analytics/report/definitions

Retrieve a list of all existing report definitions

None

List of Report Definitions

GET

/v2/b2b/analytics/report/definitions/{id}

Get a report definition object for a single report

None

Report Definition

POST

/v2/b2b/analytics/report/definitions

Create a new report definition

Report Definition

Report Definition

PUT

/v2/b2b/analytics/report/definitions/{id}

Update an existing report definition

Report Definition

Report Definition

DELETE

/v2/b2b/analytics/report/definitions/{id}

Delete an existing report definition

None

Deleted Report Definition


Sample Request Payloads

Simple transaction report with no grouping or filtering

{
"name": "Transaction Report Sample Object",
"description": "A sample payload for a report based on the Transactions dataset.",
"displayCollectionName": "Transactions",
"queryExpression": {
"collectionName": "Transactions",
"limit": 0,
"findFields": [{
"fieldName": "TransactionType",
"include": true
}, {
"fieldName": "TransactionDate",
"include": true
}, {
"fieldName": "EventName",
"include": true
}, {
"fieldName": "Quantity",
"include": true
}, {
"fieldName": "DiscountedAmount",
"include": true
}]
},
"dateSettings": {
"dateRangeField": "TransactionDate",
"datePreset": "today",
"startDate": null,
"endDate": null
}
}


Transaction report with grouping, filtering, summarizing, and counting

{
"name": "Transaction Report Sample Object",
"description": "A sample payload for a report based on the Transactions dataset.",
"displayCollectionName": "Transactions",
"queryExpression": {
"collectionName": "Transactions",
"limit": 0,
"findFields": [{
"fieldName": "TransactionType",
"include": true
}, {
"fieldName": "TransactionDate",
"include": true
}, {
"fieldName": "EventName",
"include": true
}, {
"fieldName": "Quantity",
"include": true
}, {
"fieldName": "DiscountedAmount",
"include": true
}],
"findQueries": [{
"fieldName": "TransactionType",
"operator": "contains",
"fieldValue": "Sale,RefundSale"
}],
"groupFields": [{
"fieldName": "EventStartTime",
"groupFunction": "DayMonthYear"
}, {
"fieldName": "EventName",
"groupFunction": ""
}],
"summaryFields": [{
"fieldName": "DiscountedAmount",
"summaryFunction": "Sum"
}],
"countFields": [{
"fieldName": "OrderId",
"countFunction": "Count"
}]
},
"dateSettings": {
"dateRangeField": "TransactionDate",
"datePreset": "last_month",
"startDate": null,
"endDate": null
}
}


NOTE: While reports that are grouped, summarized and counted will only display the fields enumerated in the groupFields, summaryFields and countFields objects, at least one field is required in the findFields object.

Sample Responses

Simple transaction report with no grouping or filtering

{
"id": "5e1354d760309f414874eecf",
"name": "Transaction Report Sample Object",
"description": "A sample payload for a report based on the Transactions dataset.",
"displayCollectionName": "Transactions",
"queryExpression": {
"collectionName": "Transactions",
"findFields": [
{
"fieldName": "TransactionType",
"include": true
},
{
"fieldName": "TransactionDate",
"include": true
},
{
"fieldName": "EventName",
"include": true
},
{
"fieldName": "Quantity",
"include": true
},
{
"fieldName": "DiscountedAmount",
"include": true
}
],
"limit": 0
},
"customReport": false,
"createdOn": "Mon Jan 06 15:40:07 UTC 2020",
"createdBy": "575",
"updatedOn": "Mon Jan 06 15:40:07 UTC 2020",
"updatedBy": "575",
"dateSettings": {
"dateRangeField": "TransactionDate",
"datePreset": "today"
},
"isCurrentUserReportOwner": true,
"acmeDefault": false
}

 

Transaction report with grouping, filtering, summarizing, and counting

{
"id": "5e13548b60309f414874eecd",
"name": "Transaction Report Sample Object",
"description": "A sample payload for a report based on the Transactions dataset.",
"displayCollectionName": "Transactions",
"queryExpression": {
"collectionName": "Transactions",
"findQueries": [
{
"fieldName": "TransactionType",
"fieldValue": "Sale,RefundSale",
"operator": "contains"
}
],
"findFields": [
{
"fieldName": "TransactionType",
"include": true
},
{
"fieldName": "TransactionDate",
"include": true
},
{
"fieldName": "EventName",
"include": true
},
{
"fieldName": "Quantity",
"include": true
},
{
"fieldName": "DiscountedAmount",
"include": true
}
],
"groupFields": [
{
"fieldName": "EventStartTime",
"groupFunction": "DayMonthYear"
},
{
"fieldName": "EventName",
"groupFunction": null
}
],
"summaryFields": [
{
"fieldName": "DiscountedAmount",
"summaryFunction": "Sum"
}
],
"countFields": [
{
"fieldName": "OrderId",
"countFunction": "Count"
}
],
"limit": 0
},
"customReport": false,
"createdOn": "Mon Jan 06 15:38:51 UTC 2020",
"createdBy": "575",
"updatedOn": "Mon Jan 06 15:38:51 UTC 2020",
"updatedBy": "575",
"dateSettings": {
"dateRangeField": "TransactionDate",
"datePreset": "last_month"
},
"isCurrentUserReportOwner": true,
"acmeDefault": false
}


NOTES: 
- The customReport attribute has been depreciated and is no longer in use.
- Setting acmeDefault to true will lock the report so that no user (including an API user) can edit the report. To edit a locked report, set the acmeDefault attribute to false.