I want to cancel curently running stage and when run:
curl "http://go.com/go/api/stages/lab2018.AllTests/183/HarnessSelfTests/1/cancel" -X POST -H 'X-GoCD-Confirm: true' -u "user:password" -H 'Accept: application/vnd.go.cd.v4+json' | json_pp
Basically, I've tried both requests for different versions and both do not work.
curl "http://go.com/go/api/stages/lab2018.AllTests/HarnessSelfTests/cancel" -X POST -H 'Confirm: true' -u "user:password" -H 'Accept: application/vnd.go.cd.v4+json' | json_pp
I got:
{
"message" : "The resource you requested was not found!"
}
Meanwhile, if I run 'Get stage Instance' with the same parameters:
curl "http://go.com/go/api/stages/lab2018.AllTests/HarnessSelfTests/instance/183/1" -X GET -u "user:password" 'Accept: application/vnd.go.cd.v4+json' | json_pp
I got the proper JSON with information about the requested instance.
GoCD version is Go Version: 18.10.0 (7703-42d1cbe661161b5400289ead86c0447c84af8c0a).
GoCD documentation says Available since v14.3.0.
Any proposals what could cause the error? Any ideas how can I debug the issue?
Ok, the problem is with 'Accept: application/vnd.go.cd.v4+json'
header. For the versions less than 19.8.0, this header should not be used. If you use it, it breaks the call. Correct API call:
curl "http://go.com/go/api/stages/lab2018.AllTests/HarnessSelfTests/cancel" -X POST -H 'Confirm: true' -u "user:password"