Modify Data API behaviour with the config section

The "config" section — distinct within an overall API configuration — can be included at the end of a full Data API configuration or in the API request itself.

📘

About this guide

In this guide, you will understand how to setup the config section of a Data API. This section is distinct within an overall Data API configuration and includes multiple key features impacting how the Data API will operate.

The config section can be included at the end of a full Data API configuration or in the Data API request itself.

Supported operations

Mode

Adding "config": { "mode" : MODE } to the JSON request payload can run a transaction in an alternate execution mode. Below is a list with the allowed values for MODE:

ModeDescription
sampleBy default, this mode runs each provider using Demyst's internally saved static sample responses. This is the only allowed mode for a test API key; it does not need to be explicitly requested.
cacheThis mode checks Demyst's provider cache for a response before making a call to a data provider. If a user has called a provider in cache mode with identical inputs at some point in the previous 7 days, the response will be in the cache. Responses are added to the cache when a provider is called in cache mode and the response is not already in the cache.
cache_read_onlyThis mode searches Demyst's provider cache for a response. It does not attempt a live call to any provider, and it returns an error if the response is not already present in the cache.
liveThis is the default mode for production keys, and it does not need to be explicitly requested. Live mode always calls new data from data sources.
"config": {
    "mode": "cache"
  }

Raw data

The return_raw_data flag creates a new subsection under the response from each data provider. A true setting will return the raw data directly from the data provider. See more details on that section under the Data API response description.

"config": {
    "return_raw_data": "true"
  }

Flattened data

The return_flattened_data flag creates a new subsection under the response from each data provider. A true setting will return the data parsed by Demyst and flattened down to a single level of key-value pairs. See more details on that section under the Data API Response description.

"config": {
    "return_flattened_data": "true"
  }

Fixed list size

Data providers often return large lists of data, and the size of these lists can be arbitrary. By limiting the size of the lists, and therefore the overall number of attributes, responses can be simplified or made easier to use and more predictable for downstream processes.

The fixed_list_size information in the example above limits any list size to 3 — any element after that will be cut out of the raw data and parsed data responses. The default number is 10.

"config": {
  "fixed_list_size": 5
  }

Hiding output section from response

The configuration allows only return refine section from a Data API call. Using the return_nested_data returns only the part as defined in guides such as Build custom response schema.

"config": {
  "return_nested_data": false
  }

Overriding Connector credentials

The configuration section also allows you to override Connector credentials.

"config": {
  "partner_credentials": {
    "{credential_id}": "target_value"
  }
}

Putting it all together

Below is a sample payload with all the features of the config section set up.

              
{
  "providers": {
    "everstring_company_enrichment": {
      "version": "$latest"
    },
    "hosted_experian_cpdb": {
      "version": "$latest"
    },
    "hosted_equifax_mds": {
      "version": "$latest"
    },
    "hosted_infogroup_business_places": {
      "version": "$latest"
    },
    "hosted_infogroup_business_places": {
      "version": "$latest"
    }
  },
  "config": {
    "mode": "cache",
    "return_raw_data":true
    "return_flattened_data":true,
    "fixed_list_size":3
  }
}