1.0.0
Client -Schnittstelle zum Zugriff auf Instagram -API.
Installieren Sie über NPM
npm install instagram-wrapi --save
Die Instagram -API erfordert eine Authentifizierung und verwendet das OAuth 2.0 -Protokoll. Authentifizierte Anfragen erfordern eine access_token .
Weitere Details zum access_token
finden Sie hier.
Einige Anrufe erfordern außerdem public_content
Scope Set für Ihre App. Bitte beachten Sie die Dokumentation der Umfang.
Erstellen Sie ein Client -Objekt, um eine Verbindung zu Instagram -API -Endpunkten mit Ihrem access_token
herzustellen.
var instagramWrapi = require ( 'instagram-wrapi' ) ;
var client = new instagramWrapi ( INSTAGRAM_ACCESS_TOKEN ) ;
// Now you are ready to make API calls to Instagram.
Geben Sie Parameter und einen Rückruf an.
API -Aufrufe folgen dieser Syntax:
client.apigroup.action(param1, ..., queryString, callback);
param
- ( falls erforderlich ) URL -Parameter - z. B. für Benutzer. Geben Sie den Wert für :user-id
.queryString
- ( nach Bedarf ) API -Methodenparameter als Schlüsselwertpaare. client . users . self ( function ( err , data ) {
if ( ! err ) {
console . log ( data ) ;
}
} ) ;
client . users . media . recent ( '1574083' , function ( err , data ) {
if ( ! err ) {
console . log ( data ) ;
}
} ) ;
client . tags . media . recent ( 'spring' , function ( err , data ) {
if ( ! err ) {
console . log ( data ) ;
}
} ) ;
client . media . search ( { lat : '48.858844' , lng : '2.294351' , distance : 5000 } , function ( err , data ) {
if ( ! err ) {
console . log ( data ) ;
}
} ) ;
MIT