Using the Datastores API

Follow the steps below to create a datastore to hold your customer reference data and make that data available to MXO for use in decisioning.

We've made the Datastores API publicly available on Github. You can find it here:

Datastores API

Step 1 - Request a Valid OAuth 2.0 token

Request a valid OAuth 2.0 token from MXO to use the Datastore API. Use your preferred API client to make the request, ensuring you provide the correct details.

Use the Client Credentials grant type when requesting an OAuth Token for the Data Export API.

For more information, see Request an OAuth 2.0 Token from MXO.

Step 2 - Create a Datastore

Create a Datastore to hold the data you want to make available to MXO .

POST /datastores/1.0.0/MjIyOQ
{
  "name": "ProductTerms",
  "apiName": "terms",
  "primaryKey": "customerID",
  "secondaryKey": "productID",
  "definitions": [{
    "name": "customerID",
    "type": "TEXT"
  }, {
    "name": "productID",
    "type": "TEXT"
  }, {
    "name": "creditLimit",
    "type": "NUMERIC"
  }, {
    "name": "expires",
    "type": "DATETIME"
  }]
}

Step 3 - Create a Datastores Data Adapter

In MXO , create a Datastores Data Adapter that references the Datastore you set up in Step 2.

DS - Create

The customer reference data you make available in your Datastore are saved as attributes in the Datastores Data Adapter.

DS - Attributes in DA

Step 4 - Populate your Datastore with customer reference data

Populate your Datastore with the customer reference data you want to make available to MXO for use in decisioning. You can add the data bit-by-bit in staging before it goes live.

POST /datastores/1.0.0/MjIyOQ/terms/staging
[{
  "customerID": "ABC-123-45678",
  "productID": "YP-25",
  "creditLimit": 11000,
  "expires": 1507676400000
}, {
  "customerID": "ABC-123-45678",
  "productID": "KF-40",
  "creditLimit": 2000,
  "expires": 1507676400000
}, {
  "customerID": "ABC-123-XYZZY",
  "productID": "YP-25",
  "creditLimit": 300000,
  "expires": 1507676400000
}]
Note: When populating your Datastore with customer reference data, MXO returns a success or fail result for each individual record within a single response.

Step 5 - Push staging data to your live environment

Before you can use your customer data, you must push it to your live environment. This is a two-stage process:

  1. Get a reference to the staging data
  2. Use the reference to push the staging data to your live environment

Get a reference to the staging data

GET /datastores/1.0.0/MjIyOQ/terms/staging/reference
{
  "referenceId": "ds03573f2896ff45019d27482289537134"
}

Use the reference to push the staging data to your live environment

POST /datastores/1.0.0/MjIyOQ/terms/golive/ds03573f2896ff45019d27482289537134

Step 6 - Use Datastore data in an Eligibility Rule

After pushing your data live, you can use that data when creating Eligibility Rules. Data appears in the Data item picker, as follows:

DS - Attributes in DIP