instagram-wrapi
v0.1.2
Published
Wrapper for Instagram API
Downloads
108
Maintainers
Readme
Instagram API Wrapper
Client interface for accessing Instagram API.
Installation
Install via npm
npm install instagram-wrapi --save
Setup
Instagram API requires authentication and uses the OAuth 2.0 protocol. Authenticated requests require an access_token.
More details on getting an access_token
can be found here.
Also, some calls require public_content
scope set for your app. Please refer to scope documentation.
Usage
Create a client object to connect to Instagram API endpoints with your access_token
.
var instagramWrapi = require('instagram-wrapi');
var client = new instagramWrapi(INSTAGRAM_ACCESS_TOKEN);
// Now you are ready to make API calls to Instagram.
Provide parameters and a callback.
API calls follow this syntax:
client.apigroup.action(param1, ..., queryString, callback);
param
- (if required) url parameters - eg: For users.get the value for:user-id
.queryString
- (as required) API method parameters as key-value pairs.
Examples
Get information about the user of the access_token.
client.users.self(function(err, data) {
if (!err) {
console.log(data);
}
});
Get the most recent media published by a user.
client.users.media.recent('1574083', function(err, data) {
if (!err) {
console.log(data);
}
});
List of media recently tagged as spring.
client.tags.media.recent('spring', function(err, data) {
if (!err) {
console.log(data);
}
});
Search for recent media in a given location within 5km range. (What's happening in your area)
client.media.search({lat:'48.858844', lng:'2.294351', distance:5000}, function(err, data) {
if (!err) {
console.log(data);
}
});