LIST EXISTING TRANSFORMATIONS
To get a list of all existing transformations (transformer objects), perform a GET request.
curl -X GET \
https://YOUR_STACK.datatap.adverity.com/api/transformer/ \
-H 'Authorization: Token TOKEN_VALUE'
Result (cropped for 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/"
}
]
}
Add the TRANSFORMER_ID to the request URL and perform another GET request to display the body of instructions. In the example below, the instruction is "select".
curl -X GET \
https://YOUR_STACK.datatap.adverity.com/api/transformer/TRANSFORMER_ID \
-H 'Authorization: Token TOKEN_VALUE'
Result
{
"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
}
]
]
}
EDIT A TRANSFORMATION
To edit an existing transformation, perform a PATCH request, where the elements to be changed must be contained within the body. In the below example, the name is changed to "NEW_NAME".
curl -X PATCH \
https://YOUR_STACK.datatap.adverity.com/api/transformer/TRANSFORMER_ID/ \
-H 'Authorization: Token TOKEN_VALUE' \
-H 'Content-Type: application/json' \
-d '{"name":"NEW_NAME"}'
CREATE A NEW TRANSFORMATION
To create a new transformation, perform a POST request with the instructions in the body. As in the UI, instructions must not necessarily be populated, but a NAME & WORKSPACE are always required.
curl -X POST \
https://YOUR_STACK.datatap.adverity.com/api/transformer/ \
-H 'Authorization: Token TOKEN_VALUE' \
-H 'Content-Type: application/json' \
-d '{
"name": "TRANSFORMER_NAME",
"stack": STACK_ID,
"instructions": [
[
"select",
{
"complement": false,
"subtable": null,
"where": "{COLUMN}",
"_comment": null
}
]
]
}'
DELETE A TRANSFORMATION
To delete a transformation, perform a DELETE request using the relevant "TRANSFORMER_ID".
curl -X DELETE \
https://YOUR_STACK.datatap.adverity.com/api/transformer/TRANSFORMER_ID/
\
-H 'Authorization: Token TOKEN_VALUE' \
Comments
0 comments
Article is closed for comments.