bob
bob

Reputation: 105

Instagram API for ADS posts not working

I get instagram post details (likes, comments) by using the media endpoint:

$data1 = file_get_contents("https://api.instagram.com/v1/media/$media_id/likes?access_token=$access_token");

This works for normal posts from my feed, but when I input the $media_id for an instagram post that is an AD I always get invalid media id

{
  "meta":  {
    "error_type": "APINotFoundError",
    "code": 400,
    "error_message": "invalid media id"
  }
}

Are ads treated as different types of posts or the API is unable to retrieve any details from them?

Upvotes: 3

Views: 899

Answers (2)

Petre Tudor
Petre Tudor

Reputation: 43

Instagram ADS API has been integrated into Facebook Marketing API.

All the details are here: https://developers.facebook.com/docs/marketing-api/guides/instagramads/ads_management/v2.6

There is a workaround to get some details on an AD. If you query the oembed endpoint, like this: https://api.instagram.com/oembed/?url=https://www.instagram.com/p/BAZV-jVlFGp/ you get some data. I wasn't able to get any comments though.

Upvotes: 1

Chico Carvalho
Chico Carvalho

Reputation: 68

Yes, the ads are treated like a different type of post and can only be managed or fully read by means of the Facebook APIs. Try the Graph API, the Marketing API or the Business Manager API, that's where I got the most useful tips and results.

(sorry, dont have enough rep to post more than two links. But don't worry, you'll find it on google in a heartbeat)

Upvotes: 2

Related Questions