Metadata queries

Use metadata queries to retrieve schema details (metadata) about the API data available from our API. There are three metadata queries: one lists the available data views for your account; the second lists the metrics available for a given datasource, and the third lists the dimensions available for a given datasource.

Data views

Use this call to retrieve a list of data views available to you. This API call is one of the few where you do not specify a `dataview`.

Limits

No size limits apply to this call. Each call counts as one API query.

Endpoint

Make the query as follows:

HTTP method Query Endoint Base URL
POST /metadata/dataviews https://api.mmx.io/

Headers

Include the following required header (more on authentication):

Key Value
Authorization Bearer
Content-Type application/json

Parameters

There are no parameters for this call.

Response

The response will consist of a single array of strings. Each string is the ID of a data view you can query. (See also the schema explorer, which provides this list as a drop-down to explore.)

Example request code


# Run 'gem install rest-client' before running this script.
require 'rest-client'; require 'json'; require 'pp'
url = "https://api.mmx.io/metadata/dataviews"

# Adjust this block for your token, data view and query setup.
token = ENV['TOKEN']  # Replace with your token, or set an environment variable.
body = {}
# (No edits required below here.)

# Prepare and make the request, and respond to any errors.
headers = {Authorization: "Bearer " + token, content_type: :json, accept: :json}
begin
  response = RestClient.post(url, body.to_json, headers)
rescue RestClient::Exception => e
  puts e.response
else
  # Display the successful result.
  pp JSON.load response
end
export TOKEN="your token here"
curl -v \
  --header "Authorization: Bearer $TOKEN" \
  --header "Content-Type: application/json" \
  -d '{}' \
  https://api.mmx.io/metadata/dataviews
# Run 'easy_install requests' before running this script.
import requests, os

# Adjust this block for your token, data view and query setup.
token = os.environ['TOKEN'] # Replace this, or set an environment variable.
url = "https://api.mmx.io/metadata/dataviews"
body = {}

# Prepare and make the request.
headers = {"Authorization": "Bearer " + token}
response = requests.post(url, json=body, headers=headers)

# Respond to the result:
if response.status_code == 200:
  print response.json()
else:
  print response.text
  raise Exception, "API query failed"
// Adjust this block for your token, data view and query setup.
var token = "eyJ0eXAiOiJKV1Qi..."; // Replace this with your token.
var url = "https://api.mmx.io/metadata/dataviews";
var body = {};
// (No edits required below here.)

// Prepare the request.
var request = new XMLHttpRequest();
request.open("POST", url);
request.setRequestHeader('Content-Type', 'application/json');
request.setRequestHeader('Authorization', 'Bearer ' + token);

// Respond to the result:
request.onreadystatechange = function (xhr) {
  if (this.readyState === 4) {
    xhr = this;
    if (xhr.status == 200) {
      response = JSON.parse(xhr.response);
      // Just print out the result for now:
      console.log(response);
    } else {
      console.log(xhr.response);
      throw "API query failed"
    }
  }
};

// Make the request:
request.send(JSON.stringify(body));

Example response


[
  "demo_dsp\/explore_bids",
  "demo_exchange\/explore",
  "demo_exchange\/explore_bids"
]

Metrics

Use this call to retrieve a list of metrics available for a given data view. For each metric, you will get both an ID, and a title suitable for display.

Limits

No size limits apply to this call. Each call counts as one regular API query.

Endpoint

Make the query as follows:

HTTP method Query Endoint Base URL
POST /metadata/metrics https://api.mmx.io/

Headers

Include the following required header (more on authentication):

Key Value
Authorization Bearer
Content-Type application/json

Parameters

Include the following parameters:

Parameter Type Description
dataView String (required) The data view ID to query

Response

The response will consist of an array of objects: one for each metric available for the given data view. Each object will have an `id` that gives the metric ID to use in other API calls, and a `title` that gives a human-readable title for the metric. This data is also available for exploration in the Schema Explorer.

Example request code


# Run 'gem install rest-client' before running this script.
require 'rest-client'; require 'json'; require 'pp'
url = "https://api.mmx.io/metadata/metrics"

# Adjust this block for your token, data view and query setup.
token = ENV['TOKEN']  # Replace with your token, or set an environment variable.
body = {
  dataView: "demo_exchange/explore"
}
# (No edits required below here.)

# Prepare and make the request, and respond to any errors.
headers = {Authorization: "Bearer " + token, content_type: :json, accept: :json}
begin
  response = RestClient.post(url, body.to_json, headers)
rescue RestClient::Exception => e
  puts e.response
else
  # Display the successful result.
  pp JSON.load response
end
export TOKEN="your token here"
curl -v \
  --header "Authorization: Bearer $TOKEN" \
  --header "Content-Type: application/json" \
  -d '{
    "dataView": "demo_exchange/explore"}' \
  https://api.mmx.io/metadata/metrics
# Run 'easy_install requests' before running this script.
import requests, os

# Adjust this block for your token, data view and query setup.
token = os.environ['TOKEN'] # Replace this, or set an environment variable.
url = "https://api.mmx.io/metadata/metrics"
body = {
  "dataView": "demo_exchange/explore"
}

