Create a new function using XanoScript
Authentication: required
curl --request POST \
--url https://your-xano-instance.xano.io/api:meta/workspace/{workspace_id}/function \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: text/x-xanoscript' \
--data 'function foo {
input {
int score
}
stack {
var $x1 {
value = $input.score + 1
}
}
response = $x1
}
'{
"id": 1,
"created_at": "2023-04-19 21:01:32+0000",
"updated_at": "2023-04-19 21:01:32+0000",
"name": "Function Test",
"description": "My functions description",
"docs": "Documentation",
"guid": "YE1fwVhQ-enRlc6Sb42Gqru58-0",
"branch": "v1",
"cache": {
"active": true,
"ttl": 3600,
"input": true,
"auth": true,
"datasource": true,
"ip": true,
"headers": [
""
],
"env": [
""
]
},
"tag": [
"example tag"
],
"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.
"function foo {\n input {\n int score\n }\n stack {\n var $x1 {\n value = $input.score + 1\n }\n }\n response = $x1\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}/function \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: text/x-xanoscript' \
--data 'function foo {
input {
int score
}
stack {
var $x1 {
value = $input.score + 1
}
}
response = $x1
}
'{
"id": 1,
"created_at": "2023-04-19 21:01:32+0000",
"updated_at": "2023-04-19 21:01:32+0000",
"name": "Function Test",
"description": "My functions description",
"docs": "Documentation",
"guid": "YE1fwVhQ-enRlc6Sb42Gqru58-0",
"branch": "v1",
"cache": {
"active": true,
"ttl": 3600,
"input": true,
"auth": true,
"datasource": true,
"ip": true,
"headers": [
""
],
"env": [
""
]
},
"tag": [
"example tag"
],
"xanoscript": {
"status": "ok",
"value": "<string>",
"message": "<string>"
}
}