TejasGondalia
TejasGondalia

Reputation: 168

Getting user/users details based on user name/alias as parameter in azure devops

I've a tool(web application) which creates work-items in azure devops. (skipping the unnecessary details), just like how we assign any user a particular work-item from the Assigned To dropdown in azure devops, I too have a dropdown which when user enters any name/alias, a list of users starts showing based on the input. The api which I was using in the backend was https://abcorganization.vsaex.visualstudio.com/_apis/UserEntitlements?top=10&filter=name+eq+%27Tejas

Here filter=name+eq+%27Tejas in the query parameter helps to query the api and used to give set of users whose name starts with Tejas. It can be email alias too. But for some reason, that doesn't work anymore. My guess, they've deprecated that API version

So in my search to find the alternative/answer, I came across the following documentation: (https://learn.microsoft.com/en-us/rest/api/azure/devops/graph/users/get?view=azure-devops-rest-5.1) in which the API given is: https://vssps.dev.azure.com/abcorganization/_apis/graph/users/{userDescriptor}?api-version=5.1-preview.1

Here the userDescriptor is some sort of unique key of AAD related to a particular user. (which I certainly can't use to fulfill my purpose).

The other thing which I've tried is the below query parameters but it still didn't worked out https://vssps.dev.azure.com/abcorganization/_apis/graph/users?subjectTypes={subjectTypes}&continuationToken={continuationToken}&api-version=5.1-preview.1

So is there anyway/api which can fullfil my purpose or is it that I'm using this new API in a wrong way or something? Any help would be much appreciated

Upvotes: 2

Views: 4005

Answers (2)

rkkreddy
rkkreddy

Reputation: 735

Use this. I tested it and worked for me: https://vsaex.dev.azure.com/{organization}/_apis/userentitlements?$filter=name+eq+%27{name}%27&api-version=6.0-preview.3

Replace {organization} and {name} as needed

Upvotes: 1

Martin Řezník
Martin Řezník

Reputation: 11

I believe it should be $filter in the query. You are also missing the closing quote.

(See docs for more details)

https://abcorganization.vsaex.visualstudio.com/_apis/UserEntitlements?top=10&$filter=name+eq+'Tejas'

Upvotes: 1

Related Questions