Configuring mapping tables in Management API¶
This guide 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.
See GET /api/mapping-tables/, POST /api/mapping-tables/{parent_lookup_table_id}/entries/ and PATCH /api/mapping-tables/{parent_lookup_table_id}/entries/{id}/ in the API reference.
Prerequisites¶
Before you complete the procedures in this guide, perform the following action:
Use a Connect API key with the following permissions:
Workspace: Read-only (
workspace:read) to list mapping tables, value tables, and mapping entries.Workspace: Write (
workspace:write) to create, update, or delete mapping entries.
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.
Listing mapping tables¶
To list all mapping tables present in your Adverity instance, follow these steps:
Create a GET request to the following endpoint:
https://{{INSTANCE}}/api/mapping-tables
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/mapping-tables/' \
--header 'Authorization: Bearer {{KEY}}'
Listing mapping table entries¶
To list entries of a specific mapping table, follow these steps:
Create a GET request to the following endpoint:
https://{{INSTANCE}}/api/mapping-tables/{{MAPPING_TABLE_ID}}/entries/
Use
MAPPING_TABLE_IDfrom the API response described in the previous section.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/mapping-tables/{{MAPPING_TABLE_ID}}/entries/' \
--header 'Authorization: Bearer {{KEY}}'
Creating a new mapping table entry¶
To create a new mapping table entry, follow these steps:
Create a POST request to the following endpoint:
https://{{INSTANCE}}/api/mapping-tables/{{MAPPING_TABLE_ID}}/entries/
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 parameter
matchwith the source value and parametervaluewith the target value. For more information on source and target values in mapping tables, see Creating and applying mapping tables.Send the request.
In the response, you receive the
entry_idof 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: Bearer {{KEY}}' \
--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:
Create a PATCH request to the following endpoint:
https://{{INSTANCE}}/api/mapping-tables/{{MAPPING_TABLE_ID}}/entries/{{ENTRY_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
matchorvalueparameters and their respective values to edit. For example, for the parametervalue, change the valuecomputertodesktop.{ "value": "UPDATED_VALUE" }
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: Bearer {{KEY}}' \
--header 'Content-Type: application/json' \
--data-raw '{
"value": "UPDATED_VALUE"
}'
Deleting a mapping table entry¶
To delete a mapping table entry, follow these steps:
Create a DELETE request to the following endpoint:
https://{{INSTANCE}}/api/mapping-tables/{{MAPPING_TABLE_ID}}/entries/{{ENTRY_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 DELETE 'https://{{INSTANCE}}/api/mapping-tables/{{MAPPING_TABLE_ID}}/entries/{{ENTRY_ID}}/' \
--header 'Authorization: Bearer {{KEY}}'
Listing value tables¶
To list all value tables present in your Adverity instance, follow these steps:
Note
/api/value-tables/ requires a key with at least Workspace:
Read-only. A key without this permission receives a 403 error.
Create a GET request to the following endpoint:
https://{{INSTANCE}}/api/value-tables
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/value-tables/' \
--header 'Authorization: Bearer {{KEY}}'