0

For a public group https://www.facebook.com/groups/359484787507661/, i am getting the group info by the followong code:

Group group = facebookClient.fetchObject("359484787507661", Group.class);

But I cant access the group info of the following public group url https://www.facebook.com/groups/therealheronarendramodi.

Group group = facebookClient.fetchObject("therealheronarendramodi", Group.class);

I got the following error:

Exception in thread "main" com.restfb.exception.FacebookOAuthException: Received Facebook error response of type OAuthException: (#803) Some of the aliases you requested do not exist: therealheronarendramodi (code 803, subcode null)

How to get facebook public group info by username? Is there any way to get group by it's username in restfb api?

din_oops
  • 698
  • 1
  • 9
  • 27
  • 2
    No, you can not get information about groups by their name, you need their id. And you can’t get that from the group name either. Plus, Facebook has restricted access to groups to the groups the user is an admin of in their latest API version. – CBroe Jan 20 '16 at 09:03

1 Answers1

1

You can use the Search API to get a group ID by a name:

/search?type=group&q={group-name}

Of course you may get more than one group, it´s a list of groups with their IDs.

andyrandy
  • 72,880
  • 8
  • 113
  • 130