how can I display the ADO agents using the ADO API, but so as to filter out the agents that in System Capabilities have e.g. key=value
i tried:
https://dev.azure.com/org/_apis/distributedtask/pools/111/agents/?key=valueA&api-version=5.1
It shows me all agents in pool 111
You can try to use demands: https://learn.microsoft.com/en-us/azure/devops/pipelines/process/demands?view=azure-devops&tabs=yaml#manually-entered-demands
pool: name: MyPool demands: - myCustomCapability # exists check for myCustomCapability - Agent.Version -equals 2.144.0 # equals check for Agent.Version 2.144.0
as a template:
https://dev.azure.com/{org}/_apis/distributedtask/pools/{poolId}/agents?includeCapabilities=true&demands=your_capability -equals value
as an example:
https://dev.azure.com/{org}/_apis/distributedtask/pools/{poolId}/agents?includeCapabilities=true&demands=Agent.Version%20-equals%202.213.2
The existence of the demand URI query parameter is documented here.