I'm writing devops pipelines in a Docker Enterprise 3.2 environment.
I am able to fetch all stacks from the UCP API. Now I need to fetch single stacks but the documentation seems to omit completely this resource.
Is there anything as:
ucp_url/api/stacks/my_awesome_stack_name
or
ucp_url/api/stacks?name=my_awesome_stack_name
?
Short answer
The field
namespaceis the identifier of the stack. Callingapi/stacks/my_namespacewill get the desired stack.How I found this
After fiddling a bit with the documentation and the api, I realized that the
stacksresource is just another collection that can be selected using its identifier.When you invoke
api/stacksyou'll receive a collection of stacks looking like this:I simply tried
api/stacks/my_awesome_namespace_1and received the desired object in json format.And beyond
I believe the most important thing to this answer is that this method could be generalized to any UCP resource.
my_awesome_resource/my_awesome_resource_identifier