Distribution
Exports
The exports resource allows you to download the results of a given query or report run. Use this resource to retrieve JSON, CSV, or PDF results of your work in Mode.
Get query results
To download the results of a given query run as a CSV or JSON file, send a GET request to this endpoint, specifying the query run.
URL Params | ||
account required |
string |
Account (Workspace or User ) username
|
report required |
string |
Report token
|
run required |
string |
ReportRun token
|
query_run required |
string | Query Run token |
Responses | |
200 |
Query Run result content in the requested format |
401 |
Unauthorized |
404 |
ReportRun not found |
GET
/{account}
curl --include \
--header "Content-Type: application/json" \
--header "Accept: application/hal+json" \
'https://app.mode.com/api/{account}/reports/{report}/runs/{run}/query_runs/{query_run}/results/content(.csv, .json)'
require 'http'
username = 'your_api_key'
password = 'your_api_secret'
headers = {
content_type: 'application/json',
accept: 'application/hal+json'
}
response = HTTP.basic_auth(user: username, pass: password)
.headers(headers)
.get('https://app.mode.com/api/{account}/reports/{report}/runs/{run}/query_runs/{query_run}/results/content(.csv, .json)')
puts response
from urllib2 import Request, urlopen
headers = {
'Content-Type': 'application/json',
'Accept': 'application/hal+json'
}
request = Request('https://app.mode.com/api/{account}/reports/{report}/runs/{run}/query_runs/{query_run}/results/content(.csv, .json)', headers=headers)
response_body = urlopen(request).read()
print(response_body)
var request = require('request');
request({
method: 'GET',
url: 'https://app.mode.com/api/{account}/reports/{report}/runs/{run}/query_runs/{query_run}/results/content(.csv, .json)',
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);
});
Get report results
URL Params | ||
account required |
string |
Account (Workspace or User ) username
|
report required |
string |
Report token
|
run required |
string |
ReportRun token
|
Responses | |
200 |
Report Run result content in the requested format |
401 |
Unauthorized |
404 |
ReportRun not found |
GET
/{account}
curl --include \
--header "Content-Type: application/json" \
--header "Accept: application/hal+json" \
'https://app.mode.com/api/{account}/reports/{report}/runs/{run}/results/content(.csv, .json)'
require 'http'
username = 'your_api_key'
password = 'your_api_secret'
headers = {
content_type: 'application/json',
accept: 'application/hal+json'
}
response = HTTP.basic_auth(user: username, pass: password)
.headers(headers)
.get('https://app.mode.com/api/{account}/reports/{report}/runs/{run}/results/content(.csv, .json)')
puts response
from urllib2 import Request, urlopen
headers = {
'Content-Type': 'application/json',
'Accept': 'application/hal+json'
}
request = Request('https://app.mode.com/api/{account}/reports/{report}/runs/{run}/results/content(.csv, .json)', headers=headers)
response_body = urlopen(request).read()
print(response_body)
var request = require('request');
request({
method: 'GET',
url: 'https://app.mode.com/api/{account}/reports/{report}/runs/{run}/results/content(.csv, .json)',
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);
});
Get PDF of a report run
To download the results of a given report run as a PDF file, send a GET request to this endpoint, specifying the report run.
URL Params | ||
account required |
string |
Account (Workspace or User ) username
|
report required |
string |
Report token
|
run required |
string |
ReportRun token
|
Responses | |
200 |
The data stream containing the exported pdf file |
401 |
Unauthorized |
404 |
ReportRun not found |
GET
/{account}
curl --include \
--header "Content-Type: application/json" \
--header "Accept: application/hal+json" \
'https://app.mode.com/api/{account}/reports/{report}/exports/runs/{run}/pdf/download'
require 'http'
username = 'your_api_key'
password = 'your_api_secret'
headers = {
content_type: 'application/json',
accept: 'application/hal+json'
}
response = HTTP.basic_auth(user: username, pass: password)
.headers(headers)
.get('https://app.mode.com/api/{account}/reports/{report}/exports/runs/{run}/pdf/download')
puts response
from urllib2 import Request, urlopen
headers = {
'Content-Type': 'application/json',
'Accept': 'application/hal+json'
}
request = Request('https://app.mode.com/api/{account}/reports/{report}/exports/runs/{run}/pdf/download', headers=headers)
response_body = urlopen(request).read()
print(response_body)
var request = require('request');
request({
method: 'GET',
url: 'https://app.mode.com/api/{account}/reports/{report}/exports/runs/{run}/pdf/download',
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);
});