![]() The refreshToken() function makes a request to the /refresh_access_token endpoint of the Instagram Graph API. See the Basic Display API Reference for Media for a definitive reference to the data returned for each Instagram post. Note: instafeed() returns the post objects exactly as they are received from the API, but adds an image property to each post so you have a reliable URL to an image for the post regardless of the media_type. Depending the media_type, this will either be the media_url or thumbnail_url. This is a property added by the instafeed() function. If the post has no caption, the API does not return this. The thumbnail image URL, this is only returned if the media_type is VIDEO. If the media_type is VIDEO, this will be a link to a video file. If the media_type is IMAGE or CAROUSEL_ALBUM, this will be a link to an image. The username of the account that made the post. You can pass this value to request the next set of posts.Įach Instagram post object will contain the following properties. The 'after' page cursor returned from the API. The table below lists all properties attached to each Instagram post object.Ī count of the total number of posts the API returned. The instafeed() function will return the following values if the request was successful. More Information on Cursor-Based Pagination.By passing an 'after' page cursor, you're telling the API to return posts that come after the last post returned in a previous request. An error will be thrown if you attempt to request more than 25 posts.Īn 'after' page cursor from a previous request that points to the end of the 'page' of data that was returned. The number of posts you want to fetch, the default value is 25, and the API will only return a maximum of 25 posts per request. OptionĪ long-lived User Access Token for the Instagram account you want to fetch the posts for. The instafeed() function accepts an object of options as it's only parameter. The instafeed() function makes a request to the /me/media endpoint of the Instagram Graph API. Npm install instafeed-node-js Basic Usage Please be sure to update this value in the code snippets to correctly reference the variable for your User Access Token. Therefore, the code snippets below assume your User Access Token is stored in _user_access_token. Note: It is highly recommended that you store User Access Tokens in an environment variable. A User Access Token will allow you to fetch only the Instagram posts from the account it was generated for.įor more information about how to obtain a User Access Token, see: Basic Display API Overview Table of Contents To use this module, it is recommended that you obtain a long-lived User Access Token from the User Token Generator tool in the Facebook Developers Console. $('div.instafeed').This node.js module allows you to asynchronously fetch posts from the Instagram Graph API with a long-lived User Access Token. By default, the plugin will get the popular photos from your Instagram account. Initialize the plugin and insert your client ID into the JavaScript. : URL to view the image on Instagram's websiteĤ.Create the handlebars.js template for your Instagram photo gallery with the following tags: The plugin requires handlebars.js for dynamic template processing. Load jQuery library and the jQuery handlegram plugin in the html document. You can now use the Feed Instagram Graph API plugin instead. This plugin is broken since Instagram has changed its API. Handlegram is a simple-to-use jQuery plugin which uses JSONP to fetch and show recent or popular Instagram photos by user, location or hashtag.
0 Comments
Leave a Reply. |