Configuring Data Mapping in Management API
On this page
This guide explains how to retrieve all tracked columns, retrieve details about specific columns, and assign target columns with the Management API.
See GET /api/target-columns/, POST /api/target-columns/, PUT /api/datastreams/{id}/columns/map/ and PATCH /api/datastreams/{id}/columns/{cid}/ in the API reference.
Prerequisites
Before you complete the procedure in this guide, perform all of the following actions:
-
Use a Connect API key with the following permissions:
-
Datastream: Read-only (
datastream:read) to retrieve tracked columns. -
Datastream: Write (
datastream:write) to map, update, or unmap columns. -
Destination: Read-only (
destination:read) to list target columns, their mappings, and default schema mappings. -
Destination: Write (
destination:write) to create target columns and to create, update, or delete default schema mappings. -
Workspace: Read-only (
workspace:read) to export the workspace schema. -
Workspace: Write (
workspace:write) to import the workspace schema.
Picking Write for a permission also gives the key its Read-only access. Without the permission a request needs, Management API returns HTTP
403. You cannot change the permissions of a key, so to add one, create a new key. For more information, see Creating a Connect API key in Adverity. -
-
Create a datastream and determine its datastream ID. For more information, see Creating datastreams.
-
Collect data from your datastream. For more information, see Collecting data through Management API.
Retrieving current Data Mapping
Retrieving all tracked columns in an instance
To retrieve all tracked columns, follow these steps:
-
Create a GET request to the following endpoint:
https://{{INSTANCE}}/api/columns/ -
In the HTTP request header, include the parameter
Authorizationwith valueBearer {{KEY}}. -
Send the request.
Import the request example as raw text to your HTTP client (such as Postman). The cURL request example is the following:
curl --location -g --request GET 'https://{{INSTANCE}}/api/columns/' \
--header 'Authorization: Bearer {{KEY}}'
Retrieving all tracked columns in a datastream
To retrieve all tracked columns per datastream, follow these steps:
-
Create a GET request to the following endpoint:
https://{{INSTANCE}}/api/datastreams/{{DATASTREAM_ID}}/columns/ -
In the HTTP request header, include the parameter
Authorizationwith valueBearer {{KEY}}. -
Send the request.
Import the request example as raw text to your HTTP client (such as Postman). The cURL request example is the following:
curl --location -g --request GET 'https://{{INSTANCE}}/api/datastreams/{{DATASTREAM_ID}}/columns/' \
--header 'Authorization: Bearer {{KEY}}'
Retrieving details of a specific column
To retrieve details of a specific column, follow these steps:
-
Create a GET request to the following endpoint:
https://{{INSTANCE}}/api/columns/{{COLUMN_ID}}/ -
In the HTTP request header, include the parameter
Authorizationwith valueBearer {{KEY}}. -
Send the request.
Import the request example as raw text to your HTTP client (such as Postman). The cURL request example is the following:
curl --location -g --request GET 'https://{{INSTANCE}}/api/columns/{{COLUMN_ID}}' \
--header 'Authorization: Bearer {{KEY}}'
Assigning target columns
To assign columns you retrieved from the datastream to target columns, search through available target columns, create a new target column, and then assign the column to the target column. Sections below document this process.
Retrieving all available target columns
To retrieve all available target columns in your instance, follow these steps:
-
Create a GET request to the following endpoint:
https://{{INSTANCE}}/api/target-columns/ -
In the HTTP request header, include the parameter
Authorizationwith valueBearer {{KEY}}. -
Send the request.
Import the request example as raw text to your HTTP client (such as Postman). The cURL request example is the following:
curl --location -g --request GET 'https://{{INSTANCE}}/api/target-columns/' \
--header 'Authorization: Bearer {{KEY}}'
Searching through available target columns by name
This section uses an example in which you search for the target column called day using the name parameter. To search through the available target columns using the name parameter, follow these steps:
-
Create a GET request to the following endpoint:
https://{{INSTANCE}}/api/target-columns/?name=day -
In the HTTP request header, include the parameter
Authorizationwith valueBearer {{KEY}}. -
Send the request.
Import the request example as raw text to your HTTP client (such as Postman). The cURL request example is the following:
curl --location -g --request GET 'https://{{INSTANCE}}/api/target-columns/?name=day' \
--header 'Authorization: Bearer {{KEY}}'
Retrieving available options for target column configuration
To retrieve all available options for a new target column, including the optional parameters, follow the steps below:
-
Create an OPTIONS request to the following endpoint:
https://{{INSTANCE}}/api/target-columns/ -
In the HTTP request header, include the parameter
Authorizationwith valueBearer {{KEY}}. -
Send the request.
Import the request example as raw text to your HTTP client (such as Postman). The cURL request example is the following:
curl --location -g --request OPTIONS 'https://{{INSTANCE}}/api/target-columns/' \
--header 'Authorization: Bearer {{KEY}}'
Creating a new target column
If you could not find a target column matching the necessary configuration, create a new target column which you can later assign to a column retrieved from a datastream. To create a new target column, follow these steps:
-
Create a POST request to the following endpoint:
https://{{INSTANCE}}/api/target-columns/ -
In the HTTP request header, include the parameter
Authorizationwith valueBearer {{KEY}}. -
In the HTTP request header, include the parameter
Content-Typewith valueapplication/json. -
In the HTTP request body, include the following required parameters:
{ "type": "String", "name": "{{TARGET_COLUMN_NAME}}", "usage": "dimension" }These are the required parameters. The value of the
usageparameter is eitherdimensionormetric. -
Send the request.
Import the request example as raw text to your HTTP client (such as Postman). The cURL request example is the following:
curl --location -g --request POST 'https://{{INSTANCE}}/api/target-columns/' \
--header 'Authorization: Bearer {{KEY}}' \
--header 'Content-Type: application/json' \
--data-raw '{
"type": "String",
"name": "{{TARGET_COLUMN_NAME}}",
"usage": "dimension"
}'
Viewing a target column mapping
To view the list of default schema mappings assigned to a target column, follow the steps below:
-
Create a GET request to the following endpoint:
https://{{INSTANCE}}/api/target-columns/{{TARGET_COLUMN_ID}}/mappings/ -
In the HTTP request header, include the parameter
Authorizationwith valueBearer {{KEY}}. -
In the HTTP request header, include the parameter
Content-Typewith valueapplication/json. -
Optionally, add query parameters to filter the results:
Scroll horizontally to see the full table.
Parameter
Description
is_key_columnFilter by whether the mapped source column is a key column. Accepted values:
true,false.source_column_nameFilter by the exact name of the source column.
source_content_typeFilter by the numeric content type ID of the connector the mapping applies to.
-
Send the request.
As a result, you obtain a paginated list of default schema mappings for the target column.
Import the request example as raw text to your HTTP client (such as Postman). The cURL request example is the following:
curl --location -g --request GET 'https://{{INSTANCE}}/api/target-columns/{{TARGET_COLUMN_ID}}/mappings/' \
--header 'Authorization: Bearer {{KEY}}' \
--header 'Content-Type: application/json'
Updating column mapping
In this section, you assign a column to a target column, or in other words, you configure the Data Mapping.
To update column mapping, follow these steps:
-
Create a PATCH request to the following endpoint:
https://{{INSTANCE}}/api/datastreams/{{DATASTREAM_ID}}/columns/{{COLUMN_ID}}/ -
In the HTTP request header, include the parameter
Authorizationwith valueBearer {{KEY}}. -
In the HTTP request header, include the parameter
Content-Typewith valueapplication/json. -
In the HTTP request body, include the following required parameters:
{ "is_key_column":"false", "set_default": "false", "target_column": {"id": {{TARGET_COLUMN_ID}}} } -
Send the request.
Import the request example as raw text to your HTTP client (such as Postman). The cURL request example is the following:
curl --location -g --request PATCH 'https://{{INSTANCE}}/api/datastreams/{{DATASTREAM_ID}}/columns/{{COLUMN_ID}}/' \
--header 'Authorization: Bearer {{KEY}}' \
--header 'Content-Type: application/json' \
--data-raw '{
"is_key_column":"false",
"set_default": "false",
"target_column": {"id": {{TARGET_COLUMN_ID}}}
}'
Bulk assigning column mappings
Instead of mapping columns one by one, you can assign multiple source columns to target columns in a single request. This operation replaces all existing mappings for the datastream - any column not included in the request body will be left unmapped.
To bulk assign column mappings, follow these steps:
-
Create a PUT request to the following endpoint:
https://{{INSTANCE}}/api/datastreams/{{DATASTREAM_ID}}/columns/map/ -
In the HTTP request header, include the parameter
Authorizationwith valueBearer {{KEY}}. -
In the HTTP request header, include the parameter
Content-Typewith valueapplication/json. -
In the HTTP request body, include a list of mapping objects. Each object must contain the following parameters:
-
schema_column- the name of the target column to assign to. -
source_column- the name of the source column from the datastream to map. -
is_key_column(optional) - a boolean that marks the source column as a key column. When included, the value is applied to the matched source column. When omitted, the column’s existingis_key_columnvalue is preserved. Source columns not included in the request are also unaffected.
[ { "schema_column": "{{TARGET_COLUMN_NAME}}", "source_column": "{{SOURCE_COLUMN_NAME}}", "is_key_column": true }, { "schema_column": "{{TARGET_COLUMN_NAME}}", "source_column": "{{SOURCE_COLUMN_NAME}}" } ] -
-
Send the request.
Import the request example as raw text to your HTTP client (such as Postman). The cURL request example is the following:
curl --location -g --request PUT 'https://{{INSTANCE}}/api/datastreams/{{DATASTREAM_ID}}/columns/map/' \
--header 'Authorization: Bearer {{KEY}}' \
--header 'Content-Type: application/json' \
--data-raw '[
{
"schema_column": "{{TARGET_COLUMN_NAME}}",
"source_column": "{{SOURCE_COLUMN_NAME}}",
"is_key_column": true
}
]'
Removing column mapping
In this section, you remove a column’s mapping (unmap a column) using Management API.
To remove a column’s mapping (unmap a column), follow these steps:
-
Create a PATCH request to the following endpoint:
https://{{INSTANCE}}/api/datastreams/{{DATASTREAM_ID}}/columns/{{COLUMN_ID}}/ -
In the HTTP request header, include the parameter
Authorizationwith valueBearer {{KEY}}. -
In the HTTP request header, include the parameter
Content-Typewith valueapplication/json. -
In the HTTP request body, include an empty
target_columnobject:{ "target_column": {} } -
Send the request.
Import the request example as raw text to your HTTP client (such as Postman). The cURL request example is the following:
curl --location -g --request PATCH 'https://{{INSTANCE}}/api/datastreams/{{DATASTREAM_ID}}/columns/{{COLUMN_ID}}/' \
--header 'Authorization: Bearer {{KEY}}' \
--header 'Content-Type: application/json' \
--data-raw '{
"target_column": {}
}'
Managing default schema mappings
A default schema mapping assigns a source column — identified by its name and connector content type — to a target column, independently of any single datastream. Once configured, matching source columns in datastreams of that connector type are mapped to the target column automatically.
Listing all default schema mappings
To list default schema mappings across all target columns, follow these steps:
-
Create a GET request to the following endpoint:
https://{{INSTANCE}}/api/default-schema-mappings/ -
In the HTTP request header, include the parameter
Authorizationwith valueBearer {{KEY}}. -
Optionally, add query parameters to filter the results:
Scroll horizontally to see the full table.
Parameter
Description
is_key_columnFilter by whether the mapped source column is a key column. Accepted values:
true,false.source_column_nameFilter by the exact name of the source column.
source_content_typeFilter by the numeric content type ID of the connector the mapping applies to.
-
Send the request.
As a result, you obtain a paginated list of default schema mappings.
Import the request example as raw text to your HTTP client (such as Postman). The cURL request example is the following:
curl --location -g --request GET 'https://{{INSTANCE}}/api/default-schema-mappings/' \
--header 'Authorization: Bearer {{KEY}}'
Creating a default schema mapping
To create a default schema mapping, follow these steps:
-
Create a POST request to the following endpoint:
https://{{INSTANCE}}/api/default-schema-mappings/ -
In the HTTP request header, include the parameter
Authorizationwith valueBearer {{KEY}}. -
In the HTTP request header, include the parameter
Content-Typewith valueapplication/json. -
In the HTTP request body, include the following parameters:
Scroll horizontally to see the full table.
Parameter
Required
Description
source_column_nameYes
The exact name of the source column to map.
source_content_typeYes
The numeric content type ID of the connector this mapping applies to.
target_column_idYes
The
IDof the target column to map the source column to.is_key_columnNo
Whether to mark the mapped source column as a key column. Defaults to
false. -
Send the request.
As a result, the default schema mapping is created and returned in the response.
Import the request example as raw text to your HTTP client (such as Postman). The cURL request example is the following:
curl --location -g --request POST 'https://{{INSTANCE}}/api/default-schema-mappings/' \
--header 'Authorization: Bearer {{KEY}}' \
--header 'Content-Type: application/json' \
--data-raw '{
"source_column_name": "{{SOURCE_COLUMN_NAME}}",
"source_content_type": {{CONTENT_TYPE_ID}},
"target_column_id": {{TARGET_COLUMN_ID}}
}'
Updating a default schema mapping
To update a default schema mapping, follow these steps:
-
Create a PATCH request to the following endpoint:
https://{{INSTANCE}}/api/default-schema-mappings/{{MAPPING_ID}}/ -
In the HTTP request header, include the parameter
Authorizationwith valueBearer {{KEY}}. -
In the HTTP request header, include the parameter
Content-Typewith valueapplication/json. -
In the HTTP request body, include any of the parameters documented in Creating a default schema mapping that you want to change.
-
Send the request.
As a result, the default schema mapping is updated and returned in the response.
Import the request example as raw text to your HTTP client (such as Postman). The cURL request example is the following:
curl --location -g --request PATCH 'https://{{INSTANCE}}/api/default-schema-mappings/{{MAPPING_ID}}/' \
--header 'Authorization: Bearer {{KEY}}' \
--header 'Content-Type: application/json' \
--data-raw '{
"is_key_column": true
}'
This endpoint returns the same 409 response described in Creating a default schema mapping if the update collides with another mapping.
Removing a default schema mapping
To remove a default schema mapping, follow these steps:
-
Create a DELETE request to the following endpoint:
https://{{INSTANCE}}/api/default-schema-mappings/{{MAPPING_ID}}/ -
In the HTTP request header, include the parameter
Authorizationwith valueBearer {{KEY}}. -
Send the request.
As a result, the default schema mapping is removed.
Import the request example as raw text to your HTTP client (such as Postman). The cURL request example is the following:
curl --location -g --request DELETE 'https://{{INSTANCE}}/api/default-schema-mappings/{{MAPPING_ID}}/' \
--header 'Authorization: Bearer {{KEY}}'
Exporting and importing workspace schema
You can export the schema of a workspace — including all target columns and their default mappings — using the following endpoint:
GET https://{{INSTANCE}}/api/stacks/{{WORKSPACE_SLUG}}/schema/
The response contains a target_columns array with each column’s name, data type, and any configured default mappings. An example response for a workspace with no target columns is:
{"target_columns": []}
For the full request syntax and authentication requirements, see the API reference.