Fatih Tan
Fatih Tan

Reputation: 808

Instagram Api Returns "invalid media id" Message When Getting Comments by Media ID

When I try to get comments via GETrequest, I take error message which is below. By the way application's Client Status is Sandbox Mode.

P.S: My access token is working. I can understand that by changing the token so api returns invalid token message.

Pure Instagram Media

https://www.instagram.com/p/BMQjQQggJkH/

Get API

https://api.instagram.com/v1/media/BMQjQQggJkH/comments?access_token=my_token

Output

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

Upvotes: 1

Views: 1848

Answers (1)

krisrak
krisrak

Reputation: 12952

BMQjQQggJkH <- thats not media-id, thats media shortcode.

First use this end point to get media-id from shortcode:

https://api.instagram.com/v1/media/shortcode/D?access_token=ACCESS-TOKEN

get data.id from response and then use this endpoint to get comments:

https://api.instagram.com/v1/media/{media-id}/comments?access_token=ACCESS-TOKEN

Upvotes: 1

Related Questions