共用方式為


Agent queues

TFS 2017 | TFS 2015 | TFS 2013

Note

Looking for REST APIS that support TFS 2018 or later versions? See the Azure DevOps REST API Reference.

api-version = 3.0-preview.1

An Agent queue provides visibility to an agent pool from within a project.

If you haven't already, look at the information on getting started with these APIs.

Get a list of queues

GET https://{instance}/DefaultCollection/{project}/_apis/distributedtask/queues?api-version={version}[&queueName={string}][&actionFilter={string}]
Parameter Type Notes
URL
instance string TFS server name ({server:port}).
project string Project ID or name.
Query
api-version string Version of the API to use.
queueName string Filters queues whose names start with this prefix.
actionFilter enum { None, Manage, Use } Filter Queues based on the permission mentioned.

Sample request

GET https://mytfsserver/DefaultCollection/Fabrikam-Fiber-Git/_apis/distributedtask/queues?api-version=3.0-preview.1

Sample response

{
  "count": 2,
  "value": [
    {
      "id": 1,
      "projectId": "7b626022-ff88-4bba-9e1c-b444a5305d23",
      "name": "Default",
      "groupScopeId": "12692c9b-aa22-45df-8622-21d6c7126de4",
      "pool": {
        "id": 1,
        "scope": "175d1091-ab63-44a7-a6b5-122709ade15d",
        "name": "Default"
      }
    },
    {
      "id": 4,
      "projectId": "7b626022-ff88-4bba-9e1c-b444a5305d23",
      "name": "myNewQueue",
      "groupScopeId": "07079879-f7ee-49d5-8c03-17a75c2ea000",
      "pool": {
        "id": 1,
        "scope": "175d1091-ab63-44a7-a6b5-122709ade15d",
        "name": "Default"
      }
    }
  ]
}

Get a queue

GET https://{instance}/DefaultCollection/{project}/_apis/distributedtask/queues/{queueId}?api-version={version}
Parameter Type Notes
URL
instance string TFS server name ({server:port}).
project string Project ID or name.
queueId int The queue id.
Query
api-version string Version of the API to use.
actionFilter enum { None, Manage, Use } Filter Queues based on the permission mentioned.

Sample request

GET https://mytfsserver/DefaultCollection/Fabrikam-Fiber-Git/_apis/distributedtask/queues/4?api-version=3.0-preview.1

Sample response

{
  "id": 4,
  "projectId": "7b626022-ff88-4bba-9e1c-b444a5305d23",
  "name": "myNewQueue",
  "groupScopeId": "07079879-f7ee-49d5-8c03-17a75c2ea000",
  "pool": {
    "id": 1,
    "scope": "175d1091-ab63-44a7-a6b5-122709ade15d",
    "name": "Default"
  }
}

Create a queue

POST https://{instance}/DefaultCollection/{project}/_apis/distributedTask/queues?api-version={version}
Parameter Type Notes
URL
instance string TFS server name ({server:port}).
project string Project ID or name.
Query
api-version string Version of the API to use.

Sample request

POST https://mytfsserver/DefaultCollection/Fabrikam-Fiber-Git/_apis/distributedtask/queues?api-version=3.0-preview.1
{
  "name": "myNewQueue",
  "pool": {
    "id": 1
  }
}

Sample response

{
  "id": 4,
  "projectId": "7b626022-ff88-4bba-9e1c-b444a5305d23",
  "name": "myNewQueue",
  "groupScopeId": "07079879-f7ee-49d5-8c03-17a75c2ea000",
  "pool": {
    "id": 1
  }
}

Delete a queue

DELETE https://{instance}/DefaultCollection/{project}/_apis/distributedtask/queues/{queueId}?api-version={version}
Parameter Type Notes
URL
instance string TFS server name ({server:port}).
project string Project ID or name.
queueId int The queue id.
Query
api-version string Version of the API to use.

Sample request

DELETE https://mytfsserver/DefaultCollection/Fabrikam-Fiber-Git/_apis/distributedtask/queues/4?api-version=3.0-preview.1
4