L
L
lexstile2018-03-27 01:07:59
PHP
lexstile, 2018-03-27 01:07:59

How to make the right request to get information from instagram through facebook?

Task:
Get information about media from Instagram via graph.facebook.com.
https://developers.facebook.com/docs/instagram-api...
I try like this:

$api_host = 'https://graph.facebook.com/user/media';
$access_token_parameters = array(
'client_id'                =>     CLIENT_ID,
'client_secret'            =>     CLIENT_SECRET,
'redirect_uri'             =>     REDIRECT_URI,
'access_token'             =>     $token['access_token'],
'fields'                   =>     'image_url,caption,user_tags,location_id'
);
$jResult = $ins->getAccessTokenUrl($api_host, $access_token_parameters);

As I understand it, instead of user, you need to substitute the id of the business account associated with Facebook.
But how to get it - I don’t know which request to send?
https://developers.facebook.com/docs/instagram-api...
I try like this:
$api_host = 'https://graph.facebook.com/11111111111';
$access_token_parameters = array(
'client_id'                =>     CLIENT_ID,
'client_secret'            =>     CLIENT_SECRET,
'redirect_uri'             =>     REDIRECT_URI,
'access_token'             =>     $token['access_token'],
'fields'                   =>     'instagram_business_account'
);
$jResult = $ins->getAccessTokenUrl($api_host, $access_token_parameters);

Instead of units, I put my facebook id.
Error:
Tried accessing nonexisting field (instagram_business_account) on node type (User)

Answer the question

In order to leave comments, you need to log in

2 answer(s)
P
Philipp, 2018-03-27
@lexstile

This method only works for pages. Support for personal accounts from Instagram is not currently available.
Please read this https://developers.facebook.com/blog/post/2018/01/...
The point is that Facebook is gradually tightening the screws on accessing personal data from apps.
In my opinion, applications only need access to the following personal data - FI, gender, mail, profile picture and age.
I understand that it would be nice for any music application like Spotify to have deeper integration, for example, start following an artist on Spotify, automatically subscribe to a Facebook page. In my opinion it is convenient, but some may not like it.

P
Puma Thailand, 2018-03-27
@opium

Contact api instas directly, why do it through Facebook

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question