Analytics

Dataset Runs

Every time a Dataset is run, a full copy of the Dataset with all its components is saved. Each Dataset run is saved as a separate URL and it is possible to see a complete history of all the runs for any given Dataset in Mode.

You can use the runs resource to trigger a new run of a Dataset or retrieve history of all runs for a single Dataset.

Dataset Run object

Properties

token

required

string

state

required

string

enum: pending enqueued cancelled failed succeeded completed running_notebook

parameters

created_at

required

string

updated_at

required

string

completed_at

required

string

purge_started_at

required

string

purge_completed_at

required

string

python_state

string

enum: none pending failed submitted succeeded

form_fields

array

is_latest_report_run

required

string

is_latest_successful_report_run

required

string

report_has_failures_since_last_success

required

string

pusher_channel_name

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
  • clone
  • content
  • embed
  • executed_by
  • latest_successful_report_run_api_url
  • pdf_export
  • preview
  • python_cell_runs
  • query_runs
  • report
  • report_schedule
  • self
  • share
  • web_clone
  • web_edit_dataset
  • web_external_url
{
  "token": "f2lkg3hwjj9",
  "state": "enqueued",
  "parameters": {},
  "created_at": "YYYY-MM-DDTHH:MM:SS.msZ",
  "updated_at": "YYYY-MM-DDTHH:MM:SS.msZ",
  "completed_at": "YYYY-MM-DDTHH:MM:SS.msZ",
  "purge_started_at": "YYYY-MM-DDTHH:MM:SS.msZ",
  "purge_completed_at": "YYYY-MM-DDTHH:MM:SS.msZ",
  "python_state": "none",
  "form_fields": [],
  "_links": {
    "self": {
      "href": "occaecat eiusmod",
      "templated": false
    },
    "preview": {
      "href": "nisi veniam",
      "templated": false
    },
    "account": {
      "href": "in culpa Duis sit Ut",
      "templated": false
    },
    "report_schedule": {
      "href": "aliqua d",
      "templated": false
    },
    "executed_by": {
      "href": "ut",
      "templated": false
    },
    "report": {
      "href": "ad nulla",
      "templated": false
    },
    "clone": {
      "href": "fugiat velit est ex commodo",
      "templated": false
    },
    "query_runs": {
      "href": "minim deserunt",
      "templated": false
    },
    "python_cell_runs": {
      "href": "eu Lorem en",
      "templated": false
    },
    "pdf_export": {
      "href": "tempor",
      "templated": false
    },
    "content": {
      "href": "eiusmod ipsum consectetur magna",
      "templated": false
    },
    "share": {
      "href": "",
      "templated": false
    },
    "embed": {
      "href": "adipisicing ullamco ",
      "templated": false
    },
    "web_clone": {
      "href": "elit",
      "templated": false
    },
    "web_external_url": {
      "href": "anim irure fugiat qui",
      "templated": false
    }
  },
  "_embedded": {}
}

Get a Dataset run

To retrieve a representation of a Dataset run, send a GET request to the runs resource.

URL Params

account

required
string Account (Workspace or User) username

dataset

required
string Dataset token

run

required
string DatasetRun token
Responses

200

DatasetRun response

401

Unauthorized

404

DatasetRun not found

GET /{account}/datasets/{dataset}/runs/{run}

curl --include \
     --header "Content-Type: application/json" \
     --header "Accept: application/hal+json" \
  'https://app.mode.com/api/{account}/datasets/{dataset}/runs'
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}/datasets/{dataset}/runs')
puts response
from urllib2 import Request, urlopen

headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/hal+json'
}
request = Request('https://app.mode.com/api/{account}/datasets/{dataset}/runs', headers=headers)

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

request.open('GET', 'https://app.mode.com/api/{account}/datasets/{dataset}/runs');

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 Dataset runs

To get a list of all runs for a given Dataset, send a GET request to the runs resource.

URL Params

account

required
string Account (Workspace or User) username

dataset

required
string Dataset token
Query Params

filter

string Returns a filtered list of Runs for a Dataset filtered by whether their created_at or updated_at timestamps are gt (greater than) or lt (less than) the datetime passed in ISO8601 format. Example: ?filter=updated_at.lt.2019-10-23T06:23:01Z returns all Runs in a space created before that date.

order

string With the order param, returns all DatasetRuns for a Dataset ordered by their created_at or updated_at timestamps

order_by

