Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get all organizations via REST API for Azure DevOps

Is it possible to get a list of all the organizations a user is allocated to, via the Azure DevOps REST API's?

From what I can see, the REST API's are organization specific.

like image 877
JadedEric Avatar asked Oct 17 '22 09:10

JadedEric


1 Answers

You can get the list of organization using Azure DevOps REST APIs

First get the profile of logged in user https://learn.microsoft.com/en-us/rest/api/azure/devops/profile/profiles/get?view=azure-devops-rest-6.0 if you are using OAuth authentication, use

API GET https://app.vssps.visualstudio.com/_apis/profile/profiles/me?api-version=6.0

Response { "displayName": "User Name", "publicAlias": "67861230-823749-915c-887ed4ccf1f1", "emailAddress": "[email protected]", "coreRevision": 7678234, "timeStamp": "2018-12-15T02:06:10.2750402+00:00", "id": "67861230-823749-915c-887ed4ccf1f1", "revision": 7678234 }

Use publicAlias to get the list of organization https://learn.microsoft.com/en-us/rest/api/azure/devops/account/accounts/list?view=azure-devops-rest-6.0

API https://app.vssps.visualstudio.com/_apis/accounts?memberId={publicAlias}&api-version=6.0

like image 193
Akshay H Avatar answered Oct 21 '22 00:10

Akshay H