Question

So far, I have been able to fetch user's data, once they have logged in and given permission, but I am struggling to fetch the user's group id's.

What I am trying to do is fetch a list of the user's group id's so I can then use them to display posts for those groups.

When I try fetching the group id's with the following code, I get nothing back

IN.API.Profile("me")
.fields("groupMemberships:(group:(id))")
.result(displayProfiles);

Can someone tell me what I am doing wrong?

My console show the following

{ "_total": 1, "values": [{"_key": "~"}] }

Many Thanks

Was it helpful?

Solution

Managed to figure it out, the following code will return an array of what I need:

IN.API.Raw("/people/~/group-memberships:(group:(id,name,counts-by-category))?membership-state=member")
.result(groups)
.error(showErrors);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top