Analytics

Reports

A report is the basic building block of analysis in Mode. Every report lives in a Space, and can contain SQL queries, a Python or R Notebook, visualizations, report themes, etc.

You can use the reports resource to manage both individual Mode reports and all reports in a given Space.

Report object

Properties

token

required

string

id

required

integer

name

required

string

description

string

created_at

required

string

updated_at

required

string

edited_at

required

string

theme_id

required

integer

color_mappings

required

string

last_successful_sync_at

required

string

last_saved_at

required

string

archived

required

boolean

space_token

string

account_id

required

integer

account_username

required

string

public

required

boolean

full_width

required

boolean

manual_run_disabled

required

boolean

run_privately

required

boolean

drilldowns_enabled

required

boolean

layout

required

string

is_embedded

required

boolean

is_signed

required

boolean

shared

required

boolean

expected_runtime

required

number

last_successfully_run_at

required

string

last_run_at

required

string

web_preview_image

required

string

last_successful_run_token

required

string

flamingo_signature

string

github_link

string

query_count

required

string

chart_count

required

string

schedules_count

required

string

query_preview

required

string

_links

required

object

All resource responses contain a set of links that describe other related resources or actions that you can take on this resource. A link is comprised of two main pieces: its name (which describes its relationship to this resource) and its href (the URL of the related action or resource). All resources have at least a _self link which is the URL that will return a representation of this resource.

  • account
  • creator
  • csv_export
  • embed_key
  • last_run
  • last_successful_github_sync
  • last_successful_run
  • perspective_email_subscription_memberships
  • python_notebook
  • python_visualizations
  • queries
  • report_filters
  • report_pins
  • report_run
  • report_runs
  • report_schedules
  • report_subscriptions
  • report_theme
  • self
  • share
  • space
  • space_links
  • star
  • validate_email_subscriber
  • web
  • web_edit
  • web_external_url
  • web_report_runs
{
  "token": "flkgj3h2f24",
  "id": 73267438,
  "name": "culpa mollit",
  "created_at": "YYYY-MM-DDTHH:MM:SS.msZ",
  "updated_at": "YYYY-MM-DDTHH:MM:SS.msZ",
  "edited_at": "YYYY-MM-DDTHH:MM:SS.msZ",
  "theme_id": 37094832,
  "color_mappings": "nulla et esse ut",
  "last_successful_sync_at": "YYYY-MM-DDTHH:MM:SS.msZ",
  "last_saved_at": "YYYY-MM-DDTHH:MM:SS.msZ",
  "archived": false,
  "account_id": 51699936,
  "account_username": "labore dolore consequat anim non",
  "public": false,
  "full_width": true,
  "manual_run_disabled": false,
  "run_privately": true,
  "drilldowns_enabled": true,
  "layout": "id",
  "is_embedded": true,
  "is_signed": true,
  "shared": true,
  "expected_runtime": 90198048.20198965,
  "last_successfully_run_at": "YYYY-MM-DDTHH:MM:SS.msZ",
  "last_run_at": "YYYY-MM-DDTHH:MM:SS.msZ",
  "web_preview_image": "Ut",
  "last_successful_run_token": "af2g34t4hyrnt",
  "query_count": "anim adipisicing Lorem occaecat",
  "chart_count": "est elit",
  "schedules_count": "culpa id eiusmod dolore",
  "query_preview": "fugiat",
  "description": "Ut",
  "space_token": "fg32wrg534f",
  "flamingo_signature": "cillum sunt ea",
  "github_link": "veniam laborum",
  "_links": {
    "self": {
      "href": "commodo eu reprehenderit",
      "templated": false
    },
    "web": {
      "href": "cillum quis fugiat incididunt aute",
      "templated": false
    },
    "account": {
      "href": "Ut",
      "templated": false
    },
    "report_run": {
      "href": "Excepteur mollit irure",
      "templated": false
    },
    "queries": {
      "href": "occaecat magna sit Lorem",
      "templated": false
    },
    "report_runs": {
      "href": "cillum esse eu tempor",
      "templated": false
    },
    "report_pins": {
      "href": "et cillum ea",
      "templated": false
    },
    "report_schedules": {
      "href": "laborum adipisicing commodo",
      "templated": false
    },
    "python_visualizations": {
      "href": "sed ea",
      "templated": false
    },
    "embed_key": {
      "href": "aliquip commodo",
      "templated": false
    },
    "last_run": {
      "href": "ipsum ullamco laborum",
      "templated": false
    },
    "last_successful_run": {
      "href": "adipisicing in",
      "templated": false
    },
    "perspective_email_subscription_memberships": {
      "href": "magna laborum et ex amet",
      "templated": false
    },
    "report_theme": {
      "href": "qui labore dolor adipisicing",
      "templated": false
    },
    "last_successful_github_sync": {
      "href": "laborum in nostrud",
      "templated": false
    },
    "web_edit": {
      "href": "irure Excepteur consectetur",
      "templated": false
    },
    "web_external_url": {
      "href": "occaecat",
      "templated": false
    },
    "csv_export": {
      "href": "Lorem",
      "templated": false
    },
    "share": {
      "href": "dolore sunt ad",
      "templated": false
    },
    "web_report_runs": {
      "href": "sint dolore voluptate",
      "templated": false
    },
    "star": {
      "href": "velit elit Excepteur culpa",
      "templated": false
    },
    "space": {
      "href": "eu",
      "templated": false
    },
    "space_links": {
      "href": "ullamco",
      "templated": false
    },
    "report_filters": {
      "href": "pariatur ex proident Excepteur mollit",
      "templated": false
    },
    "report_subscriptions": {
      "href": "culpa",
      "templated": false
    },
    "python_notebook": {
      "href": "ea labore sed cillum",
      "templated": false
    },
    "validate_email_subscriber": {
      "href": "eu",
      "templated": false
    },
    "creator": {
      "href": "commodo Excepteur consequat Lorem ut",
      "templated": false
    }
  },
  "_embedded": {}
}

