skip to Main Content

Looking at the new Instagram Graph API – there is no direct way to retrieve username once a user is logged in. Although it says in the official document that a call like

 "https://graph.facebook.com/v3.2/17841405822304914?fields=biography%2Cid%2Cusername%2Cwebsite&access_token=EAACwX..."

should return the following:

{
  "biography": "Dino data crunching app",
  "id": "17841405822304914",
  "username": "metricsaurus",
  "website": "http://www.metricsaurus.com/"
}

This currently returns an error, and looks like there is no such option to get only username of an instagram business user.

enter image description here

3

Answers


  1. Chosen as BEST ANSWER

    I was able to solve this only by using the old api.

    According to their documentation, although the old API is about to become deprecated, as of now, it is meant for small businesses or personal apps. The new Instagram Graph API is "An API for accessing data in large- and medium-sized Instagram Business Accounts"

    Looks like FB doensn't know it's way around.


  2. If you are talking about fetching username of an instagram business account which is linked to your facebook page, you can use the below curl

    curl -i -X GET "https://graph.facebook.com/v3.2/me/accounts?fields=instagram_business_account%7Busername%2Cname%2Cig_id%7D&access_token=<access_token>"
    

    Please replace access_token with your user access token in the above curl.

    Sample reponse which you will get for the above curl is as below :

    {
      "data": [
        {
          "instagram_business_account": {
            "username": "<instagram user name>",
            "name": "<instagram display name>",
            "id": "<corresponding facebook graph id for instagram profile>",
            "ig_id": <instagram profile id>
          },
          "id": "<facebook page id>"
        }
      ],
      "paging": {
        "cursors": {
          "before": "MTc2Njg1MTU2MTI1ODA1",
          "after": "OTg3MzU1NzExNDUwMDg3"
        }
      }
    }
    
    Login or Signup to reply.
  3. If it helps to someone.. Now its better to do it like this GrapAPI v10.0

     FB.api('/' + pageID + '?fields=instagram_business_account{id,name,username}',
         function (response) {
            // TODO: whatever you want
         },
         { access_token: accessToken }
     );
    

    EDIT: I wouldn’t do it this way anymore. Its very old code, I would wrap it somehow and I am not sure this still works..

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search