Permission denied at https://api.imgur.com/3/account/{username}/images/count endpoint

319 views
Skip to first unread message

RepostStatistics

unread,
Apr 12, 2015, 6:14:57 PM4/12/15
to im...@googlegroups.com
Hi,
i just tried to use the /images/count endpoint with anonymous api access, but got an permission denied result.
It worked with /albums/count endpoint.
Did i mess something up or may this be a bug ?

Greets SleepProgger

@jasdev

unread,
Apr 14, 2015, 1:50:36 PM4/14/15
to im...@googlegroups.com
Have an example to reproduce? Can't seem to replicate this on our side.

Thanks!

Jasdev

RepostStatistics

unread,
Apr 14, 2015, 3:03:54 PM4/14/15
to im...@googlegroups.com
Hi jasdev,
Here a little JS test case.
The request to /images/count leads to an unauthorized message:
Failed to load images/count" 403 "{"data":{"error":"Unauthorized","request":"\/3\/account\/RepostStatistics\/images\/count","method":"GET"},"success":false,"status":403}"
The request to albums/count returns the correct data.


var CLIENT_ID = "YOUR_ID_IN_HERE";
var USER_NAME = "RepostStatistics";
$.ajax({
  url: 'https://api.imgur.com/3/account/'+USER_NAME + '/albums/count',
  method: 'GET',
  headers: {
    Authorization: 'Client-ID ' + CLIENT_ID,
    Accept: 'application/json'
  },
  success: function(result) {
    console.log("albums/count response: ", result.data.toLocaleString());
  },
  error: function(a, b, c){
    console.log('Failed to load albums/count', a.status, a.responseText);
  }
});

// This endpoint should work anonymously, but leads to an permission denied
$.ajax({
  url: 'https://api.imgur.com/3/account/'+USER_NAME + '/images/count',
  method: 'GET',
  headers: {
    Authorization: 'Client-ID ' + CLIENT_ID,
    Accept: 'application/json'
  },
  success: function(result) {
   console.log("images/count response: ", result.data.toLocaleString());
  },
  error: function(a, b, c){
    console.log('Failed to load images/count', a.status, a.responseText);
  }
});

@jasdev

unread,
Apr 14, 2015, 4:21:29 PM4/14/15
to im...@googlegroups.com
The endpoint actually works as intended, be sure to check your account settings, as there are toggles for public and private albums.

Hope this clears up any confusion!

Jasdev

RepostStatistics

unread,
Apr 14, 2015, 4:35:06 PM4/14/15
to im...@googlegroups.com
Ah, yes that explains it :)
Thanks for the response.
Reply all
Reply to author
Forward
0 new messages