Get a report

To retrieve information about a single report, send a GET request including the report token to the reports resource.

URL Params

account

required
string Account (Organization or User) username

report

required
string Report token
Responses

200

Report response

401

Unauthorized

404

Report not found

GET /{account}/reports/{report}

curl --include \
     --header "Content-Type: application/json" \
     --header "Accept: application/hal+json" \
  'https://modeanalytics.com/api/{account}/reports/{report}'
require 'http'

username = 'you_api_key'
password = 'you_api_secret'

headers = {
  content_type: 'application/json',
  accept: 'application/hal+json'
}

response = HTTP.basic_auth(user: username, pass: password)
               .headers(headers)
               .get('https://modeanalytics.com/api/{account}/reports/{report}')
puts response
from urllib2 import Request, urlopen

headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/hal+json'
}
request = Request('https://modeanalytics.com/api/{account}/reports/{report}', headers=headers)

response_body = urlopen(request).read()
print(response_body)
var request = new XMLHttpRequest();

request.open('GET', 'https://modeanalytics.com/api/{account}/reports/{report}');

request.setRequestHeader('Content-Type', 'application/json');
request.setRequestHeader('Accept', 'application/hal+json');

request.onreadystatechange = function () {
  if (this.readyState === 4) {
    console.log('Status:', this.status);
    console.log('Headers:', this.getAllResponseHeaders());
    console.log('Body:', this.responseText);
  }
};

request.send();

List reports for a space

To return a list of all reports in a given Space, send a GET request to the reports resource.

URL Params

account

required
string Account (Organization or User) username

space

required
string Space token
Responses

200

Report collection response

401

Unauthorized

404

Space not found

GET /{account}/spaces/{space}/reports

curl --include \
     --header "Content-Type: application/json" \
     --header "Accept: application/hal+json" \
  'https://modeanalytics.com/api/{account}/spaces/{space}/reports'
require 'http'

username = 'you_api_key'
password = 'you_api_secret'

headers = {
  content_type: 'application/json',
  accept: 'application/hal+json'
}

