Want to know how to get content from Facebook and embed it into your website or app? We have researched and put together a detailed Facebook API tutorial to answer the questions that many have asked.
Content
- 1. What is the Facebook API?
- 2. How to get Facebook API key
- 3. Examples of how to use the Facebook API
- 4. Facebook-API-Integration
- 5. Latest API changes
- 6. Facebook API Status and Errors
- 7. Facebook API Documentation.
- Bonus: Create a widget to display social media content on your website!
What is the Facebook API?
The Facebook API is a package of solutions that is used as the primary method of reading data into and out of the platform. It allows application developers and users to access the functionality of this network: user information, photos and videos, messages and more.
BONUS: Create your Facebook feed widget in minutes!
How to get Facebook API key.
If you want to get access to the Facebook API Key, you need to register or log in to the developer portal with your existing Facebook account and verify your identity. This only requires a few simple steps:
- Step 1. Sign in or create an account
GonnaFacebook portal for developersand click Sign In. You can sign in with your existing Facebook account or create a new one
- Step 2. Get started
If you are on duty, click "Get Started" in the top right corner of the main page
- Step 3. Verify your account
To work with the developer tools, you must approve your account. In the popup window that appears, click Next.
You can verify your account with your phone number or credit card. To do so via a phone number, select your country from the dropdown menu, enter your phone with country code, and click "Send as Text." Enter the purchased code in the field and click "Confirm".
- Step 4. Create your application
Then the service offers you to create your first application. All Facebook APIs and app statistics are tracked in the developer dashboard and cannot be accessed without creating an app.
- Step 5. Add the apps or generate access tokens for your own needs
The easiest and most convenient way to use the Facebook APIs is to add the apps directly to the dashboard. Just choose the one that suits your needs.
Go to Tools - Graph API Explorer to generate access tokens for different types of APIs that you want to use in your application. Select the application and type of token you need from the dropdown menus on the left side of the screen. Then click Generate Access Token. You must allow the app to access your site.
After successfully approving your account, you will be prompted to read some documentation or to continue creating your first app. We strongly recommend that you first familiarize yourself with the documents.
This type of API allows you to display your business account or page content on a website or application.
How to use Facebook API samples
The core product is the Graph API, which serves as the foundation for all other types of Facebook APIs. They are essentially extensions of the Graph API, and all Facebook products interact with them in some way.
How can you benefit from the Facebook Developer Console and the products available there? There are many ways to update your website or app with the content and some features of this social platform.
You can display different types of social media content (posts, images, videos) on your website or app to engage and entertain users.
However, keep in mind that if the Graph API is being deployed for use by other users, they must also first approve it in a popup window. Only after a user authorizes will the app receive an access token from that user and be able to use their Facebook profile information.
Facebook API Limitations
Remember that each type of API always has limitations. Graph API queries within the application access token count toward this application rate limit. The view count for each app is the number of requests it can make during a one hour window and is calculated as follows:Calls within an hour = 200 * number of app users
Facebook-API-Integration
The platform offers several pre-built solutions for non-developers based on its Graph API. All Facebook apps and APIs are essentially a set or collection of Graph API nodes. This means that you still need to follow steps 1-3 above to create an account and gain access to the dashboard. Below we describe the most widely used Facebook standard API applications.
Facebook-Feed-API-Typen
Facebook Pages API
This type of API provides access to a page's settings, content, and metrics. It allows you to create and view posts, page comments, page content, and more. Full details can be found in thePages-API-Documentation. Don't forget that you need a token from an app user who owns or can perform a required task on the page.
Facebook-Video-API
There are two types provided by Facebook:Video-APIYLive-Video-API. Both post videos to a page, group, or event managed by a user of the app. The Video API is for posting short and long videos to one or more Pages and Groups. In turn, the Live Video API is used to schedule a live stream, broadcast a video on a user profile, group, or event, and also interact with the viewer. And of course, you need access tokens for Pages, Groups, or Events, or a combination of these, depending on where you want to put your video or live stream.
Facebook API Events
This type of API is also presented as Graph API functionality, but is only available to Facebook Marketing Partners. It also requires an access token from the event manager or a group that created that event.
Facebook-News-API
There are two ways to access and use Facebook News Feed. The described Graph API provides the ability to access a separate user feed with status updates and receive posts and API links posted by the user or anyone else on the profile. You can read more about itHere.
There is also a public feed API that allows content marked "public" to be displayed on the third-party website or service. But this type of API key is only given to approved media publishers, so you need to apply for it first.
You don't need the Facebook Groups API to display your content on your website. WearFacebook-Feed-Widget! This gives you full control over the content you need.
Facebook-Community-API
Facebook Comments API
Comments on Facebook can be accessed through the Graph API. Because comments can be left on different types of content, you must have access to an object to be able to work with comments on it.
Facebook Reviews API
This part of the Graph API renders objects that contain a recommendation. Standard fields include date, star rating, review text, user information, and "Pass" or "Fail" flags.
If you want more control over the grades you see, you can customize them.rating pluginaccording to your preferences.
Facebook-Tools-API
Facebook login API
The Facebook API login sample can be seen on many web services that require registration. This provides users with a fast and secure way to sign in to a website or app. This API collects users' access tokens to retrieve their profile information, which is only possible after user consent. If you want to use this type of API, you must have your application reviewed and approved by the Facebook administrator.
Facebook Places-API
Places Graph is a separate solution from Facebook available only for Android and iOS platforms. This allows your app to retrieve information about the user's current location. It also allows searching and finding places, sharing locations and geotagging. The Places API also requires retrieving access tokens from users. To integrate and work with the Places API, you must first download the Facebook SDK for your app.
Facebook Payments API
The Payment API contains the details of a payment made in a specific application. These payments are created in Facebook Payments and processed based on the platform. This type of API also requires an access token for an application that creates a payment.
Facebook Messenger-API
Messenger API is an application that allows you to host a chat channel on your website using Facebook Messenger. The Messenger API solution also allows a developer to build guided conversations with users. This allows Messenger to automatically reply to a user using the Send API (also known as the Facebook Bot API), which sends webhooks to the URL of the server hosting Messenger.
Stay connected with your customers and your website audience with a free and easy-to-install appMessenger-Button!
Facebook-Marketing-API-Typen
Facebook Ads API
The Marketing API is a set of Graph API endpoints that help optimize advertising on Facebook. The Facebook Ads API allows users to create and manage separate ad campaigns, ad sets, and ad units.
Facebook Marketplace-API
Currently there are only the categories vehicles and real estateFacebook Market. To access this area of the Facebook platform, you must create a developer account and verify your business. This solution introduces the use of the Lead API together with developer webhooks for better performance. To do this, you need to create your app as described earlier in this article and submit it for Facebook to review and approve.
Facebook Analytics-API
This solution helps track and optimize your customers' behavior and journey across mobile, web, bots, offline, and other resources. To implement it, you need to integrate the Facebook SDK into your app or website. You can get more information in the analysis.help Center.
Facebook Business Manager-API
This type of API helps manage multiple Pages, ad accounts, and apps in one place. In Business Manager, you can connect business resources and rights for rights management, run campaigns on behalf of a business, create ad accounts, and buy ads.
Latest API changes
Changes to the Facebook API include versioned changes, which were introduced with the release of a new version of the API. There are also unversioned changes introduced outside of normal versions. There is a special one for upgrading to a higher version of the Facebook APIAPI update tool.
The latest version is v8.0, which was recently released in August 2020. It now offers:
- Application type: business, gaming and none
- Get likes for live videos
- Product template in Messenger for stores to send products as messages
The previous version v7.0 released in May 2020 will be available until August 2022.
Facebook API Status and Errors
The current platform statue is fine as of October 1, 2020. However, requests made sometimes result in different Facebook API error responses with respective error codes. For example, the Facebook API error 400 (Bad Request) means that a query is no longer supported and you need to generate a new access token. Here are some others:
Code | Name |
102 | api session |
1 | unknown API |
2 | API service |
3 | API method |
4 | too many API calls |
17 | User API too many calls |
10 | API permission denied |
190 | The access token has expired |
200-299 | API permission (multiple values depending on permission) |
341 | App limit reached |
368 | Temporarily suspended due to policy violations |
506 | double post |
1609005 | Failed to post link |
Facebook API Documentation
Documentation for all types of Facebook Developer APIs can be found at theDocumentsFacebook developer portal section. For a complete list of Graph API root nodes, see theFacebook API ReferenceSection. Each API documentation includes a short tutorial on what permissions are required, how to use them, and how to implement them. You can find it in the Getting Started and Guides sections of each specific documentation.
Bonus: Create a widget to display social media content on your website!
Check out all the features and discover the coolest aspect of social media on your website.