Authorizations
Cookie-based authentication
Body
application/json
The new User Defined Function that should be created. The ID does not need to be included in the payload, as it will be generated automatically.
curl --request POST \
--url https://demo.enneo.ai/api/mind/settings/user-defined-function \
--header 'Content-Type: application/json' \
--data '{
"id": 1,
"type": "tool",
"data": {
"udfExecutor": {
"id": 1,
"code": "<?php\n\n// Load enneo SDK. Input is made available through $in\nuse EnneoSDK\\Api;\nuse EnneoSDK\\ApiEnneo;\nrequire(getenv()['\''SDK'\'']);\n\nfunction exampleApiCall(string $method, string $api, array|object|string|false $params = false, $attempt = 1): stdClass|array\n{\n // load token\n $token = ApiEnneo::executeUdf('\''fetchToken'\'', [])->token;\n\n // make request\n $res = Api::call(\n method: $method,\n url: sprintf('\''urlExampleHere'\'', $api),\n headers: [\n sprintf('\''Authorization: Bearer %s'\'', $token),\n '\''x-api-key: tokenExampleHere'\'',\n '\''Accept: application/json'\''\n ],\n params: $params\n );\n\n return $res;\n}\n\necho json_encode(exampleApiCall($in->method, $in->api, $in->params));",
"type": "sourceCode",
"language": "php82",
"packages": "",
"parameters": []
}
},
"name": "exampleApiCall"
}'
{
"success": true,
"id": 12345
}
Cookie-based authentication
The new User Defined Function that should be created. The ID does not need to be included in the payload, as it will be generated automatically.
curl --request POST \
--url https://demo.enneo.ai/api/mind/settings/user-defined-function \
--header 'Content-Type: application/json' \
--data '{
"id": 1,
"type": "tool",
"data": {
"udfExecutor": {
"id": 1,
"code": "<?php\n\n// Load enneo SDK. Input is made available through $in\nuse EnneoSDK\\Api;\nuse EnneoSDK\\ApiEnneo;\nrequire(getenv()['\''SDK'\'']);\n\nfunction exampleApiCall(string $method, string $api, array|object|string|false $params = false, $attempt = 1): stdClass|array\n{\n // load token\n $token = ApiEnneo::executeUdf('\''fetchToken'\'', [])->token;\n\n // make request\n $res = Api::call(\n method: $method,\n url: sprintf('\''urlExampleHere'\'', $api),\n headers: [\n sprintf('\''Authorization: Bearer %s'\'', $token),\n '\''x-api-key: tokenExampleHere'\'',\n '\''Accept: application/json'\''\n ],\n params: $params\n );\n\n return $res;\n}\n\necho json_encode(exampleApiCall($in->method, $in->api, $in->params));",
"type": "sourceCode",
"language": "php82",
"packages": "",
"parameters": []
}
},
"name": "exampleApiCall"
}'
{
"success": true,
"id": 12345
}