0
votes

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://docs.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 ???

2
Does my answer work for you? Do you need any additional help?Tomasz Kaniewski
Any update for this issue? Have you resolved this issue? If not, would you please let me know the latest information about this issue? If yes, you you could Accept it as an Answer , so it could help other community members who get the same issues and we could archive this thread, thanks.Leo Liu-MSFT

2 Answers

1
votes

Use Subject Query from Azure DevOps API Graph

Ref: https://docs.microsoft.com/en-us/rest/api/azure/devops/graph/subject%20query/query?view=azure-devops-rest-6.0

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)
0
votes

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.

enter image description here

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:

enter image description here

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:

enter image description here

Now, we could get the project avtar:

enter image description here