Skip to main content

Run a Report

Zuora

Run a Report

Contact Zuora Global Support to enable this feature in your tenant. This feature is currently in development and is subject to change without advance notice.

The Run a Report Reporting API starts a new report run and returns the ReportRunId.  

Run a Report requires the ReportId value as a request path value. You can obtain the ReportId from the id value in the JSON response to a call of Search by Report Names or you can get it definitively from the response to the Create a Report call. 

Request

Environment Request
API Sandbox (US Data Center) POST https://zconnectsandbox.zuora.com/api/rest/v1/reports/{ReportId}/reportrun?viewType={viewType} 
Production (US Data Center) POST https://zconnect.zuora.com/api/rest/v1/reports/{ReportId}/reportrun?viewType={viewType}
API Sandbox (EU Data Center) POST https://zconnect.sandbox.eu.zuora.com/api/rest/v1/reports/{ReportId}/reportrun?viewType={viewType}
Production (EU Data Center) POST https://zconnect.eu.zuora.com/api/rest/v1/reports/{ReportId}/reportrun?viewType={viewType}
API Sandbox(US Cloud Data Center) POST https://zconnect.sandbox.na.zuora.com/api/rest/v1/reports/{ReportId}/reportrun?viewType={viewType} 
Production (US Cloud Data Center) POST https://zconnect.na.zuora.com/api/rest/v1/reports/{ReportId}/reportrun?viewType={viewType}
US Central Sandbox POST https://zconnect-services0001.test.zuora.com/api/rest/v1/reports/{ReportId}/reportrun?viewType={viewType}
EU Central Sandbox POST https://zconnect-services0002.test.eu.zuora.com/api/rest/v1/reports/{ReportId}/reportrun?viewType={viewType}

The Run a Report POST request body must be submitted as JSON content.  Set the body content type to "application/json" in the request header: Content-Type: application/json

Request Path Parameters

ReportId

required

path

The unique identifier for a report.

You can obtain the ReportId from the id value in the JSON response to a call of Search by Report Names or you can get it definitively from the response to the Create a Report call.

viewType required query

The value of viewType must be either Detail or Summary depending on the report definition.

Request Body

You can use the request body of Run a Report to specify filters to apply when running the report. However, you should only specify filters if you need to override the filters that are defined in the report.

Instead of specifying filters in the request body of Run a Report, you can define filters via the report builder in the Zuora UI. For example:

Reporting_Filters_For_API_2.png

To specify these filters when calling Run a Report, submit the following JSON in the request body:

[
  {
    "logicalOperator": {
      "value": "OR",
      "label": "OPERATOR_OR",
      "name": "or"
    },
    "filterClauses": [
      {
        "field": {
          "name": "Name",
          "id": "Product.Name",
          "label": "Name",
          "type": "text",
          "custom": false,
          "virtual": false,
          "filterable": true,
          "sortable": true,
          "groupable": true,
          "fxEnabled": false,
          "order": 8,
          "dataSourceName": "Product",
          "dataSourceLabel": "Product",
          "dataSourceType": "Product",
          "searchKey": "Product Name"
        },
        "value": "Hockey",
        "operator": {
          "name": "contains",
          "value": "contains"
        }
      },
      {
        "field": {
          "name": "EffectiveStartDate",
          "id": "Product.EffectiveStartDate",
          "label": "Effective Start Date",
          "type": "date",
          "custom": false,
          "virtual": false,
          "filterable": true,
          "sortable": true,
          "groupable": true,
          "fxEnabled": false,
          "order": 6,
          "dataSourceName": "Product",
          "dataSourceLabel": "Product",
          "dataSourceType": "Product",
          "searchKey": "Product Effective Start Date"
        },
        "value": "2018-03-31",
        "operator": {
          "name": "is greater than",
          "value": ">"
        }
      }
    ]
  }
]

Response

A successful call to Run a Report will return the ID of the report run (reportRunId). Use this ID with Get Report Run to check the status of the report run.

To retrieve the results of the completed report run, use Get Report Data or Export Report Run.

The ID of the report run expires after 60 days.

Example

Request URL:

POST https://zconnectsandbox.zuora.com/api/rest/v1/reports/ff808081529f4e3401529fd373730070/reportrun?viewType=Detail

Request body:

[
  {
    "field": {
      "name": "CreatedDate",
      "id": "Product.CreatedDate",
      "label": "Created Date",
      "type": "datetime",
      "sortDir": "ASC",
      "dataSourceName": "Product",
      "dataSourceLabel": "Product",
      "searchKey": "Product Created Date",
      "filterable": true,
      "sortable": true,
      "groupable": true
    },
    "operator": "<",
    "value": "2017-07-06T03:00:02.822Z"
  }
]
{
  "success": true,
  "response": {
    "reportRunId": "ff808081529f4e3401529fd61f080074"
  }
}