Reputation: 71
I have tried to get team details using DevOps API, And I can get it but unable to get team Avtar/image, In response there is only text information, no descriptor available
I am using this way to get it.. https://learn.microsoft.com/en-us/rest/api/azure/devops/core/teams/get?view=azure-devops-rest-6.0
Can you please guide me how can I get team Avtar/image ???
Upvotes: 0
Views: 817
Reputation: 76660
How to get team avtar from DevOps api
In the security of Azure Devops, subjectDescriptor
is user's SID
. It used as identification when operating some security control. This parameter can uniquely identify the same graph subject across both Accounts and Organizations.
To get it, just use the following API:
GET https://vssps.dev.azure.com/{org name}/_apis/graph/users?api-version=5.1-preview.1
From its response body, you can get the descriptor
value of corresponding user.
Next, you can pass the corresponding descriptor
value as subjectDescriptor
into REST API Avatars - Get:
GET https://vssps.dev.azure.com/{organization}/_apis/graph/Subjects/{subjectDescriptor}/avatars?api-version=6.0-preview.1
In addition, the return result of above REST API is content of the image, in order to get the image of the avatar, we need provide the parameter format=png
:
Update:
this api for user avtar... i want to get project avtar
To get the project avtar, we need to get the subjectDescriptor
of the project. We could use the REST API:
https://dev.azure.com/{organization}/_apis/graph/descriptors/{Teams Id}?api-version=5.0-preview.1
To get the Teams Id
, we could use the Teams - Get All Teams:
GET https://dev.azure.com/{organization}/_apis/teams?api-version=5.1-preview.1
Then get the Id of the descriptor for the teams project:
Now, we could get the project avtar:
Upvotes: 2
Reputation: 1175
Use Subject Query from Azure DevOps API Graph
Define the body like this:
{
"query": "Your Group Name",
"subjectKind": [ "Group" ]
}
The descriptor is at the end of each item in a result.
Then use it in belov request to get avatar
https://dev.azure.com/(Organization)/_apis/GraphProfile/MemberAvatars/(descriptor)
Upvotes: 1