API: filter builds by queue / agents keys

The “list builds” API supports several optional query string parameters. However it doesn’t provide an option to filter by queue (or, indeed, any other “agents” keys). Would it be possible to add support for that?

Hey @simonbyrne

Thanks for the message.

As seen here, the REST API does not have the optional attribute for Agent search, and filtering the agent queue/tag is not possible using the REST API. I recommend using the GRAPHQL API as it can do more complex queries such as this.

A quick look at the Job API, will show the filters we have.

For your use case, you can so filter by the agentQueryRules as seen below

query GetJobByAgentQueryRules {
  build(slug:"org-slug/pipeline-slug/build-number") {
    jobs(first: 100, state:FINISHED, agentQueryRules: "queue=default") {
      edges {
        node {
          ... on JobTypeCommand {
            label
            url
          }
        }
      }
    }
  }
}

Cheers!

1 Like

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