# Prepare and make the request.
headers = {"Authorization": "Bearer " + token}
response = requests.post(url, json=body, headers=headers)

# Respond to the result:
if response.status_code == 200:
  print response.json()
else:
  print response.text
  raise Exception, "API query failed"
// Adjust this block for your token, data view and query setup.
var token = "eyJ0eXAiOiJKV1Qi..."; // Replace this with your token.
var url = "https://api.mmx.io/metadata/metrics";
var body = {
  "dataView": "demo_exchange/explore"
};
// (No edits required below here.)

// Prepare the request.
var request = new XMLHttpRequest();
request.open("POST", url);
request.setRequestHeader('Content-Type', 'application/json');
request.setRequestHeader('Authorization', 'Bearer ' + token);

// Respond to the result:
request.onreadystatechange = function (xhr) {
  if (this.readyState === 4) {
    xhr = this;
    if (xhr.status == 200) {
      response = JSON.parse(xhr.response);
      // Just print out the result for now:
      console.log(response);
    } else {
      console.log(xhr.response);
      throw "API query failed"
    }
  }
};

// Make the request:
request.send(JSON.stringify(body));

Example response


[
  {
    "id": "auction_cnt",
    "title": "Auctions"
  },
  {
    "id": "total_revenue",
    "title": "Gross Revenue"
  },
  {
    "id": "imp_cnt",
    "title": "Impressions"
  },
  {
    "id": "delivery_rate",
    "title": "Delivery Rate"
  },
  {
    "id": "ecpm",
    "title": "eCPM"
  },
  {
    "id": "win_cnt",
    "title": "Winning Bids"
  },
  {
    "id": "win_rate",
    "title": "Win Rate"
  },
  {
    "id": "bid_cnt",
    "title": "Total Bids"
  },
  {
    "id": "avg_price_floor",
    "title": "Avg. Price Floor"
  },
  {
    "id": "avg_bid_price",
    "title": "Avg. Bid Price"
  },
  {
    "id": "avg_latency",
    "title": "Avg. Imp Latency"
  },
  {
    "id": "avg_bid_depth",
    "title": "Avg. Bid Depth"
  },
  {
    "id": "competitive_factor",
    "title": "Competitive Factor"
  },
  {
    "id": "avg_win_bid",
    "title": "Avg Win Bid"
  },
  {
    "id": "clear_rate",
    "title": "Clear Rate"
  },
  {
    "id": "click_cnt",
    "title": "Clicks"
  },
  {
    "id": "ctr",
    "title": "CTR"
  },
  {
    "id": "uniques",
    "title": "Uniques"
  },
  {
    "id": "views",
    "title": "Views"
  },
  {
    "id": "completes",
    "title": "Completes"
  },
  {
    "id": "fill_rate",
    "title": "Fill Rate"
  },
  {
    "id": "completion_rate",
    "title": "Completion Rate"
  }
]

Dimensions

Use this call to retrieve a list of dimensions available for a given data view. For each dimension, you will get both an ID, and a title suitable for display.

Limits

No size limits apply to this call. Each call counts as one regular API query.

Endpoint

Make the query as follows:

HTTP method Query Endoint Base URL
POST /metadata/dimensions https://api.mmx.io/

Headers

Include the following required header (more on authentication):

Key Value
Authorization Bearer
Content-Type application/json

Parameters

Include the following parameters:

Parameter Type Description
dataView String (required) The data view ID to query

Response

The response will consist of an array of objects: one for each metric available for the given data view. Each object will have an `id` that gives the metric ID to use in other API calls, and a `title` that gives a human-readable title for the metric. This data is also available for exploration in the Schema Explorer.

Example request code


# Run 'gem install rest-client' before running this script.
require 'rest-client'; require 'json'; require 'pp'
url = "https://api.mmx.io/metadata/dimensions"

# Adjust this block for your token, data view and query setup.
token = ENV['TOKEN']  # Replace with your token, or set an environment variable.
body = {
  dataView: "demo_exchange/explore"
}
# (No edits required below here.)

# Prepare and make the request, and respond to any errors.
headers = {Authorization: "Bearer " + token, content_type: :json, accept: :json}
begin
  response = RestClient.post(url, body.to_json, headers)
rescue RestClient::Exception => e
  puts e.response
else
  # Display the successful result.
  pp JSON.load response
end
export TOKEN="your token here"
curl -v \
  --header "Authorization: Bearer $TOKEN" \
  --header "Content-Type: application/json" \
  -d '{
    "dataView": "demo_exchange/explore"}' \
  https://api.mmx.io/metadata/dimensions
# Run 'easy_install requests' before running this script.
import requests, os

# Adjust this block for your token, data view and query setup.
token = os.environ['TOKEN'] # Replace this, or set an environment variable.
url = "https://api.mmx.io/metadata/dimensions"
body = {
  "dataView": "demo_exchange/explore"
}

# Prepare and make the request.
headers = {"Authorization": "Bearer " + token}
response = requests.post(url, json=body, headers=headers)

