Problem
When mocking an API endpoint to respond to a webhook, Run Task Callback may return {"errors":["Not found"],"success":false}
However, the Callback URL and Access Token are correct.
Cause
It's likely caused by the incorrect API method used, e.g. POST.
As per the documentation, the expected one is PATCH.
Solution
Modify the API request to use PATCH method.
For the test, you can validate with the following example:
API Payload
{
"data": {
"type": "task-results",
"attributes": {
"status": "passed",
"message": "Test"
}
}
}
API Callback
curl \
--header "Authorization: Bearer $TOKEN" \
--header "Content-Type: application/vnd.api+json" \
--request PATCH \
--data @payload.json \
https://app.terraform.io/api/v2/task-results/5ea8d46c-2ceb-42cd-83f2-82e54697bddd/callback
The URL needs to be replaced with the value of task_result_callback_url
Outcome
Run Task Callback responds with successful 200 status code