Stanislav Skotnicky
Stanislav Skotnicky

Reputation: 69

RestFB instagram integration

Does anyone has some experience with this? I was trying to find some tutorial for basic operations at least, I found only RestFb java docs, which is not very descriptive. What I need: getting Instagram user by Id, searching of posts / users by search word, getting users posts, managing posts (publish, unpublish),...

From what I got from the API documentation is that Instagram account is bound to a Facebook page and I need a user access token of the user that has some role at that page.

When I want to get a Facebook user I create a DefaultFacebookClient with the access token and call fatchObject, but what should I create when I want Instagram data?

Thanks very much for any answer.

Upvotes: 1

Views: 1434

Answers (1)

Reinaldo
Reinaldo

Reputation: 131

I think you still need to get the Page object with facebookClient.fetchObject and then get the IgUser object with

IgUser igUser = page.getInstagramBusinessAccount();

keeping in mind that the fetchObject will have to list as parameter fields the Instagram fields as well (e.g., instagram_business_account), like for example:

Page page = facebookClient.fetchObject("fb_page_name", Page.class,
                Parameter.with("fields", "id, name, username, about, fan_count, engagement, talking_about_count, picture, website, instagram_business_account"));

hope this helps.

Upvotes: 1

Related Questions