如何通过REST API获取Azure DevOps组织的所有者? [英] How do I get the owner of an Azure DevOps organization via the REST API?
问题描述
I have been searching the Azure DevOps API documentation to find out how to get the owner of an organization via the API. I have been able to get a list of groups and a list of users, among other things, but not the organization. So far, I am using SoapUI to test my calls. Later, I'll build a C# project.
相关信息:
- 我找到了有关如何>更改项目所有者,但不更改组织所有者.
- 我还可以在帐户下获取所有组织,但这不显示组织所有者.
- I found a post on how to get and change the project owner but not the organization owner.
- I can also get all organizations under an account, but this does not show the organization owner.
推荐答案
在DevOps门户的帮助下,我得以找到REST API.使用管理员凭证导航到dev.azure.com.如果您导航到概述并保持网络流量为打开状态,则可以看到该请求,
I was managed to find the REST API with the help of the DevOps portal. Navigate to dev.azure.com with the administrator credentials. If you navigate to overview and keep the network traffic opened, You can see the request ,
https://dev.azure.com/{yourOrganization}/_apis/Contribution/HierarchyQuery
给出的响应为
{
"dataProviderSharedData": {},
"dataProviders": {
"ms.vss-web.component-data": {},
"ms.vss-web.shared-data": null,
"ms.vss-admin-web.organization-admin-overview-data-provider": {
"id": "cf9a37c1-7c97-4018-8530-962f45b30999",
"name": "ngColombo",
"timeZone": {
"displayName": "UTC",
"id": "UTC"
},
"url": "https://dev.azure.com/ngColombo/",
"description": "",
"privacyUrl": "",
"region": "East Asia",
"hasModifyPermissions": true
}
}
}
您会看到ms.vss-admin-web.organization-admin-overview-data-provider
,它将赋予组织的所有者.
you can see ms.vss-admin-web.organization-admin-overview-data-provider
which will give the owner of the organization.
示例代码:
getOrganisations () {
const body = {
'contributionIds': ['ms.vss-features.my-organizations-data-provider'],
'dataProviderContext': {
'properties': {}
}
}
const url = 'https://dev.azure.com/Aevitae/_apis/Contribution/HierarchyQuery?api-version=5.0-preview.1'
return axios.post(url, body, this.options)
}
这篇关于如何通过REST API获取Azure DevOps组织的所有者?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!