Creating and configuring transformations in Management API#
This article documents how to create, list, edit and delete transformations with the Management API.
Creating a transformation through Management API#
To create a transformation through Management API, follow these steps:
Create a POST request to the following endpoint:
https://{{INSTANCE}}/api/transformer/
In the HTTP request header, include the parameter
Authorization
with one of the following values:Token {{KEY}}
if you use a key generated with user credentials in Management API.Bearer {{KEY}}
if you use a key generated in the Adverity user interface.
In the HTTP request header, include the parameter
Content-Type
with valueapplication/json
.In the HTTP request body, include the
name
parameter with the value{{TRANSFORMER_NAME}}
.Replace
{{TRANSFORMER_NAME}}
with the name you want to give the transformation. This value is always required.In the HTTP request body, include the
stack
parameter with the value{{WORKSPACE_NAME}}
.Replace
{{WORKSPACE_NAME}}
with the name of your workspace. This value is always required.In the HTTP request body, include the
instructions
parameter. This parameter does not need a value.Send the request.
As a result, you create a transformation with the
name{{TRANSFORMER_NAME}}
in the workspace
{{WORKSPACE_NAME}}
.
Import the request example as raw text to your HTTP client (such as Postman). The cURL request example is the following:
curl --request POST 'https://{{INSTANCE}}/api/transformer/' \
--header 'Authorization: Token {{KEY}}' \
--header 'Content-Type: application/json' \
--data-raw '{
"name": "{{TRANSFORMER_NAME}}",
"stack": {{WORKSPACE_NAME}},
"instructions": [
[
"select",
{
"complement": false,
"subtable": null,
"where": "{COLUMN}",
"_comment": null
}
]
]
}'
Listing existing transformations through Management API#
To obtain a list of all existing transformations through Management API, follow these steps:
Create a GET request to the following endpoint:
https://{{INSTANCE}}/api/transformer/
In the HTTP request header, include the parameter
Authorization
with one of the following values:Token {{KEY}}
if you use a key generated with user credentials in Management API.Bearer {{KEY}}
if you use a key generated in the Adverity user interface.
As a result, you obtain a list of all the existing transformations in your Adverity instance.
Import the request example as raw text to your HTTP client (such as Postman). The cURL request example is the following:
curl --request GET 'https://{{INSTANCE}}/api/transformer/' \
--header 'Authorization: Token {{KEY}}'
The example response below shows a list containing just one transformation.
{
"count": XX,
"next": null,
"previous": null,
"results": [
{
"id": {{TRANSFORMER_ID}},
"name": "{{TRANSFORMER_NAME}}",
"stack": {{STACK_ID}},
"change_url": "/transformer/transformerconfig/TRANSFORMER_ID/change/"
}
]
}
Viewing the instructions within a specific transformation through Management API#
To view the instructions within the body of a specific transformation through Management API, follow these steps:
Create a GET request to the following endpoint:
https://{{INSTANCE}}/api/transformer/{{TRANSFORMER_ID}}/
Replace
{{TRANSFORMER_ID}}
with the ID you obtained in the response to the GET request in the previous section. For more information on obtaining the ID, see Listing existing Management API transformations.In the HTTP request header, include the parameter
Authorization
with one of the following values:Token {{KEY}}
if you use a key generated with user credentials in Management API.Bearer {{KEY}}
if you use a key generated in the Adverity user interface.
As a result, you obtain a response that contains the body of instructions for the specified enrichment.
Import the request example as raw text to your HTTP client (such as Postman). The cURL request example is the following:
curl --request GET 'https://{{INSTANCE}}/api/transformer/{{TRANSFORMER_ID}}/' \
--header 'Authorization: Token {{KEY}}'
The example response below shows the instructions for a transformation
called {{TRANSFORMER_NAME}}
containing the instruction “select”.
{
"id": {{TRANSFORMER_ID}},
"name": "{{TRANSFORMER_NAME}}",
"stack": {{STACK_ID}},
"change_url": "/transformer/transformerconfig/{{TRANSFORMER_ID}}/change/",
"instructions": [
[
"select",
{
"complement": false,
"subtable": null,
"where": "{column1}",
"_comment": null
}
]
]
}
Editing an existing transformation through Management API#
To edit an existing transformation through Management API, follow these steps:
Create a PATCH request to the following endpoint:
https://{{INSTANCE}}/api/transformer/{{TRANSFORMER_ID}}/
Replace
{{TRANSFORMER_ID}}
with the transformation ID. For more information on obtaining the ID, see Listing existing Management API transformations.In the HTTP request header, include the parameter
Authorization
with one of the following values:Token {{KEY}}
if you use a key generated with user credentials in Management API.Bearer {{KEY}}
if you use a key generated in the Adverity user interface.
In the HTTP request header, include the parameter
Content-Type
with valueapplication/json
.In the HTTP request body, include the changes you want to make to the Management API transformation by entering the property you want to change, followed by what you want to change it to. In the example request below, the name of the Management API transformation is being changed to
{{NEW_NAME}}
.
As a result, you make the specified change to the transformation.
Import the request example as raw text to your HTTP client (such as Postman). The cURL request example is the following:
curl --request PATCH 'https://{{INSTANCE}}/api/transformer/{{TRANSFORMER_ID}}/' \
--header 'Authorization: Token {{KEY}}' \
--header 'Content-Type: application/json' \
--data-raw '{"name":"{{NEW_NAME}}"}'
Deleting an existing transformation through Management API#
To delete an existing transformation through Management API, follow these steps:
Create a DELETE request to the following endpoint:
https://{{INSTANCE}}/api/transformer/{{TRANSFORMER_ID}}/
Replace
{{TRANSFORMER_ID}}
with the Management API transformation ID. For more information on obtaining the ID, see Listing existing Management API transformations.In the HTTP request header, include the parameter
Authorization
with one of the following values:Token {{KEY}}
if you use a key generated with user credentials in Management API.Bearer {{KEY}}
if you use a key generated in the Adverity user interface.
As a result, you delete the transformation with the ID
{{TRANSFORMER_ID}}
.
Import the request example as raw text to your HTTP client (such as Postman). The cURL request example is the following:
curl --request DELETE 'https://{{INSTANCE}}/api/transformer/{{TRANSFORMER_ID}}/' \
--header 'Authorization: Token {{KEY}}'