0
votes

Referring to https://docs.microsoft.com/en-us/rest/api/azure/devops/graph/groups/get?view=azure-devops-rest-6.0 that tells that 'The group will be returned even if it has been deleted from the account or has had all its memberships deleted.' - it is interesting how can I exclude deleted users/groups and get only 'clean' and actual response from Azure DevOps REST API, without deleted objects?

It looks that documentation above does not include filters to do that. At the same time, data that is returned (sample is given in documentation) does not contain any flags that would allow to do any filtering on client side.

Trying to search the internet did not bring any success so far.

Is it possible somehow to exclude deleted objects from Azure DevOps REST API response? Thanks in advance.

2

2 Answers

1
votes

The API you referred is getting a group by its descriptor. The descriptor is the primary way to reference the graph subject while the system is running. This field will uniquely identify the same graph subject across both Accounts and Organizations.

If the group is deleted, you'll see "isDeleted" argument is set to Ture. Check the screenshot below:

enter image description here

If you want to list all groups, you could use Groups - List api, this api won't return the deleted group.

0
votes

@Cence Dong shed the light in his answer, but since I cannot attach images to comments - I post answer here.

isDeleted - property appears dynamically in each response in case the object was deleted. Cance Dong showed example for getting group request using descriptor and mentioned that it won't happen if you get Groups List. However, my observation is (screenshot attached) that the same happens for List as well.

Conclusion - isDeleted property appears in all type of group requests if object was deleted.

enter image description here