Configuring mapping tables in Management API

This article explains how to list all mapping tables in a given workspace, how to list and edit mapping entries, and how to update or delete mapping entries with the Management API.

Listing mapping tables

To list all mapping tables present in your Adverity instance, follow these steps:

  1. Create a GET request to the following endpoint:

    https://{{INSTANCE}}/api/mapping-tables
  2. In the HTTP request header, include the parameter Authorization with value Token {{TOKEN}}.

  3. 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/mapping-tables/' \
--header 'Authorization: Token {{TOKEN}}'

Listing mapping table entries

To list entries of a specific mapping table, follow these steps:

  1. Create a GET request to the following endpoint:

    https://{{INSTANCE}}/api/mapping-tables/{{MAPPING_TABLE_ID}}/entries/

    Use MAPPING_TABLE_ID from the API response described in the previous section.

  2. In the HTTP request header, include the parameter Authorization with value Token {{TOKEN}}.

  3. 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/mapping-tables/{{MAPPING_TABLE_ID}}/entries/' \
--header 'Authorization: Token {{TOKEN}}'

Creating a new mapping table entry

To create a new mapping table entry, follow these steps:

  1. Create a POST request to the following endpoint:

    https://{{INSTANCE}}/api/mapping-tables/{{MAPPING_TABLE_ID}}/entries/
  2. In the HTTP request header, include the parameter Authorization with value Token {{TOKEN}}.

  3. In the HTTP request header, include the parameter Content-Type with value application/json.

  4. In the HTTP request body, include the parameter match with the source value and parameter value with the target value. For more information on source and target values in mapping tables, see Creating and applying mapping tables.

  5. Send the request.

  6. In the response, you receive the entry_id of the newly added mapping table entry. You can list it again with the call described in the previous section.

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/mapping-tables/{{MAPPING_TABLE_ID}}/entries/' \
--header 'Authorization: Token {{TOKEN}}' \
--header 'Content-Type: application/json' \
--data-raw '{
    "match": "SOURCE_VALUE"
    "value": "TARGET_VALUE"
}'

Updating a mapping table entry

To update a mapping table entry, follow these steps:

  1. Create a PATCH request to the following endpoint:

    https://{{INSTANCE}}/api/mapping-tables/{{MAPPING_TABLE_ID}}/entries/{{ENTRY_ID}}/
  2. In the HTTP request header, include the parameter Authorization with value Token {{TOKEN}}.

  3. In the HTTP request header, include the parameter Content-Type with value application/json.

  4. In the HTTP request body, include the match or value parameters and their respective values to edit. For example, for the parameter value, change the value computer to desktop.

    {
        "value": "UPDATED_VALUE"
    }
  5. 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/mapping-tables/{{MAPPING_TABLE_ID}}/entries/{{ENTRY_ID}}/' \
--header 'Authorization: Token {{TOKEN}}' \
--header 'Content-Type: application/json' \
--data-raw '{
    "value": "UPDATED_VALUE"
}'

Deleting a mapping table entry

To delete a mapping table entry, follow these steps:

  1. Create a DELETE request to the following endpoint:

    https://{{INSTANCE}}/api/mapping-tables/{{MAPPING_TABLE_ID}}/entries/{{ENTRY_ID}}/
  2. In the HTTP request header, include the parameter Authorization with value Token {{TOKEN}}.

  3. 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 DELETE 'https://{{INSTANCE}}/api/mapping-tables/{{MAPPING_TABLE_ID}}/entries/{{ENTRY_ID}}/' \
--header 'Authorization: Token {{TOKEN}}'