gpt4 book ai didi

rest - Azure DevOps API - 如何发现字段和选项列表之间的链接

转载 作者:行者123 更新时间:2023-12-04 10:32:34 25 4
gpt4 key购买 nike

我正在尝试通过 AZDO REST Api 将 Azure DevOps 流程从一个组织复制到另一个组织。我正在复制布局并被卡住,因为在查询源 AZDO 实例时我无法发现自定义字段和选项列表之间的关系。

在我的场景中,我有一个测试工作项类型,我称之为问题。在问题界面上,我创建了一个自定义字段,它是一个选项列表。虽然我可以 retrieve a list of lists通过 Rest API 和 examine the field同样,我无法弄清楚两者之间的关系。

这是部分有效载荷 from the field :

{
"count": 39,
"value": [
...
{
"referenceName": "Custom.IssueSource",
"name": "Issue Source",
"type": "string",
"description": "Who is this attributed to",
"required": true,
"url": "https://dev.azure.com/MYORG/_apis/work/processes/f390103e-7097-4f19-b5b5-f9dbcf92bb6f/behaviors",
"customization": "custom"
},
... ]
}

这是来自 lists get query 的部分有效载荷我使用反复试验来确定是我分配的选项列表:
{
"count": 10,
"value": [
...
{
"id": "2998d4e4-2bec-4935-98a1-b67a0b0b6d5d",
"name": "picklist_e854661e-8620-4ad9-be28-b974c5cb3a5d",
"type": "String",
"isSuggested": false,
"url": "https://dev.azure.com/MYORG/_apis/work/processes/lists/2998d4e4-2bec-4935-98a1-b67a0b0b6d5d"
},
...
]
}

这是部分 layout response对于 WIT:
{
"pages": [
{
"id": "d0171d51-ff84-4038-afc1-8800ab613160.System.WorkItemType.Details",
"inherited": true,
"label": "Details",
"pageType": "custom",
"visible": true,
"isContribution": false,
"sections": [
{
"id": "Section1",
"groups": [
...
{
"id": "bf03e049-5062-4d82-b91d-4396541fbed2",
"label": "Custom",
"isContribution": false,
"visible": true,
"controls": [
{
"id": "Custom.IssueSource",
"label": "Issue Source",
"controlType": "FieldControl",
"readOnly": false,
"visible": true,
"isContribution": false
}
]
}
]
},
... ]
}

针对 AZDO Web 界面使用 fiddler,我唯一一次看到对选项列表的引用是从另一个非 AZDO API 到 https://dev.azure.com/MYORG/_apis/Contribution/dataProviders/query

有没有办法通过 AZDO Rest API 发现链接?我看到了 this question which was similar but was about creating the link

最佳答案

弄清楚了。原来你需要从不同的范围查询 - work item tracking而不是 work item tracking process :

https://dev.azure.com/MYORG/_apis/wit/fields/Custom.IssueSource?api-version=5.0-preview.2

返回
{
"name": "Issue Source",
"referenceName": "Custom.IssueSource",
"description": "Who is this attributed to",
"type": "string",
"usage": "workItem",
"readOnly": false,
"canSortBy": true,
"isQueryable": true,
...
"isIdentity": false,
--> "isPicklist": true,
"isPicklistSuggested": false,
--> "picklistId": "2998d4e4-2bec-4935-98a1-b67a0b0b6d5d",
"url": "https://dev.azure.com/MYORG/_apis/wit/fields/Custom.IssueSource"
}

关于rest - Azure DevOps API - 如何发现字段和选项列表之间的链接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60348765/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com