response = HTTP.basic_auth(user: username, pass: password)
               .headers(headers)
               .get('https://modeanalytics.com/api/{account}/spaces/{space}/reports')
puts response
from urllib2 import Request, urlopen

headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/hal+json'
}
request = Request('https://modeanalytics.com/api/{account}/spaces/{space}/reports', headers=headers)

response_body = urlopen(request).read()
print(response_body)
var request = new XMLHttpRequest();

request.open('GET', 'https://modeanalytics.com/api/{account}/spaces/{space}/reports');

request.setRequestHeader('Content-Type', 'application/json');
request.setRequestHeader('Accept', 'application/hal+json');

request.onreadystatechange = function () {
  if (this.readyState === 4) {
    console.log('Status:', this.status);
    console.log('Headers:', this.getAllResponseHeaders());
    console.log('Body:', this.responseText);
  }
};

request.send();

Update a report

To update a report, send a PATCH request including the username and corresponding report token to the reports resource.

URL Params

account

required
string Account (Organization or User) username

report

required
string Report token
POST Body Params

Object: report

name

string The name of the report

Example: Kanto Region Diaspora

description

string A description of the report in question

Example: An analysis of all the creatures living in the region. Please contribute any missing data. Pocket version coming soon.

space_token

string The token of the space this report will be moved to

Example: 5a4177a2902c

Responses

200

Report response

401

Unauthorized

404

Report not found

PATCH /{account}/reports/{report}

curl --include \
     --request PATCH \
     --header "Content-Type: application/json" \
     --header "Accept: application/hal+json" \
     --data-binary "{
  \"report\": {
    \"name\": \"Kanto Region Diaspora\",
    \"description\": \"An analysis of all the creatures living in the region. Please contribute any missing data. Pocket version coming soon.\",
    \"space_token\": \"5a4177a2902c\"
  }
}" \
'https://modeanalytics.com/api/{account}/reports/{report}'
require 'http'

values = {
  report: {
    name: 'Kanto Region Diaspora',
    description: 'An analysis of all the creatures living in the region. Please contribute any missing data. Pocket version coming soon.',
    space_token: '5a4177a2902c'
  }
}

headers = {
  content_type: 'application/json',
  accept: 'application/hal+json'
}

response = HTTP.basic_auth(user: username, pass: password)
               .headers(headers)
               .patch('https://modeanalytics.com/api/{account}/reports/{report}', json: values)
puts response
from urllib2 import Request, urlopen

values = """
  {
    "report": {
      "name": "Kanto Region Diaspora",
      "description": "An analysis of all the creatures living in the region. Please contribute any missing data. Pocket version coming soon.",
      "space_token": "5a4177a2902c"
    }
  }
"""

headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/hal+json'
}
request = Request('https://modeanalytics.com/api/{account}/reports/{report}', data=values, headers=headers)
request.get_method = lambda: 'PATCH'

response_body = urlopen(request).read()
print(response_body)
var request = require('request');

request({
  method: 'PATCH',
  url: 'https://modeanalytics.com/api/{account}/reports/{report}',
  headers: {
    'Content-Type': 'application/json',
    'Accept': 'application/hal+json'
  },
  body: "{  \"report\": {    \"name\": \"Kanto Region Diaspora\",    \"description\": \"An analysis of all the creatures living in the region. Please contribute any missing data. Pocket version coming soon.\",    \"space_token\": \"5a4177a2902c\"  }}"
}, function (error, response, body) {
  console.log('Status:', response.statusCode);
  console.log('Headers:', JSON.stringify(response.headers));
  console.log('Response:', body);
});

Delete a report

To remove a given report from a Space, send a DELETE request to the reports resource.

URL Params

account

required
string Account (Organization or User) username

report

required
string Report token
Responses

200

Empty body

400

Bad request

401

Unauthorized

404

Report not found

DELETE /{account}/reports/{report}

curl --include \
     --request DELETE \
     --header "Content-Type: application/json" \
     --header "Accept: application/hal+json" \
  'https://modeanalytics.com/api/{account}/reports/{report}'
require 'http'

username = 'you_api_key'
password = 'you_api_secret'

