Hi everyone,
I’m working on a feature, where single button triggers a set of actions that grants permissions across related parent and child workflows, and delegates active task to other user using REST API.
I'm currently facing a frustrating issue with the task delegation API using the endpoint POST /api/data/v6.0/db/{dbId}/elements/{elementId}/admin/tasks/assignment
When I use this endpoint via Swagger, the task delegation executes successfully. Here's a sample of the payload that works perfectly in Swagger:
{
"task": {
"userId": "xxx@gmail.com"
},
"delegatedTask": {
"userId": "yyy@gmail.com",
"description": "Changed by REST Web Service",
"sendEmail": false,
"emailMessage": ""
}
}
It returns 200 OK with the message Task was delegated.
When I try to execute the exact same request from a “Call REST Web Service” action within a button, I consistently get a 500 Internal Server Error with timeout details, even though curl is identical as the one from swagger.
Error log:
Public Api POST /api/data/v6.0/db/1/elements/61445/admin/tasks/assignment
Status code: 500 Error message: Execution Timeout Expired. The timeout period elapsed prior to completion of the operation or the server is not responding.
The statement has been terminated. Callstack: Microsoft.Data.SqlClient.SqlException (0x80131904): Execution Timeout Expired. The timeout period elapsed prior to completion of the operation or the server is not responding.
Anyone got an idea what could be causing this error?
EDIT1:
Interestingly, when I change the userId in the payload to a non-existent user, the response returns:
409 Conflict
{
"type": "ValidationError",
"description": "User zzz@gmail.com does not exist or no tasks were found for this user.",
"errorGuid": "d0bdb551-8432-48a9-b011-f7e9cf10fb85"
}
But when the userId is correct and points to the actual task owner, the same request results in a 500 Internal Server Error. So the request passes validation and is received, but something goes wrong deep in the backend logic