string With the order_by param, returns all DatasetRuns for a Dataset ordered in asc or desc order
Responses

200

DatasetRun collection response

401

Unauthorized

404

Dataset not found

GET /{account}/datasets/{dataset}/runs

curl --include \
     --header "Content-Type: application/json" \
     --header "Accept: application/hal+json" \
  'https://app.mode.com/api/{account}/datasets/{dataset}/runs'

# Optional Query Params:

  # Filter runs by when they were created or updated
  # '?filter={created_at|updated_at}.{gt|lt}.{YYYY-MM-DDTHH:MM:SSZ}'

  curl --include \
       --header "Content-Type: application/json" \
       --header "Accept: application/hal+json" \
    'https://app.mode.com/api/{account}/datasets/{dataset}/runs?filter=created_at.gt.2019-12-19T10:21:12Z'

  # Order runs by when they were created or updated
  # '?order={asc|desc}&order_by={created_at|updated_at}'

  curl --include \
       --header "Content-Type: application/json" \
       --header "Accept: application/hal+json" \
    'https://app.mode.com/api/{account}/datasets/{dataset}/runs?order=asc&order_by=created_at'
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}/datasets/{dataset}/runs')
puts response

# Optional Query Params:

  # Filter runs by when they were created or updated
  # '?filter={created_at|updated_at}.{gt|lt}.{YYYY-MM-DDTHH:MM:SSZ}'

  response = HTTP.basic_auth(user: username, pass: password)
                 .headers(headers)
                 .get('https://app.mode.com/api/{account}/datasets/{dataset}/runs?filter=created_at.gt.2019-12-19T10:21:12Z')

  # Order runs by when they were created or updated
  # '?order={asc|desc}&order_by={created_at|updated_at}'

  response = HTTP.basic_auth(user: username, pass: password)
                 .headers(headers)
                 .get('https://app.mode.com/api/{account}/datasets/{dataset}/runs?order=asc&order_by=created_at')
from urllib2 import Request, urlopen

headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/hal+json'
}
request = Request('https://app.mode.com/api/{account}/datasets/{dataset}/runs', headers=headers)

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

# Optional Query Params:

  # Filter runs by when they were created or updated
  # '?filter={created_at|updated_at}.{gt|lt}.{YYYY-MM-DDTHH:MM:SSZ}'

  request = Request('https://app.mode.com/api/{account}/datasets/{dataset}/runs?filter=created_at.gt.2019-12-19T10:21:12Z')

  # Order runs by when they were created or updated
  # '?order={asc|desc}&order_by={created_at|updated_at}'

  request = Request('https://app.mode.com/api/{account}/datasets/{dataset}/runs?order=asc&order_by=created_at')
var request = new XMLHttpRequest();

request.open('GET', 'https://app.mode.com/api/{account}/datasets/{dataset}/runs');

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();

// Optional Query Params:

  // Filter datasets by when they were created or updated
  // '?filter={created_at|updated_at}.{gt|lt}.{YYYY-MM-DDTHH:MM:SSZ}'

  request.open('GET', 'https://app.mode.com/api/{account}/datasets/{dataset}/runs?filter=created_at.gt.2019-12-19T10:21:12Z');

  // Order datasets by when they were created or updated
  // '?order={asc|desc}&order_by={created_at|updated_at}'

  request.open('GET', 'https://app.mode.com/api/{account}/datasets/{dataset}/runs?order=asc&order_by=created_at');

Create a Dataset run

To trigger a Dataset run, send a POST request to the runs resource, specifying the Dataset token. This call returns a representation of the resulting Dataset run.

URL Params

account

required
string Account (Workspace or User) username

dataset

required
string Dataset token
Responses

202

DatasetRun Accepted

400

Bad request

401

Unauthorized

404

Dataset not found

POST /{account}/datasets/{dataset}/runs

curl --include \
     --request POST \
     --header "Content-Type: application/json" \
     --header "Accept: application/hal+json" \
'https://app.mode.com/api/{account}/datasets/{dataset}/runs'
require 'http'

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

response = HTTP.basic_auth(user: username, pass: password)
               .headers(headers)
               .post('https://app.mode.com/api/{account}/datasets/{dataset}/runs')
puts response
from urllib2 import Request, urlopen

headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/hal+json'
}
request = Request('https://app.mode.com/api/{account}/datasets/{dataset}/runs', headers=headers)

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

request.open('POST', 'https://app.mode.com/api/{account}/datasets/{dataset}/runs');

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();