Create a new table trigger using XanoScript
Authentication: required
curl --request POST \
--url https://your-xano-instance.xano.io/api:meta/workspace/{workspace_id}/table/trigger \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: text/x-xanoscript' \
--data 'table_trigger foo {
table = "user"
input {
json new
json old
enum action {
values = ["insert", "update", "delete", "truncate"]
}
text datasource
}
stack {
var $x1 {
value = $input.score + 1
}
}
actions = {insert: true, update: true}
}
'{
"id": 1,
"created_at": "2023-04-19 21:01:32+0000",
"updated_at": "2023-04-19 21:01:32+0000",
"name": "Database Table Trigger",
"description": "My database table trigger test description",
"guid": "YE1fwVhQ-enRlc6Sb42Gqru58-0",
"branch": "v1",
"tag": [
"example tag"
],
"datasources": [
"live"
],
"actions": {
"insert": true,
"update": true,
"delete": true,
"truncate": true
},
"xanoscript": {
"status": "ok",
"value": "<string>",
"message": "<string>"
}
}Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
The body is of type string.
"table_trigger foo {\n table = \"user\"\n input {\n json new\n json old\n enum action {\n values = [\"insert\", \"update\", \"delete\", \"truncate\"]\n }\n text datasource\n }\n stack {\n var $x1 {\n value = $input.score + 1\n }\n }\n actions = {insert: true, update: true}\n}\n"
Success!
Show child attributes
Show child attributes
Was this page helpful?
curl --request POST \
--url https://your-xano-instance.xano.io/api:meta/workspace/{workspace_id}/table/trigger \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: text/x-xanoscript' \
--data 'table_trigger foo {
table = "user"
input {
json new
json old
enum action {
values = ["insert", "update", "delete", "truncate"]
}
text datasource
}
stack {
var $x1 {
value = $input.score + 1
}
}
actions = {insert: true, update: true}
}
'{
"id": 1,
"created_at": "2023-04-19 21:01:32+0000",
"updated_at": "2023-04-19 21:01:32+0000",
"name": "Database Table Trigger",
"description": "My database table trigger test description",
"guid": "YE1fwVhQ-enRlc6Sb42Gqru58-0",
"branch": "v1",
"tag": [
"example tag"
],
"datasources": [
"live"
],
"actions": {
"insert": true,
"update": true,
"delete": true,
"truncate": true
},
"xanoscript": {
"status": "ok",
"value": "<string>",
"message": "<string>"
}
}