View compose files from API?

I’m trying to view the compose files (docker-compose, rancher-compose) for each stack via the API. When I go to http://rancher:8080/v1/projects/1a5/environments … I see everything, but the “dockerCompose” node is set to “null” for each stack.

I was expecting to see something there in that dockerCompose node. Should I be looking elsewhere for this? Note that I’m logged in as Owner in Rancher UI before I opened up the API.

Yeah those field probably shouldn’t be readable after create… they are the initial compose files that were (not, in this case) imported when you created the stack (environment). The exportconfig action will give you back the live config strings (as displayed in the UI), or the composeConfig link will download a ZIP that contains them.

Yeah I saw the link for downloading the zip file. Wasn’t exactly what we need… but we’ll come up with some solution. Thanks for the response!

You probably want the POST ${actions.exportconfig} action, it returns a JSON object that contains the dockerCompose and rancherCompose.

The composeConfig link does the ZIP download, which is probably not useful for you (it exists because there’s no way to generate a file to download from the UI even if we have retrieved the strings from the action).