Latest Artifacts API returns empty list

I can see the artifact of the latest build from master branch in circleci UI but “latest artifacts” API always returns empty list.

This API call returns empty list.
https://circleci.com/api/v1.1/project/github/user/project/latest/artifacts?circle-token=123456789&branch=master

But if I use latest build number and call “/:build_num/artifacts” API, it returns the correct artifact.

https://circleci.com/api/v1.1/project/github/user/project/320/artifacts?circle-token=123456789

The above API works fine by pulling the latest artifact using build number.

What could be the issue?

1 Like

I’m not able to reproduce this

https://circleci.com/api/v1.1/project/github/drazisil/junit-merge/389/artifacts

https://circleci.com/api/v1.1/project/github/drazisil/junit-merge/latest/artifacts?&branch=master

Can you open a ticket with the details of the project (and what type of token you are using) so we can take a look?

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

TLDR: Two jobs in the same workflow call the latest artifacts endpoint. The first gets the correct artifacts, the second gets an empty array.


I’m experiencing a similar issue, however in my case the trouble is that the api call to fetch the latest artifacts sometimes returns the expected data, and other times it is empty.

I have a repro workflow.
Essentially, the flow is:

  1. create job generates some dynamic text and stores it in a file, which is artifacted
  2. list job calls the /api/v1.1/project/github/user/project/latest/artifacts endpoint and outputs the result
  3. show job calls the same endpoint as list, but it stores the result in a file for later parsing

While the api call in list routinely outputs the expected response with a single artifact, the show job has always (thus far) received an empty array of artifacts.


2 Likes

We’re running into this issue as well. It seems to have started when we split our workflow into jobs and the job that produces the artifacts finishes before the others.

We’re looking at a workaround using https://circleci.com/api/v1.1/recent-builds but it would be nice to know if this can be solved another way, for example with an api argument to specify which job to get the artifacts from?

Thanks

1 Like

How do I filter builds by jobs for a single branch inside a workflow?

https://circleci.com/api/v1.1/project/:vcs-type/:username/:project/latest/artifacts?branch=master returns a list of artifacts for the latest build, but this can be different types of jobs - build, publish, test and so on.
So the structure of artifacts varies from query to query.

hi, i have also the exact same issue…

Exactly the same issue here…

Same issue for me

I opened up a new thread over here and filed a support ticket.

Support confirmed the behavior that I was seeing w/ artifacts: for an active branch this isn’t a great way to get artifacts because each new build appears to clear out the artifacts (it’s almost like the completed filter doesn’t work at all)

I posted a potential workaround w/ the v1 API in my thread. There may also be a way to retrieve this data w/ the graphql API or the v2 API (if you can figure out the best way to get a list of jobs) but I haven’t figured it out yet (love if someone else finds a better way)