借助有用的 restFB 人员的提示,我现在可以回答我自己的问题,以防其他人有同样的问题:
基本上,我们想要公共数据的 instagram 页面的名称必须在获取期间传入。下面的代码说明了。假设我们想从“motorolaus”Instagram 页面获取公共信息。
// first you need to define the fields you want to fetch.
// For example, let's say we want the name, username,
// number of followers, number of posts(media) and the profile pic:
String businessDiscoveryFields = "business_discovery.username(motorolaus){name,username,followers_count,media_count,profile_picture_url}";
// Then we fetch the restFB IgUser object, using as id (1st parameter)
// the id of your Instagram business page, for which you got the
// access token. This is a string, formed by digits only.
IgUser igMyUser = facebookClient.fetchObject(my_instagram_bizpage_id, IgUser.class,Parameter.with("fields", businessDiscoveryFields));
// now we get the IgUser object for the page we want (motorolaus in
// this example), and from there we get the public data
IgUser igBizUser = igMyUser.getBusinessDiscovery();
System.out.printf("Instagram page %s (%s)\n", igBizUser.getName(), igBizUser.getUsername());
System.out.printf(" num followers: %s\n", igBizUser.getFollowersCount());