Question: How do I convert the following code to get a list of the members in a group through a group id? I'm currently using facebook

How do I convert the following code to get a list of the members in a group through a group id? I'm currently using facebook api developer, restfb library, and netbean.

import com.restfb.Connection; import com.restfb.DefaultFacebookClient; import com.restfb.FacebookClient; import com.restfb.types.Group; import com.restfb.types.User; import java.util.List; import java.util.Scanner;

/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */

/** * * @author */ public class Main {

/** * @param args the command line arguments */ public static void main(String[] args) { String accessToken = "insert your accessToken here"; Scanner input = new Scanner(System.in); FacebookClient fbClient = new DefaultFacebookClient(accessToken); Connection groupsFeed = fbClient.fetchConnection("me/groups", Group.class); for(List page : groupsFeed){ for(Group aGroup : page){ System.out.println("Do you want to get Memebers of "+aGroup.getName()+" ? Yes/NO"); String ans = input.nextLine(); if(ans.equals("Yes")){ System.out.println("fb.com/"+aGroup.getId()); Connection userFeed = fbClient.fetchConnection(aGroup.getId()+"/members", User.class); for(List userPage: userFeed){ for(User aUser : userPage){ System.out.println(aUser.getName()); System.out.println("fb.com/"+aUser.getId()); } } } } } } }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!