Templates - List

获取模板

GET https://dev.azure.com/{organization}/{project}/{team}/_apis/wit/templates?api-version=7.1-preview.1
GET https://dev.azure.com/{organization}/{project}/{team}/_apis/wit/templates?workitemtypename={workitemtypename}&api-version=7.1-preview.1

URI 参数

名称 必需 类型 说明
organization
path True

string

Azure DevOps 组织的名称。

project
path True

string

项目 ID 或项目名称

team
path True

string

团队 ID 或团队名称

api-version
query True

string

要使用的 API 版本。 这应设置为“7.1-preview.1”才能使用此版本的 API。

workitemtypename
query

string

可选,指定时返回给定工作项类型的模板。

响应

名称 类型 说明
200 OK

WorkItemTemplateReference[]

成功的操作

安全性

oauth2

Type: oauth2
Flow: accessCode
Authorization URL: https://app.vssps.visualstudio.com/oauth2/authorize&response_type=Assertion
Token URL: https://app.vssps.visualstudio.com/oauth2/token?client_assertion_type=urn:ietf:params:oauth:client-assertion-type:jwt-bearer&grant_type=urn:ietf:params:oauth:grant-type:jwt-bearer

Scopes

名称 说明
vso.work 授予读取工作项、查询、版块、区域和迭代路径以及其他工作项跟踪相关元数据的能力。 此外,还授予执行查询、搜索工作项以及通过服务挂钩接收有关工作项事件的通知的能力。

示例

Gets templates

Sample Request

GET https://dev.azure.com/{organization}/{project}/{team}/_apis/wit/templates?api-version=7.1-preview.1

Sample Response

