Query multiple artifacts in a plan

yogev ch
Contributor
December 24, 2024

I'm looking at the `Bamboo` api from here.
I want to get all artifacts under a plan.
I've tried to use all:

- /api/latest/result/{projectKey}-{buildKey}-{buildNumber}

- /api/latest/result/{projectKey}-{buildKey}

/api/latest/plan/{projectKey}-{buildKey}/artifact

All with parameters such as `max-result=100` and `expand`.

Nothing gives me more than 1 artifact due to `"max-result": 1` inside the `"artifacts"`.

```

"artifacts": {

  "size": 1,

  "start-index": 0,

  "max-result": 1,

```

1 answer

1 accepted

1 vote
Answer accepted
Venkata Sateesh Pentela
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
December 24, 2024

Hello Yogev,

Welcome to Atlassian community

Have you tried using the below end point along with query parameter "expand=artifacts"? 

{bamboo-base-url}/rest/api/latest/result/{projectKey}-{buildKey}/{buildNumber}?expand=artifacts

It can be a case that the plan is having only 1 artifact. Have you checked the artifact published in the Bamboo UI?

Regards,

Venkata Sateesh Pentela

Atlassian Support APAC

--please don't forget to Accept the answer if the reply is helpful-- 

yogev ch
Contributor
December 25, 2024

Hi,
Yes.
As I wrote in the question, I did try to use "expand=artifacts".
For some API it doesn't "expand=artifacts" but "expand=results.result.artifacts".

Actually specifically for '/api/latest/result/{projectKey}-{buildKey}'.

It still does not expand the artifact results.

I am sure there is more than 1 artifact.

The problem is that the "artifacts" part contains that "max-result: 1".
I don't understand if it is possible to change it.

 

Venkata Sateesh Pentela
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
December 25, 2024

Hi Yogev,

If you are using the end point "/api/latest/result/{projectKey}-{buildKey}, then you need to pass the query parameter expand=results.result.artifacts

If you are using the end point /api/latest/result/{projectKey}-{buildKey}/{buildNumber}, then you can pass the query parameter expand=artifacts.

Depending on whether you need to retrieve the results of a specific build or all build results, you can choose the endpoint.

If the API returns max-result: 1 and you are able to see more artifacts in the UI, then it indicates that only one artifact is shared, and the other artifacts are not shared.

Regards,
Venkata Sateesh Pentela
Atlassian Support APAC

--please don't forget to Accept the answer if the reply is helpful-- 

Like Steffen Opel _Utoolity_ likes this
yogev ch
Contributor
December 26, 2024

Can I get only shared artifacts?
Is there a way to query non shared artifacts?

This is the artifacts part from the response:

"artifacts": {
"size": 1,
"start-index": 0,
"max-result": 1,
"artifact": [
{
"name": "my-artifact",
"link": {
"href": "http://192.168.1.1:8085/browse/AAA-BB-2050/artifact/shared/my-artifact/my-artifact",
"rel": "self"
},
"producerJobKey": "AAA-BB-CC-2050",
"shared": true,
"size": 1314,
"prettySizeDescription": "1 KB",
"id": 48857171
}
]
},

I do see it says "shared": true for this artifact.
But, because it has this property, I would expect also to see "shared": false artifacts.

Venkata Sateesh Pentela
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
December 26, 2024

Hi Yogev,

At the moment, if you pass {projectKey}-{buildKey}-{buildNumber} to the end point, it will give only shared artifacts. 

If you want non-shared artifacts, then you can pass {projectKey}-{buildKey}-{jobName}-{buildNumber} to the Get api latest result Rest API.

I've also raised a feature request BAM-25984: Bamboo Rest API to retrieve all the artifacts (shared and non-shared) to support the same. Please be sure to watch it, and vote on it, so that you're notified if this is implemented in a future release. You can also add a comment to the feature request to explain your specific use-case to the developers. I

Regards,
Venkata Sateesh Pentela
Atlassian Support APAC

--please don't forget to Accept the answer if the reply is helpful-- 

Like # people like this
yogev ch
Contributor
December 30, 2024

Thank you very much!
Actually I didn't see it in the api page.

/api/latest/result/{projectKey}-{buildKey}-{buildNumber}

has no option for a job name {jobName}.

But, it works!

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events