Cannot Get /api/tasks/{id}/state to Work

I want to update a deployment task state using the REST API. I have the task ID. I have tried the following:
data=’{“State”:[“1”]}'
and
data=’{“State”:“1”}'
and
data=’{“State”:“Failed”}'
using
curl -X POST -d “$data” “https://xxxxxxxxxxx.com/api/tasks/ServerTasks-1593657/state” -H “accept: application/json” -H "X-Octopus-ApiKey: API-xxxxxxxxxxxxxxxxxxxxxx"

I get the following error:

{
“ErrorMessage”: “There was a problem with your request.”,
“Errors”: [
“No state was provided.”
],
“ParsedHelpLinks”: []
}

I got it!

data=’{“state”:“failed”, “reason”:“Dev TeamCity Signup Test Failed”}’

I saw the possible error messages in the Swagger UI entry

Hi Bob,

Glad to see that you worked this one out. If you have any suggestions on how we could improve here I would love for you to send them through.

Please let me know if there is anything else we can assist with,

Regards,
Alex

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.