Impossible to download artifacts

Hello

I’m trying to download an artifacts from a previous successful build into my current build
Do do so, I’m running:
curl "https://circleci.com/api/v1/project/my-user/my-project/latest/artifacts/0/\CIRCLE_ARTIFACTS/terraform.tfstate?branch=master&filter=successful&circle-token=token"

Although this is giving me a Bad Request exception
I’ve tried the above url in my browsed and it worked fine

By doing:
curl -O -J -L "https://circleci.com/api/v1/project/my-user/my-project/latest/artifacts/0/\CIRCLE_ARTIFACTS/terraform.tfstate?branch=master&filter=successful&circle-token=token"

I manage to downlaod a file which content is:
must be logged in

similar discussion here, also without an answer: Downloading build artifact using wget throws out a 400 Bad Request

To download individual artifacts via the API you first need to get the artifact URL. This is documented here: https://circleci.com/docs/api/v1-reference/#build-artifacts

Also note that the value of circle-token should be set to a valid API token that you create from your account page: https://circleci.com/account/api

A shortcut for downloading all artifacts for a build is described here: Download all artifacts for a build on CircleCI

What helped for us is not using the “personal token” but rather create a token from the “API permissions” in the project settings.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.