Report Data API

This article provides sample API calls to manipulate Reports.

PREREQUISITES:

  1. Set up API access.
  2. Verify that you have API access.
  3. Obtain a token via a get token call since all API calls require a token.

Table of contents:

  1. Retrieve a Report
  2. Create a Report
  3. Update a Report
  4. Delete a Report

1. Retrieve a Report

  • The GET request to /api/report retrieves all Reports.
  • The GET request to /api/report/id/<id> retrieves the specified Report.
  1. Item: report.
  2. Method: GET.
  3. ID: Specify Report ID to retrieve data only for that Report.
    • Report ID can be obtained from the URL of the Report Editor: <hostname>/editor/element/report/152753.
  4. Enter API token.
  5. [Run Request]

Example Response

{
  "reports": [
    {
      "id": 1197,
      "keep_history": "Y",
      "dataset_id": 147,
      "dataset_filter_id": 0,
      "measurement_interval": 3,
      "dimension": 0,
      "name": "CNN Daily News",
      "description": "CNN Daily News",
      "category": 62,
      "max_time_before_expired_period": 1,
      "max_time_before_expired_unit": "day",
      "can_be_viewed_without_login": "N",
      "include_metric_data_table_in_e_mail_digests": "Y",
      "e_mail_digests_show_in_digest": "same as viewer",
      "show_numeric_null_values_as_zeroes": "blank",
      "business_owner_id": 19,
      "technical_owner_id": 19
    },
    {
      "id": 1203,
      "keep_history": "Y",
      "dataset_id": 28,
      "dataset_filter_id": 142,
      "measurement_interval": 3,
      "dimension": 0,
      "name": "Active Jira Tickets",
      "description": "Active Jira Ticket",
      "category": 14,
      "max_time_before_expired_period": 1,
      "max_time_before_expired_unit": "year",
      "can_be_viewed_without_login": "N",
      "include_metric_data_table_in_e_mail_digests": "Y",
      "e_mail_digests_show_in_digest": "same as viewer",
      "show_numeric_null_values_as_zeroes": "blank",
      "business_owner_id": 19,
      "technical_owner_id": 19
    }
  ]
}

Fields Description

Parameter NameValue TypeDescription
idintegerThe ID of the Report.
keep_historystringWhether the Report is sourced from a Snapshot Dataset.
dataset_idintegerThe ID of the source Dataset.
dataset_filter_idintegerThe ID of the source Dataset View.
measurement_intervalintegerThe ID of the source Dataset’s measurement interval.
dimensionintegerThe ID of the Report’s dimension.
  • Take value zero if the Report is not dimensioned. 
namestringThe name of the Report.
descriptionstringThe description of the Report.
categoryintegerThe ID of the Report’s category.
max_time_before_expired_periodstringThe time period after which the Report expires.
can_be_viewed_without_loginstringWhether this Dataset Report will be visible to all Users that have access to it or only to you («Y»/«N»).
show_numeric_null_values_as_zeroesstringWhether the NULL values will be shown as a blank space or a zero («blank»/«zero»). 
business_owner_idintegerThe ID of the Report Business Owner.
technical_owner_idinteger

The ID of the Report Technical Owner.

2. Create a Report

  • The POST request to /api/report creates a new Report.
  1. Item: report.
  2. Method: POST.
  3. ID: Specify ID of an already existing Report.
  4. Select JSON request and enter JSON providing the needed values for your Report:
    • Required parameters: name, category.
    • All parameters that were not provided manually will be assigned default values.
    • See Fields Description for details on Report's optional parameters.
  5. Enter API token.
  6. [Run Request]

3. Update a Report

Execute the following request to update a Report:

fetch("/api/report/id/<id>", { method: "PUT", headers: { "Authorization": `Bearer <MI API Token>`, "Content-Type": "application/json" }, body: JSON.stringify(<Report data JSON>) });

Replace the following with the actual values:

Example request:

const token = "<MI API token>";

const data = {
  id: 152753,
  keep_history: "Yes",
  dataset_id: 21418,
  dataset_filter_id: 355,
  measurement_interval: 3,
  dimension: 0,
  name: "Fruit Sales Report 2025",
  category: 123,
  dataset_source: "21418_355",
  max_time_before_expired_period: 2,
  can_be_viewed_without_login: "public",
  show_numeric_null_values_as_zeroes: "blank",
  business_owner_id: 238,
  technical_owner_id: 238
};

fetch("/api/report/id/152753", {
  method: "PUT",
  headers: {
    "Authorization": `Bearer ${token}`,
    "Content-Type": "application/json"
  },
  body: JSON.stringify(data)
});

4. Delete a Report

The DELETE request to /api/report/id/<id> deletes a selected Report.

  1. Item: report.
  2. Method: DELETE.
  3. ID: Specify ID of the Report that needs to be deleted.
  4. Enter API token.
  5. [Run Request]