2

i'm fetching all user details with latest media and some insights, but the posts are not including the location:

const fields =
  'fields=business_discovery.username(jbalvin){id,ig_id,name,username,profile_picture_url,followers_count,media_count,biography,follows_count,media{comments_count,like_count,timestamp,media_type,media_product_type,location{city}}}';

const res = fetch(
  `https://graph.facebook.com/v12.0/${id}?${fields}&access_token=${token}`
)
  .then((response) => response.json())
  .then((data) => console.log(data));

This is the answer i'm getting:

{
  business_discovery: {
    id: '17841401525860163',
    ig_id: 10482862,
    name: 'J Balvin',
    username: 'jbalvin',
    profile_picture_url: 'https://scontent.fbaq2-2.fna.fbcdn.net/v/t51.2885-15/272307439_140470511724764_4263731586488463919_n.jpg?_nc_cat=1&ccb=1-5&_nc_sid=86c713&_nc_eui2=AeErYr-NceD1DvlTdMFw7QPcrlXwvFWx4ZOuVfC8VbHhkxGyDdL5-tOIFpeIU77PgqeJvRY6gXVRGSpdxBP8SxNL&_nc_ohc=RswtWyTHU8wAX_u4pcF&_nc_ht=scontent.fbaq2-2.fna&edm=AL-3X8kEAAAA&oh=00_AT8p18_oXvJsxCQV632bq6vmDcxMrJ9HHnQdk5E-s29bDw&oe=61F82A7A',
    followers_count: 51214234,
    media_count: 12940,
    follows_count: 1927,
    media: {
      data: [
        {
          comments_count: 1550,
          like_count: 427154,
          timestamp: '2022-01-25T01:00:20+0000',
          media_type: 'CAROUSEL_ALBUM',
          media_product_type: 'FEED',
          id: '17928326101919137'
        },
      ],
      paging: {
        cursors: {
          after: 'QVFIUjh1cGMwNnFnbldraGtuOU5fcGNDNFF6ekdvWkhSV3o3SjdJQ25iMl9tU0ZAoNTlMVlEtcnh6VUZAKQnFoLUFTc3phREdlZAmNCR0NGMkV4QldhNkFORk5R'
        }
      }
    }
  },

i deleted the other 24 post because the response is too long. The thing is that the post that i'm showing there has a location on instagram, but the api is not responding with it, how can i get the post location?

aminstar
  • 21
  • 4
  • No "location" in the fields list [here](https://developers.facebook.com/docs/instagram-api/reference/ig-media) so it looks like we can't access it from the graph API... – Stijn Sanders Jul 05 '22 at 22:31

0 Answers0