Discovery API

Introduction

The Discovery API is a read-only batch API that allow developers to get lists of Mode resources, along with metadata about each of those resources. The API will be referred to as ‘batch’ throughout the documentation. The resources currently supported are Reports, Spaces, Queries and Charts.

Getting started with the Discovery API

Note: To access to Mode’s Discovery API, you must be a member of a Mode Business organization. Only resources within a Mode Business organization are accessible via the API.

To create a valid Signature Token for accessing the Discovery API, an organization admin’s API key & secret are required for authenticating the token creation endpoint. All other endpoints will require a valid Signature Token for access.

1. Get API key and secret

2. Create a Signature Token for Discovery API requests

3. Use the Signature Token to authenticate with the Discovery API

Include the Bearer Token in the Authentication Header of your requests.

Use the Signature Token to Authenticate with the Discovery API:

signature_token = {
  "token": "5b89bf4b0a49",
  "name": "batch-api-token-1",
  "creator_id": 3,
  "organization_id": 4,
  "access_key": "8b6fdc0a36bf340604a3cedc",
  "access_secret": "829146cb6c752f51bbbb8c85",
  "created_at": "2020-07-02T21:01:17.181Z",
  "updated_at": "2020-07-02T21:01:17.181Z",
  "expires_at": "2020-10-02T21:00:00.000Z",
  "authentication_for": "batch-api",
  "authorization_type": "read-only"
}

id            = signature_token["token"]
access_key    = signature_token["access_key"]
access_secret = signature_token["access_secret"]
DECODED_TOKEN="$ID":"$ACCESS_KEY":"$ACCESS_SECRET"
ENCODED_TOKEN=$( echo $DECODED_TOKEN | base64 )
BEARER_TOKEN="Bearer "$ENCODED_TOKEN""
decoded_token = "#{id}:#{access_key}:#{access_secret}"
encoded_token = Base64.strict_encode64(decoded_token)
bearer_token  = "Bearer #{encoded_token}"
import base64;

decoded_token = id + ':' + access_key + ':' + access_secret
encoded_token = base64.b64encode(decoded_token)
bearer_token  = 'Bearer ' + encoded_token
decoded_token = id + ':' + access_key + ':' + access_secret;
encoded_token = btoa(decoded_token);
bearer_token  = 'Bearer ' + encoded_token;