{
  "count": 9,
  "value": [
    {
      "id": "5dbed2c3-1534-4894-aff4-0234fa3ae56d",
      "name": "Test Template",
      "description": "",
      "workItemTypeName": "Feature",
      "_links": {
        "workItemType": {
          "href": "https://dev.azure.com/fabrikamm0652/00487116-45c8-4be1-a19b-ae0de259e618/_apis/wit/workItemTypes/Feature"
        },
        "self": {
          "href": "https://dev.azure.com/fabrikamm0652/Test%20Project/3481fbc6-b38e-4a68-ae98-53720872d5db/_apis/wit/templates/5dbed2c3-1534-4894-aff4-0234fa3ae56d"
        }
      },
      "url": "https://dev.azure.com/fabrikamm0652/Test%20Project/3481fbc6-b38e-4a68-ae98-53720872d5db/_apis/wit/templates/5dbed2c3-1534-4894-aff4-0234fa3ae56d"
    },
    {
      "id": "2564ee23-9824-4cde-a42d-3036adaf50e7",
      "name": "Test Template",
      "description": "",
      "workItemTypeName": "Feature",
      "_links": {
        "workItemType": {
          "href": "https://dev.azure.com/fabrikamm0652/00487116-45c8-4be1-a19b-ae0de259e618/_apis/wit/workItemTypes/Feature"
        },
        "self": {
          "href": "https://dev.azure.com/fabrikamm0652/Test%20Project/3481fbc6-b38e-4a68-ae98-53720872d5db/_apis/wit/templates/2564ee23-9824-4cde-a42d-3036adaf50e7"
        }
      },
      "url": "https://dev.azure.com/fabrikamm0652/Test%20Project/3481fbc6-b38e-4a68-ae98-53720872d5db/_apis/wit/templates/2564ee23-9824-4cde-a42d-3036adaf50e7"
    },
    {
      "id": "05132b3a-41d6-430f-8738-42b20b34a601",
      "name": "Test Template",
      "description": "Template to be created",
      "workItemTypeName": "Feature",
      "_links": {
        "workItemType": {
          "href": "https://dev.azure.com/fabrikamm0652/00487116-45c8-4be1-a19b-ae0de259e618/_apis/wit/workItemTypes/Feature"
        },
        "self": {
          "href": "https://dev.azure.com/fabrikamm0652/Test%20Project/3481fbc6-b38e-4a68-ae98-53720872d5db/_apis/wit/templates/05132b3a-41d6-430f-8738-42b20b34a601"
        }
      },
      "url": "https://dev.azure.com/fabrikamm0652/Test%20Project/3481fbc6-b38e-4a68-ae98-53720872d5db/_apis/wit/templates/05132b3a-41d6-430f-8738-42b20b34a601"
    },
    {
      "id": "40ca92a6-0e32-4b44-8e57-664127faa0be",
      "name": "Test Template",
      "description": "",
      "workItemTypeName": "Feature",
      "_links": {
        "workItemType": {
          "href": "https://dev.azure.com/fabrikamm0652/00487116-45c8-4be1-a19b-ae0de259e618/_apis/wit/workItemTypes/Feature"
        },
        "self": {
          "href": "https://dev.azure.com/fabrikamm0652/Test%20Project/3481fbc6-b38e-4a68-ae98-53720872d5db/_apis/wit/templates/40ca92a6-0e32-4b44-8e57-664127faa0be"
        }
      },
      "url": "https://dev.azure.com/fabrikamm0652/Test%20Project/3481fbc6-b38e-4a68-ae98-53720872d5db/_apis/wit/templates/40ca92a6-0e32-4b44-8e57-664127faa0be"
    },
    {
      "id": "9363ac38-9e16-44b2-8a76-76480f366e2f",
      "name": "Test Template",
      "description": "Template to be created",
      "workItemTypeName": "Feature",
      "_links": {
        "workItemType": {
          "href": "https://dev.azure.com/fabrikamm0652/00487116-45c8-4be1-a19b-ae0de259e618/_apis/wit/workItemTypes/Feature"
        },
        "self": {
          "href": "https://dev.azure.com/fabrikamm0652/Test%20Project/3481fbc6-b38e-4a68-ae98-53720872d5db/_apis/wit/templates/9363ac38-9e16-44b2-8a76-76480f366e2f"
        }
      },
      "url": "https://dev.azure.com/fabrikamm0652/Test%20Project/3481fbc6-b38e-4a68-ae98-53720872d5db/_apis/wit/templates/9363ac38-9e16-44b2-8a76-76480f366e2f"
    },
    {
      "id": "2e703f7c-b028-4bf3-883d-7e641758a1f2",
      "name": "Test Template",
      "description": "",
      "workItemTypeName": "Feature",
      "_links": {
        "workItemType": {
          "href": "https://dev.azure.com/fabrikamm0652/00487116-45c8-4be1-a19b-ae0de259e618/_apis/wit/workItemTypes/Feature"
        },
        "self": {
          "href": "https://dev.azure.com/fabrikamm0652/Test%20Project/3481fbc6-b38e-4a68-ae98-53720872d5db/_apis/wit/templates/2e703f7c-b028-4bf3-883d-7e641758a1f2"
        }
      },
      "url": "https://dev.azure.com/fabrikamm0652/Test%20Project/3481fbc6-b38e-4a68-ae98-53720872d5db/_apis/wit/templates/2e703f7c-b028-4bf3-883d-7e641758a1f2"
    },
    {
      "id": "72608fee-226d-4c34-821a-82edeef99dbf",
      "name": "Test Template",
      "description": "",
      "workItemTypeName": "Feature",
      "_links": {
        "workItemType": {
          "href": "https://dev.azure.com/fabrikamm0652/00487116-45c8-4be1-a19b-ae0de259e618/_apis/wit/workItemTypes/Feature"
        },
        "self": {
          "href": "https://dev.azure.com/fabrikamm0652/Test%20Project/3481fbc6-b38e-4a68-ae98-53720872d5db/_apis/wit/templates/72608fee-226d-4c34-821a-82edeef99dbf"
        }
      },
      "url": "https://dev.azure.com/fabrikamm0652/Test%20Project/3481fbc6-b38e-4a68-ae98-53720872d5db/_apis/wit/templates/72608fee-226d-4c34-821a-82edeef99dbf"
    },
    {
      "id": "88c9ab05-74cc-45ff-a39d-a4400ff70796",
      "name": "Test Template",
      "description": "",
      "workItemTypeName": "Feature",
      "_links": {
        "workItemType": {
          "href": "https://dev.azure.com/fabrikamm0652/00487116-45c8-4be1-a19b-ae0de259e618/_apis/wit/workItemTypes/Feature"
        },
        "self": {
          "href": "https://dev.azure.com/fabrikamm0652/Test%20Project/3481fbc6-b38e-4a68-ae98-53720872d5db/_apis/wit/templates/88c9ab05-74cc-45ff-a39d-a4400ff70796"
        }
      },
      "url": "https://dev.azure.com/fabrikamm0652/Test%20Project/3481fbc6-b38e-4a68-ae98-53720872d5db/_apis/wit/templates/88c9ab05-74cc-45ff-a39d-a4400ff70796"
    },
    {
      "id": "d1e32bd5-98f6-4ad6-b035-e131aa1b4cdb",
      "name": "Test Template",
      "description": "",
      "workItemTypeName": "Feature",
      "_links": {
        "workItemType": {
          "href": "https://dev.azure.com/fabrikamm0652/00487116-45c8-4be1-a19b-ae0de259e618/_apis/wit/workItemTypes/Feature"
        },
        "self": {
          "href": "https://dev.azure.com/fabrikamm0652/Test%20Project/3481fbc6-b38e-4a68-ae98-53720872d5db/_apis/wit/templates/d1e32bd5-98f6-4ad6-b035-e131aa1b4cdb"
        }
      },
      "url": "https://dev.azure.com/fabrikamm0652/Test%20Project/3481fbc6-b38e-4a68-ae98-53720872d5db/_apis/wit/templates/d1e32bd5-98f6-4ad6-b035-e131aa1b4cdb"
    }
  ]
}

定义

名称 说明
ReferenceLinks

表示 REST 引用链接集合的类。

WorkItemTemplateReference

描述对工作项模板的浅表引用。

表示 REST 引用链接集合的类。

名称 类型 说明
links

object

链接的只读视图。 由于引用链接是只读的,因此我们只想将其公开为只读。

WorkItemTemplateReference

描述对工作项模板的浅表引用。

名称 类型 说明
_links

ReferenceLinks

链接对相关 REST 资源的引用。

description

string

工作项模板的说明。

id

string

工作项模板的标识符。

name

string

工作项模板的名称。

url

string

workItemTypeName

string

工作项类型的名称。