The Target Columns endpoint provides all available Data Schema Columns.
LIST TARGET COLUMNS
Perform a GET request to list all available entries.
curl -X GET \
https://YOUR_STACK.datatap.adverity.com/api/target-columns/ \
-H 'Authorization: Token TOKEN_VALUE' \
Result (cropped for 1 entry)
{
"count": XX,
"next": null,
"previous": null,
"results": [
{
"id": ENTRY_ID,
"name": "ENTRY_NAME",
"usage": "DIMENSION/METRIC",
"mappings": "https://YOUR_STACK.datatap.adverity.com/api/target-columns/ENTRY_ID/mappings/",
"type": "TYPE",
"length": "LENGTH"/null,
"measure": "MEASURE"/null,
"url": "https://YOUR_STACK.datatap.adverity.com/api/target-columns/ENTRY_ID/",
"stack": STACK_ID
}
]
}
CREATE A NEW TARGET COLUMN
Perform an OPTIONS call to see all available options for type, stack measure, length.
It might initially make sense to get familiar with the Data Schema Entry creation within the UI, as described here. Examples of types might be: String, Float, Long, Date etc. As in the UI, within the name, only lower case characters, digits and '_' are allowed.
curl -X POST \
https://YOUR_STACK.datatap.adverity.com/api/target-columns/ \
-H 'Authorization: Token TOKEN_VALUE' \
-d '{"type":"TYPE","name":"ENTRY_NAME","stack":STACK_ID}'
Result
{
"id": ENTRY_ID,
"name": "ENTRY_NAME",
"usage": "dimension",
"mappings": "https://YOUR_STACK.datatap.adverity.com/api/target-columns/ENTRY_ID/mappings/",
"type": "TYPE",
"length": "LENGTH"/null,
"measure": "MEASURE"/null,
"url": "https://YOUR_STACK.datatap.adverity.com/api/target-columns/ENTRY_ID/",
"stack": STACK_ID
}
MODIFY OR DELETE A TARGET COLUMN
Using the ENTRY_ID of a specific entry, it can be modified or deleted.
To modify, perform a PATCH request with the specific ENTRY_ID, e.g. to change its name and turn it into a float metric.
curl -X PATCH \
https://YOUR_STACK.datatap.adverity.com/api/target-columns/ENTRY_ID/ \
-H 'Authorization: Token TOKEN_VALUE' \
-d '{"type":"Float","name":"METRIC_FLOAT_ENTRY","measure":"SUM"}'
To delete a Data Schema entry, perform a DELETE request.
curl -X DELETE \
https://YOUR_STACK.datatap.adverity.com/api/target-columns/ENTRY_ID/ \
-H 'Authorization: Token TOKEN_VALUE' \
To get mappings:
{
"count": XX,
"next": null,
"previous": null,
"results": [
{
"id": MAPPING_ID,
"source_column_name": "SOURCE_NAME",
"source_content_type": SOURCE_CONTENT_TYPE,
"target_column": {
"id": ENTRY_ID,
"name": "ENTRY_NAME",
"usage": "DIMENSION/METRIC",
"mappings": "https://YOUR_STACK.datatap.adverity.com/api/target-columns/ENTRY_ID/mappings/",
"type": "TYPE",
"length": "LENGTH"/null,
"measure": "MEASURE"/null,
"url": "https://YOUR_STACK.datatap.adverity.com/api/target-columns/ENTRY_ID/",
"stack": STACK_ID
},
"is_key_column": false
}
]
}
UPDATE TARGET COLUMN MAPPINGS (DEFAULTS)
curl -X PATCH \
https://YOUR_STACK.datatap.adverity.com/api/target-columns/ENTRY_ID/mappings/MAPPING_ID/ \
-H 'Authorization: Token TOKEN_VALUE' \
-d '{"source_content_type":"SOURCE_CONTENT_TYPE","source_column_name":"SOURCE_NAME"}'
DELETE TARGET COLUMN MAPPING
curl -X DELETE \
https://YOUR_STACK.datatap.adverity.com/api/target-columns/ENTRY_ID/mappings/MAPPING_ID/ \
-H 'Authorization: Token TOKEN_VALUE' \
Comments
0 comments
Article is closed for comments.