-
Notifications
You must be signed in to change notification settings - Fork 30
Custom API Calls
Justin Stolpe edited this page May 21, 2022
·
4 revisions
The Instagram Graph API PHP SDK allows for fully customizable request.
// first we have to instantiate the core Instagram class with our access token
$instagram = new Instagram\Instagram( array(
'access_token' => '<ACCESS_TOKEN>'
) );
/**
* Here we are making our request to instagram and specify the endpoint along with our custom params.
* There is a custom function for get, post, and delete.
* $instagram->get()
* $instagram->post()
* $instagram->delete()
*
* Here is the skeleton for the customized call.
*/
$response = $instagram->method( array(
'endpoint' => '/<ENDPOINT>',
'params' => array( // query params key/values must match what IG API is expecting for the endpoint
'<KEY>' => '<VALUE>',
'<KEY>' => '<VALUE>',
// ...
)
) );
// first we have to instantiate the core Instagram class
$instagram = new Instagram\Instagram( array(
'access_token' => '<ACCESS_TOKEN>'
) );
// here we are making our get request and specify the endpoint along with our custom params
$businessDiscovery = $instagram->get( array(
'endpoint' => '/<IG_USER_ID>', // endpoint must match what the
'params' => array(
'fields' => 'business_discovery.username(<USERNAME>){username,website}'
)
) );