instagram-api
instagram-api copied to clipboard
SyntaxError: Unexpected token < in JSON at position 0(…)
When I use userSelfMedia() it comes back correct and I get the correct info but when I try to call a specific user it comes back..
SyntaxError: Unexpected token < in JSON at position 0(
at Object.parse (native)
at IncomingMessage.
Is there something I'm doing wrong?
Doesnt Work instagramAPI.userMedia('user_id').then(function(result) { console.log(result.data); console.log(result.limit); console.log(result.remaining); }, function(err){ console.log(err); // error info }); }
Works instagramAPI.userSelfMedia('user_id').then(function(result) { console.log(result.data); console.log(result.limit); console.log(result.remaining); }, function(err){ console.log(err); // error info }); }
Are you actually sending the user_id in instagramAPI.userMedia
? instagramAPI.userSelfMedia
probably works because it doesn't need a user_id, it uses the userID of who created the accessToken / makes the request.
You need to send which user to grab in the first request like: instagramAPI.userMedia('5482639').then...