Alex Harris
Alex Harris

Reputation: 6392

Get Facebook Media-id for instagram post from url

If I have a instagram post is there anyway to get the facebook id for an instagram post? To be clear, if I were to look at https://www.instagram.com/p/Bcqn51ynrd5/ I am able to find the instagram media-id by doing one of two things:

However, neither of these are the media-id associated with facebook's new instagram graph insights. If I already have the facebook media-id I am able to get the instagram media-id through facebook graph by calling graph.facebook.com/{facebook-media-id}?fields=ig_id but I am unable to find the inverse. Is this possible?

Upvotes: 12

Views: 5336

Answers (2)

Victor Stagurov
Victor Stagurov

Reputation: 4756

Call graph.facebook.com/{instagram-business-account-id}/media?fields=ig_id

which returns a list of both Facebook and Instagram media-ids:

{
  "data": [
    {
      "ig_id": "1729885037886968354",
      "id": "16961190105043123"
    },
    {
      "ig_id": "1714698694055731973",
      "id": "16949739045077321"
    }
    ...

then find corresponding Facebook's media-id you can get the insights for.

Also, instead of ig_id use shortcode field in graph.facebook.com/{instagram-business-account-id}/media?fields=shortcode and traverse list searching directly for short code, so you may skip "finding Instagram media-id by short code" step.

Upvotes: 4

tukan
tukan

Reputation: 17347

I don't think it is possible. It is listed as limitation in the Insights API documentation.

To list current limitations:

  • We only store 2 years worth of metrics data.
  • You can only get insights for a single Instagram Business account at a time.
  • You cannot get insights for Facebook Pages.
  • Stories insights are only available for 24 hours, even if the stories are archived or highlighted. If you want to get the latest insights for a story before it expires, set up a Webhook for the Instagram topic and subscribe to the story_insights field.

Upvotes: 2

Related Questions