Memberships - List

Get all the memberships where this descriptor is a member in the relationship.

The default value for direction is 'up' meaning return all memberships where the subject is a member (e.g. all groups the subject is a member of). Alternatively, passing the direction as 'down' will return all memberships where the subject is a container (e.g. all members of the subject group).

GET https://vssps.dev.azure.com/{organization}/_apis/graph/Memberships/{subjectDescriptor}?api-version=5.0-preview.1
GET https://vssps.dev.azure.com/{organization}/_apis/graph/Memberships/{subjectDescriptor}?direction={direction}&depth={depth}&api-version=5.0-preview.1

URI Parameters

Name In Required Type Description
organization
path True

string

The name of the Azure DevOps organization.

subjectDescriptor
path True

string

Fetch all direct memberships of this descriptor.

api-version
query True

string

Version of the API to use. This should be set to '5.0-preview.1' to use this version of the api.

depth
query

integer

int32

The maximum number of edges to traverse up or down the membership tree. Currently the only supported value is '1'.

direction
query

GraphTraversalDirection

Defaults to Up.

Responses

Name Type Description
200 OK

GraphMembership[]

successful operation

Security

oauth2

Type: oauth2
Flow: accessCode
Authorization URL: https://app.vssps.visualstudio.com/oauth2/authorize&response_type=Assertion
Token URL: https://app.vssps.visualstudio.com/oauth2/token?client_assertion_type=urn:ietf:params:oauth:client-assertion-type:jwt-bearer&grant_type=urn:ietf:params:oauth:grant-type:jwt-bearer

Scopes

Name Description
vso.graph Grants the ability to read user, group, scope and group membership information

Examples

All groups for a group
All groups for a user
All members of a group

All groups for a group

Sample Request

GET https://vssps.dev.azure.com/fabrikam/_apis/graph/Memberships/{subjectDescriptor}?api-version=5.0-preview.1

Sample Response

{
  "count": 2,
  "value": [
    {
      "containerDescriptor": "TWljcm9zb2Z0LlRlYW1Gb3VuZGF0aW9uLklkZW50aXR5O1MtMS05LTE1NTEzNzQyNDUtNDI4NzE1MDg5LTI0ODk3NTM0MTMtMjc5MTIyNzA3NS0yNDUyNDc1MzktMS0xMzQwMjAwMjExLTcxMDc4MDQ5My0yMjcxMTQ2Njk2LTE5NTEzNjAxNDc",
      "memberDescriptor": "TWljcm9zb2Z0LlRlYW1Gb3VuZGF0aW9uLklkZW50aXR5O1MtMS05LTE1NTEzNzQyNDUtNDI4NzE1MDg5LTI0ODk3NTM0MTMtMjc5MTIyNzA3NS0yNDUyNDc1MzktMS0zNzExMDMzOTI5LTMyMDM5ODY3NjItMzA0NzMyMzAwOS0zNzQ1OTQ0MTQy"
    },
    {
      "containerDescriptor": "TWljcm9zb2Z0LlRlYW1Gb3VuZGF0aW9uLklkZW50aXR5O1MtMS05LTE1NTEzNzQyNDUtNDI4NzE1MDg5LTI0ODk3NTM0MTMtMjc5MTIyNzA3NS0yNDUyNDc1MzktMC0wLTAtMC0z",
      "memberDescriptor": "TWljcm9zb2Z0LlRlYW1Gb3VuZGF0aW9uLklkZW50aXR5O1MtMS05LTE1NTEzNzQyNDUtNDI4NzE1MDg5LTI0ODk3NTM0MTMtMjc5MTIyNzA3NS0yNDUyNDc1MzktMS0zNzExMDMzOTI5LTMyMDM5ODY3NjItMzA0NzMyMzAwOS0zNzQ1OTQ0MTQy"
    }
  ]
}

All groups for a user

Sample Request

GET https://vssps.dev.azure.com/fabrikam/_apis/graph/Memberships/{subjectDescriptor}?api-version=5.0-preview.1

Sample Response

{
  "count": 1,
  "value": [
    {
      "containerDescriptor": "TWljcm9zb2Z0LlRlYW1Gb3VuZGF0aW9uLklkZW50aXR5O1MtMS05LTE1NTEzNzQyNDUtNDI4NzE1MDg5LTI0ODk3NTM0MTMtMjc5MTIyNzA3NS0yNDUyNDc1MzktMS00MjcxMTAxODY2LTM1OTc5OTg5MTQtMjUxNDgwMzY2Mi04Njk2MTUyNTY",
      "memberDescriptor": "TWljcm9zb2Z0LklkZW50aXR5TW9kZWwuQ2xhaW1zLkNsYWltc0lkZW50aXR5OzQ1YWEzZDJkLTc0NDItNDczZC1iNGQzLTNjNjcwZGE5ZGQ5NlxqdHNlbmdAdnNjc2kudXM"
    }
  ]
}

All members of a group

Sample Request

GET https://vssps.dev.azure.com/fabrikam/_apis/graph/Memberships/{subjectDescriptor}?direction=Down&api-version=5.0-preview.1

Sample Response

{
  "count": 1,
  "value": [
    {
      "containerDescriptor": "TWljcm9zb2Z0LlRlYW1Gb3VuZGF0aW9uLklkZW50aXR5O1MtMS05LTE1NTEzNzQyNDUtNDI4NzE1MDg5LTI0ODk3NTM0MTMtMjc5MTIyNzA3NS0yNDUyNDc1MzktMS00MjcxMTAxODY2LTM1OTc5OTg5MTQtMjUxNDgwMzY2Mi04Njk2MTUyNTY",
      "memberDescriptor": "TWljcm9zb2Z0LklkZW50aXR5TW9kZWwuQ2xhaW1zLkNsYWltc0lkZW50aXR5OzQ1YWEzZDJkLTc0NDItNDczZC1iNGQzLTNjNjcwZGE5ZGQ5NlxqdHNlbmdAdnNjc2kudXM"
    }
  ]
}

Definitions

Name Description
GraphMembership

Relationship between a container and a member

GraphTraversalDirection

Defaults to Up.

ReferenceLinks

The class to represent a collection of REST reference links.

GraphMembership

Relationship between a container and a member

Name Type Description
_links

ReferenceLinks

This field contains zero or more interesting links about the graph membership. These links may be invoked to obtain additional relationships or more detailed information about this graph membership.

containerDescriptor

string

memberDescriptor

string

GraphTraversalDirection

Defaults to Up.

Name Type Description
down

string

unknown

string

up

string

The class to represent a collection of REST reference links.

Name Type Description
links

object

The readonly view of the links. Because Reference links are readonly, we only want to expose them as read only.