Analytics

Charts

`Chart` collection response

Charts

array

Chart Object

id

integer

token

string

chart_type

string

chart_title

string

query_id

string

report_id

string

space_id

string

query_token

string

report_token

string

space_token

string

report_creator_email

string

exploration_url

string

Links

Paginated resources will contain a set of links to the previous page and next page of results.

  • next_page
  • prev_page

Pagination

page

integer

per_page

integer

count

integer

total_pages

integer

total_count

integer

{
    "pagination": {
        "page": 1,
        "per_page": 1000,
        "count": 1000,
        "total_pages": 8,
        "total_count": 7335
    },
    "charts": [
        {
            "id": 172,
            "token": "728f6328ea67",
            "chart_type": "stackedBar100",
            "chart_title": "chart no. 0",
            "query_id": 170,
            "report_id": 5244,
            "space_id": 8,
            "query_token": "e84d267326af",
            "report_token": "3d309a5998c8",
            "space_token": "ece07661108c",
            "report_creator_email": "report.creator@company.com"
        },
        {
            "id": 4541,
            "token": "bfe4fc361d9f",
            "chart_type": "hStackedBar",
            "chart_title": "Et repellat voluptas",
            "query_id": 170,
            "report_id": 5244,
            "space_id": 8,
            "query_token": "14b73995877a",
            "report_token": "661c6ab667e0",
            "space_token": "ece07661108c",
            "report_creator_email": "report.creator2@company.com"
        },
        {
            "id": 4542,
            "token": "25e6637df704",
            "chart_type": "stackedBar",
            "chart_title": "Autem voluptas velit",
            "query_id": 170,
            "report_id": 5244,
            "space_id": 8,
            "query_token": "38573c120c75",
            "report_token": "cdc1ef078e96",
            "space_token": "ece07661108c",
            "report_creator_email": "creator@company.com"
        },
        ...
    ],
    "_links": {
        "next_page": {
            "href": "/batch/{account}/charts?page=2&per_page=1000"
        },
        "prev_page": {
            "href": "/batch/{account}/charts?page=1&per_page=1000"
        }
    }
}

List charts for an account

To return a paginated list of charts for a given Organization, send a GET request. Each page has 1000 charts by default.

URL Params

organization

required
string Organization username
Query Params

include_spaces

string With?include_spaces=all, the endpoint will include Charts in members' personal spaces. By default Charts in members personal spaces are excluded.

per_page

integer The number of objects to return per_page. Example: per_page?=100. Note: per_page must be greater than 0 and less than 1000.
Responses

200

Chart collection response

401

Unauthorized

404

Organization not found

GET /batch/{organization}/charts

curl --location --request GET 'http://app.mode.com/batch/{account}/charts' \
     --header "Content-Type: application/json" \
     --header "Accept: application/json" \
     --header "Authorization: {bearer_token}"

# Optional Query Params
  # ?include_spaces=all will include charts in members' personal spaces

curl --location --request GET 'http://app.mode.com/batch/{account}/charts?include_spaces=all' \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --header "Authorization: {bearer_token}"
require 'http'

decoded_token = "#{id}:#{access_key}:#{access_secret}"
encoded_token = Base64.strict_encode64(decoded_token)
bearer_token  = "Bearer #{encoded_token}"

headers = {
  content_type: 'application/json',
  accept: 'application/json',
  authorization: bearer_token
}

response = HTTP.headers(headers)
               .get('https://app.mode.com/batch/{account}/charts')
puts response

# Optional Query Params
  # ?include_spaces=all will include charts in members' personal spaces

response = HTTP.headers(headers)
              .get('https://app.mode.com/batch/{account}/charts?include_spaces=all')
from urllib2 import Request, urlopen
from base64 import b64encode

decoded_token = id + ':' + access_key + ':' + access_secret
encoded_token = b64encode(decoded_token)
bearer_token  = 'Bearer ' + encoded_token

request = Request("http://app.mode.com/batch/{account}/charts")

request.add_header("Authorization", bearer_token)
request.add_header("Accept", "application/json")
request.add_header("Content-Type", "application/json")

response = urlopen(request)
response_body = response.read()

print(response_body)

# Optional Query Params
  # ?include_spaces=all will include charts in members' personal spaces

request = Request("http://app.mode.com/batch/{account}/charts?include_spaces=all")
var request = new XMLHttpRequest();

var decoded_token = id + ':' + access_key + ':' + access_secret;
var encoded_token = btoa(decoded_token);
var bearer_token  = 'Bearer ' + encoded_token;

request.open('GET', 'https://app.mode.com/batch/{account}/charts');
request.withCredentials = true;

request.setRequestHeader('Authorization', bearer_token);
request.setRequestHeader('Content-Type', 'application/json');
request.setRequestHeader('Accept', 'application/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();

// Optional Query Params
  // ?include_spaces=all will include charts in members' personal spaces

request.open('GET', 'https://app.mode.com/batch/{account}/charts?include_spaces=all');