# Respond to the result:
if response.status_code == 200:
  print response.json()
else:
  print response.text
  raise Exception, "API query failed"
// Adjust this block for your token, data view and query setup.
var token = "eyJ0eXAiOiJKV1Qi..."; // Replace this with your token.
var url = "https://api.mmx.io/metadata/dimensions";
var body = {
  "dataView": "demo_exchange/explore"
};
// (No edits required below here.)

// Prepare the request.
var request = new XMLHttpRequest();
request.open("POST", url);
request.setRequestHeader('Content-Type', 'application/json');
request.setRequestHeader('Authorization', 'Bearer ' + token);

// Respond to the result:
request.onreadystatechange = function (xhr) {
  if (this.readyState === 4) {
    xhr = this;
    if (xhr.status == 200) {
      response = JSON.parse(xhr.response);
      // Just print out the result for now:
      console.log(response);
    } else {
      console.log(xhr.response);
      throw "API query failed"
    }
  }
};

// Make the request:
request.send(JSON.stringify(body));

Example response


[
  {
    "id": "pub_name",
    "title": "Publisher",
    "titlePlural": "Publisher"
  },
  {
    "id": "app_site_cat_id",
    "title": "App Category",
    "titlePlural": "App Category"
  },
  {
    "id": "advertiser_cat",
    "title": "User Segment",
    "titlePlural": "User Segment"
  },
  {
    "id": "bidder_name",
    "title": "Bidder\/DSP Name",
    "titlePlural": "Bidder\/DSP Name"
  },
  {
    "id": "ad_size",
    "title": "Ad Size",
    "titlePlural": "Ad Size"
  },
  {
    "id": "auction_outcome",
    "title": "Auction Outcome",
    "titlePlural": "Auction Outcome"
  },
  {
    "id": "auction_type",
    "title": "Auction Type",
    "titlePlural": "Auction Type"
  },
  {
    "id": "app_site_name",
    "title": "App\/Site Name",
    "titlePlural": "App\/Site Name"
  },
  {
    "id": "app_or_site",
    "title": "App or Site",
    "titlePlural": "App or Site"
  },
  {
    "id": "device_os",
    "title": "Device OS",
    "titlePlural": "Device OS"
  },
  {
    "id": "has_device_id",
    "title": "Has Device ID",
    "titlePlural": "Has Device ID"
  },
  {
    "id": "bid_floor_bucket",
    "title": "Price Floor Bucket",
    "titlePlural": "Price Floor Bucket"
  },
  {
    "id": "campaign_id",
    "title": "Winner Campaign ID",
    "titlePlural": "Winner Campaign ID"
  },
  {
    "id": "adomain",
    "title": "Adomain",
    "titlePlural": "Adomain"
  },
  {
    "id": "advertiser",
    "title": "Advertiser",
    "titlePlural": "Advertiser"
  },
  {
    "id": "ad_position",
    "title": "Ad Position",
    "titlePlural": "Ad Position"
  },
  {
    "id": "deal_id",
    "title": "Deal ID",
    "titlePlural": "Deal ID"
  },
  {
    "id": "user_gender",
    "title": "Gender",
    "titlePlural": "Gender"
  },
  {
    "id": "user_age",
    "title": "User Age",
    "titlePlural": "User Age"
  },
  {
    "id": "country_id",
    "title": "Country",
    "titlePlural": "Country"
  },
  {
    "id": "location_type",
    "title": "Location Type",
    "titlePlural": "Location Type"
  },
  {
    "id": "device_make",
    "title": "Device Make",
    "titlePlural": "Device Make"
  },
  {
    "id": "device_model",
    "title": "Device Model",
    "titlePlural": "Device Model"
  },
  {
    "id": "api_frameworks",
    "title": "Device Carrier",
    "titlePlural": "Device Carriers"
  },
  {
    "id": "user_id_types",
    "title": "User ID Type",
    "titlePlural": "User ID Types"
  },
  {
    "id": "account_manager",
    "title": "Account Manager",
    "titlePlural": "Account Manager"
  },
  {
    "id": "ad_type",
    "title": "Banner or Video",
    "titlePlural": "Banner or Video"
  },
  {
    "id": "video_completion",
    "title": "Video Completion",
    "titlePlural": "Video Completion"
  },
  {
    "id": "video_protocols",
    "title": "Video Protocols",
    "titlePlural": "Video Protocols"
  },
  {
    "id": "video_playback",
    "title": "Video Playback",
    "titlePlural": "Video Playback"
  },
  {
    "id": "video_delay",
    "title": "Video Delay",
    "titlePlural": "Video Delay"
  },
  {
    "id": "volume",
    "title": "Video Length",
    "titlePlural": "VideoLength"
  },
  {
    "id": "video_skip",
    "title": "Video Skip",
    "titlePlural": "Video Skip"
  },
  {
    "id": "video_delivery",
    "title": "Video Delivery",
    "titlePlural": "Video Delivery"
  },
  {
    "id": "macro_region",
    "title": "Macro Region",
    "titlePlural": "Macro Region"
  }
]