trouble retrieiving template authorization via API

28 views
Skip to first unread message

Doug Lethin

unread,
Aug 6, 2019, 1:37:35 PM8/6/19
to go-cd
Hello.

While I'm successful using the API to get a template configuration, I'm unable to retrieve a templates authorization configuration.

Works:

curl "$GOCD_URI/go/api/admin/templates/node_pr_001" -u "${GOCD_USER}:${GOCD_PASS}"  -H 'Accept:application/vnd.go.cd.v4+json'

Does not work:

curl "$GOCD_URI/go/api/admin/templates/node_pr_001/authorization" -u "${GOCD_USER}:${GOCD_PASS}"  -H 'Accept:application/vnd.go.cd.v4+json'
<html><body><h2>404 Not found</h2></body></html>

I'm using this with the credentials of a user marked as "system-admin" in GoCD.  This seems to have regardless of whether I use the original credentials, or if I use a personal access token.

I'm using GoCD 19.6.  Shouldn't a system-admin be able to do anything?  Is there something else I'm missing?  The template name is correct and exists.

Thanks.

Doug

Varsha Varadarajan

unread,
Aug 6, 2019, 1:56:12 PM8/6/19
to go-cd
Hi,

The template authorization API is v1, not v4 as specified in https://api.gocd.org/19.6.0/#get-template-authorization
May be try using v1 and check if that works?

Thanks,
Varsha

Doug Lethin

unread,
Aug 6, 2019, 2:31:56 PM8/6/19
to go-cd
Thank you for the fast reply.  Unfortunately, it doesn't resolve the problem.  Same response if I try using v1:

curl "$GOCD_URI/go/api/admin/templates/node_pr_001/authorization" -u "${GOCD_USER}:${GOCD_PASS}"  -H 'Accept:application/vnd.go.cd.v1+json'

<html><body><h2>404 Not found</h2></body></html>

Ganesh Patil

unread,
Aug 7, 2019, 3:11:39 AM8/7/19
to go-cd

Hello Doug,

The Template Authorization API is broken in v19.6.0 version of GoCD. The API endpoint returns 404 (Not Found).

We've created a GitHub issue to track this bug. And a fix for the same has been merged as part of this pull request, which will be available as part of upcoming GoCD release v19.8.0


Thanks,
Ganesh

Doug Lethin

unread,
Aug 7, 2019, 7:40:15 AM8/7/19
to go-cd
Great, thanks. I was trying to use this endpoint within a simple script we are writing to clone templates. Something that would be helpful to have in the UI.

I see there is already already a feature request for this -- #336

Cheers.
Reply all
Reply to author
Forward
0 new messages