headers = {
  content_type: 'application/json',
  accept: 'application/hal+json'
}

response = HTTP.basic_auth(user: username, pass: password)
               .headers(headers)
               .delete('https://modeanalytics.com/api/{account}/reports/{report}')
puts response
from urllib2 import Request, urlopen

headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/hal+json'
}
request = Request('https://modeanalytics.com/api/{account}/reports/{report}', headers=headers)
request.get_method = lambda: 'DELETE'

response_body = urlopen(request).read()
print(response_body)
var request = new XMLHttpRequest();

request.open('DELETE', 'https://modeanalytics.com/api/{account}/reports/{report}');

request.setRequestHeader('Content-Type', 'application/json');
request.setRequestHeader('Accept', 'application/hal+json');

request.onreadystatechange = function () {
  if (this.readyState === 4) {
    console.log('Status:', this.status);
    console.log('Headers:', this.getAllResponseHeaders());
    console.log('Body:', this.responseText);
  }
};

request.send();

Archive a report

To archive a report, send a PATCH request to the reports resource at archive. Archived Mode reports are hidden from view but still accessible to organization members via search or direct link.

URL Params

account

required
string Account (Organization or User) username

report

required
string Report token
Responses

200

Report response

400

Bad request

401

Unauthorized

404

Report not found

PATCH /{account}/reports/{report}/archive

curl --include \
     --request PATCH \
     --header "Content-Type: application/json" \
     --header "Accept: application/hal+json" \
  'https://modeanalytics.com/api/{account}/reports/{report}/archive'
require 'http'

username = 'you_api_key'
password = 'you_api_secret'

headers = {
  content_type: 'application/json',
  accept: 'application/hal+json'
}

response = HTTP.basic_auth(user: username, pass: password)
               .headers(headers)
               .patch('https://modeanalytics.com/api/{account}/reports/{report}/archive')
puts response
from urllib2 import Request, urlopen

headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/hal+json'
}
request = Request('https://modeanalytics.com/api/{account}/reports/{report}/archive', headers=headers)
request.get_method = lambda: 'PATCH'

response_body = urlopen(request).read()
print(response_body)
var request = require('request');

request({
  method: 'PATCH',
  url: 'https://modeanalytics.com/api/{account}/reports/{report}/archive',
  headers: {
    'Content-Type': 'application/json',
    'Accept': 'application/hal+json'
  }}, function (error, response, body) {
  console.log('Status:', response.statusCode);
  console.log('Headers:', JSON.stringify(response.headers));
  console.log('Response:', body);
});

Unarchive a report

To unarchive a report, send a PATCH request to the reports resource and the unarchive action.

URL Params

account

required
string Account (Organization or User) username

report

required
string Report token
Responses

200

Report response

400

Bad request

401

Unauthorized

404

Report not found

PATCH /{account}/reports/{report}/unarchive

curl --include \
     --request PATCH \
     --header "Content-Type: application/json" \
     --header "Accept: application/hal+json" \
  'https://modeanalytics.com/api/{account}/reports/{report}/unarchive'
require 'http'

username = 'you_api_key'
password = 'you_api_secret'

headers = {
  content_type: 'application/json',
  accept: 'application/hal+json'
}

response = HTTP.basic_auth(user: username, pass: password)
               .headers(headers)
               .patch('https://modeanalytics.com/api/{account}/reports/{report}/unarchive')
puts response
from urllib2 import Request, urlopen

headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/hal+json'
}
request = Request('https://modeanalytics.com/api/{account}/reports/{report}/unarchive', headers=headers)
request.get_method = lambda: 'PATCH'

response_body = urlopen(request).read()
print(response_body)
var request = require('request');

request({
  method: 'PATCH',
  url: 'https://modeanalytics.com/api/{account}/reports/{report}/unarchive',
  headers: {
    'Content-Type': 'application/json',
    'Accept': 'application/hal+json'
  }}, function (error, response, body) {
  console.log('Status:', response.statusCode);
  console.log('Headers:', JSON.stringify(response.headers));
  console.log('Response:', body);
});