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);
}
});