list member memberships
API Support | Available since | Last updated | Output |
---|---|---|---|
5.0100 | 6.0000 | xml, json |
Description
This service returns the list of group memberships for a given member.
Only memberships with the status “normal” or “invited” are included.
Parameters
Name | Description | Required | Type | Default |
---|---|---|---|---|
archived | Whether to return archived projects/groups only | no | boolean | false |
extendedmember | Whether to return extended information for member (administrators or self only) | no | boolean | false |
inherited | Whether to return inherited memberships (guest project memberships inherited from child group membership) | no | boolean | false |
subgroups | Whether to return memberships from subgroups | no | boolean | true |
archived
By default, this service only returns memberships to groups and projects which are not archived.
Use archived=true
to only list the memberships to archived groups and projects.
extendedmember
When set to true
, the member includes the attributes from the extended format such as created
, activated
, lastlogin
and admin
.
Only the member themselves or an administrator can use this parameter. The parameter is ignored otherwise.
inherited
When a user is a member of a group, they automatically have guest access to the parent project and ancestor projects. However, unless they are added to the parent projects they are not considered members of those projects.
For example, a membership to australia-nsw-sydney
provides guest project membership to both australia
and australia-nsw
parent projects.
Set the inherited
parameter to true
to include the guest project memberships inherited from child group membership.
Inherited memberships do not have the created
, email-listed
, notification
or id
attributes:
<membership status="normal" role="guest" inherited="true">
subgroups
The subgroups
parameter controls whether to include groups that the member has access to because they are a member of one of their subgroups.
By default, this parameter is true
so these groups are included. Set this parameter to false
, if you do not want to include these groups.
Unless inherited=true
, setting subgroups=false
returns only the groups and projects that the user is directly a member of.
Combining parameters
Assuming a user was a member of group sample-a
and sample-b
. Group sample-a
is archived and is now archive-sample-a
and sample-b
is a subgroup of sample-c
.
archived | inherited | subgroups | Memberships returned |
---|---|---|---|
false | false | true | sample-b , sample-c (default) |
false | false | false | sample-b |
false | true | true | sample-b , sample-c , sample |
false | true | false | sample-b , sample |
true | false | true | archive-sample-a |
true | false | false | archive-sample-a |
true | true | true | archive-sample-a , archive-sample , archive |
true | true | false | archive-sample-a , archive-sample , archive |
Permission
Only the member herself or an administrator can invoke this service.
Response
The response includes the <member>
and the <membership>
elements sorted alphabetically based on the name of the group.
<memberships> <member id="[member id]" firstname="[first name]" surname="[surname]" username="[username]" status="[activated|unactivated|set-password]"> <fullname>[full name]</fullname> </member> <membership [id="[membership id]"] email-listed="[true|false]" notification="[notification]" status="normal" role="[role]" [subgroups="[subgroups]"] [created="[date]"]> <group|project id="[group id]" name="[group name]" description="[description]" owner="[owner]" [relatedurl="[url]"] /> <details> <field position="1" name="[field name]" editable="[true|false]" [title="[field title]"] [type="[field type]"]> [field value] </field> ... </details> </membership> <membership status="invited" ...> ... </membership> ... </memberships>
Example
In this example, user Joan Smith belongs to groups acme-asia
and acme-australia
:
<memberships> <member id="123" firstname="Joan" surname="Smith" username="jsmith" status="activated"> <fullname>Joan Smith</fullname> </member> <membership id="1234" email-listed="true" notification="immediate" status="normal" role="manager"> <group id="4" name="acme-asia" description="Demo group for Asia" /> </membership> <membership id="9876" email-listed="true" notification="immediate" status="normal" role="manager"> <group id="5" name="acme-australia" description="Demo group for Australia" /> </membership> </memberships>
Or in JSON:
{ "member": { "id": 123, "firstname": "Joan", "surname": "Smith", "username": "jsmith", "status": "activated", "fullname": "Joan Smith" }, "memberships": [ { "id": 1234, "emailListed": true, "notification": "immediate", "status": "normal", "role": "manager", "group": { "id": 4, "name": "acme-asia", "description": "Demo group for Asia" } }, { "id": 9876, "emailListed": true, "notification": "immediate", "status": "normal", "role": "manager", "group": { "id": 5, "name": "acme-australia", "description": "Demo group for Australia" } } ] }
Example: subgroup
Example of memberships that include a subgroup.
In the example below, John Smith is a member of acme-asia
only because they are a member of acme-japan
which is a subgroup of acme-asia
:
<memberships> <member id="3" firstname="John" surname="Smith" username="jsmith" email="jsmith@example.org" status="activated"> <fullname>John Smith</fullname> </member> <membership id="123" email-listed="true" notification="immediate" status="normal" role="reviewer" subgroups="acme-japan"> <group id="4" name="acme-asia" description="Demo group for Asia" /> </membership> <membership id="987" email-listed="true" notification="immediate" status="normal" role="manager"> <group id="5" name="acme-japan" description="Demo group for Japan" /> </membership> </memberships>
If the subgroups parameter is set to false
, the response does not include the acme-asia
group:
<memberships> <member id="3" firstname="John" surname="Smith" username="jsmith" email="jsmith@example.org" status="activated"> <fullname>John Smith</fullname> </member> <membership id="987" email-listed="true" notification="immediate" status="normal" role="manager"> <group id="5" name="acme-japan" description="Demo group for Japan" /> </membership> </memberships>
Error Handling
No specific error handling.