title: Instagram API in R - Deprecated - Need to use graph.facebook.com
body: <p>I am simply looking to get the follower count for specific users on instagram. </p>
  
  <p>I have been spending several hours looking into this and here are my findings: </p>
  
  <p>Instagram's API has been deprecated where you cannot collect instagram user info besides yourself. </p>
  
  <p>This means that the <code>instaR</code> package will not help anymore for this task. </p>
  
  <p>I think the new API is through <code>graph.facebook.com</code>. </p>
  
  <p>I created a token through the tools section in the graph.facebook.com API and also retrieved a client id and secret: 
  <a href="https://i.stack.imgur.com/A4uWH.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/A4uWH.jpg" alt="enter image description here"></a></p>
  
  <p>From here: </p>
  
  <pre><code>##With Facebook Graph API for Instagram Posts
  client_id &lt;- "XXXXXXX"
  client_secret &lt;- "XXXXXXXXXXXX"
  
  token &lt;- "XXXXXXXXXXXXXX"
  
  HeaderValue = paste0('Bearer ', token)
  
  response = POST(
    'https://graph.facebook.com/token',
    accept_json(),
    authenticate(client_id, client_secret),
    body = list(grant_type = 'client_credentials'),
    encode = 'form',
    verbose()
  )
  
  instaFeaturesURL &lt;- paste("https://graph.facebook.com/v2.5/users/search?q=", username,"&amp;access_token=",token,sep="")
  getinstaFeatures &lt;- GET(instaFeaturesURL, add_headers(Authorization = HeaderValue))
  instaFeatures &lt;- jsonlite::fromJSON(toJSON(content(getinstaFeatures)))
  instaFeatures$error
  
  $`message`
  [1] "(#803) Some of the aliases you requested do not exist: users"
  
  $type
  [1] "OAuthException"
  
  $code
  [1] 803
  
  $fbtrace_id
  [1] "ET29axa/P69"
  </code></pre>
  
  <p>Has anyone tried doing this? I don't even know where to access instagram from the Facebook API with this new change. Definitely need some help haha. </p>
  
  <p>Any help would be great, thanks!</p>
  
  <p>Edit: Based on comments: </p>
  
  <p>I tried using the the FBinsightsR package and below was my output after doing the following: </p>
  
  <pre><code>FBinsightsR::fbins_insta(start_date = '2019-01-01', until_date = '2019-01-31', time_period = "day", token, insta_account = 'therock')
  </code></pre>
  
  <p><code>-&gt; GET /v3.2/therock/insights? 
  metric=reach%2C%20impressions%2C%20follower_count%2C%20profile_views%2C%20website_clicks&amp;period=day&amp;access_token=EAAbhcJILvJwBACWPKQoGGmaDSfUlFjBp7ZCfUuw0hiyk43rDflBw4Bz2VeXjSI1CHWneAGsrXgxZCrRKdcsYrWEQOBARiwZBjF1ztQKhZC1GyNuQ46gWB3XpBv3Pi3StJiqZB7ypI01R8CP3Tqkjh5mUZCBRojNuLIGmAGSyuxrD1HCGUMT0jVMUO8ebnWPw9IaPgzg70PgAZDZD&amp;since=2019-01-01&amp;until=2019-01-31 HTTP/1.1
  -&gt; Host: graph.facebook.com
  -&gt; User-Agent: libcurl/7.59.0 r-curl/3.2 httr/1.4.0
  -&gt; Accept-Encoding: gzip, deflate
  -&gt; Accept: application/json, text/xml, application/xml, */*
  -&gt; 
  &lt;- HTTP/1.1 400 Bad Request
  &lt;- Vary: Accept-Encoding
  &lt;- Content-Encoding: gzip
  &lt;- x-app-usage: {"call_count":2,"total_cputime":0,"total_time":0}
  &lt;- WWW-Authenticate: OAuth "Facebook Platform" "invalid_request" "Unsupported get request. Object with ID 'therock' does not exist, cannot be loaded due to missing permissions, or does not support this operation. Please read the Graph API documentation at https://developers.facebook.com/docs/graph-api"
  &lt;- Content-Type: application/json
  &lt;- facebook-api-version: v3.2
  &lt;- x-fb-rev: 4735306
  &lt;- Access-Control-Allow-Origin: *
  &lt;- Cache-Control: no-store
  &lt;- x-fb-trace-id: EXOKV33fR8G
  &lt;- Expires: Sat, 01 Jan 2000 00:00:00 GMT
  &lt;- Strict-Transport-Security: max-age=15552000; preload
  &lt;- Pragma: no-cache
  &lt;- X-FB-Debug: ckCuGe6IKtUH4t62uJCJncpUfvMfZO0zbfWXsCyLCTUo7DuqOGDDJHhQRbW2/noaTNRqiUBFfY9sUGRBDH0MnA==
  &lt;- Date: Mon, 04 Feb 2019 15:19:03 GMT
  &lt;- Connection: keep-alive
  &lt;- Content-Length: 274
  &lt;- 
  Error:</code>.x<code>is empty, and no</code>.init<code>supplied</code></p>