Java工程師知識圖譜
1021
2025-03-31
目錄
Instagram 圖譜 API
常見用途
限制
要求
應用審核
公司驗證和補充條款
Overview(總覽)
Base URL(基本網址)
Authentication(認證方式)
Authorization(授權書)
Pages(頁數)
Tasks(任務)
Rate Limiting(限速)
Webhooks(網絡掛鉤)
Limitations(局限性)
Getting Started(入門)
Before You Start(開始前的準備)
1. Configure Facebook Login
2. Implement Facebook Login(實施Facebook登錄)
3. Get a User Access Token(獲取用戶訪問令牌)
4. Get the User's Pages(獲取用戶頁面)
5. Get the Page's Instagram Business Account(獲取頁面的Instagram企業賬戶)
6. Get the Instagram Business Account's Media Objects(獲取Instagram商業帳戶的媒體對象)
Next Steps(下一步)
Instagram 圖譜 API
常見用途
獲取并管理已發布的照片、視頻和動態
審核評論及其回復
衡量媒體和個人主頁的互動程度
探索帶有話題標簽的媒體
探索 @提及功能
發布照片和視頻(目前處于封測階段)
限制
您僅能以 Instagram Business 用戶的身份使用內容發布功能。
要求
應用審核
在將應用切換為已發布模式之前,您必須完成應用審核流程。您可以前往應用面板,在應用審核 > 權限和功能功能選項中開始此流程。除?pages_show_list?外,其余所有 Instagram 圖譜 API?權限均需應用審核批準。
公司驗證和補充條款
完成應用審核后,系統會要求您完成公司驗證并同意我們的補充條款。您必須完成驗證并同意相關條款后,才可將應用切換為已發布模式。
Overview(總覽)
The Instagram Graph API is built on the Facebook Graph API. It functions in the same way and supports the same features, with the key difference being?authentication. If you are unfamiliar with the Graph API, please read our?Graph API documentation?before proceeding.
Instagram Graph API建立在Facebook Graph API之上。它以相同的方式運行并支持相同的功能,不同之處在于身份驗證。如果您不熟悉Graph API,請先閱讀我們的Graph API文檔,然后再繼續。
Base URL(基本網址)
All endpoints can be accessed via the?graph.facebook.com?host.
可以通過graph.facebook.com主機訪問所有端點。
Authentication(認證方式)
All endpoint requests must include a Facebook?User access token. However, unlike Facebook users, Instagram users cannot grant your app access tokens directly. Instead, they must?connect?their?Instagram Business Account?or?Instagram Creator Account?to a?Facebook Page. Once connected, any Facebook User who is able to perform?Tasks?on behalf of that Page will be able to grant your app a User access token, which you can then include in API requests.
所有端點請求都必須包含Facebook?用戶訪問令牌。但是,與Facebook用戶不同,Instagram用戶無法直接授予您的應用訪問令牌。相反,他們必須將其Instagram企業帳戶或Instagram創建者帳戶連接到Facebook Page。建立連接后,任何能夠代表該頁面執行任務的?Facebook用戶都可以向您的應用授予用戶訪問令牌,然后您可以將其包含在API請求中。
Use the?Facebook Login?product to request User access tokens from your app's users. Note that Page tokens are not supported.
使用Facebook登錄產品向您的應用程序用戶請求用戶訪問令牌。請注意,不支持Page令牌。
Authorization(授權書)
Endpoint authorization is handled through?permissions. The API uses the following permissions and features:
端點授權通過權限處理。該API使用以下權限和功能:
instagram_basic
instagram_content_publish
instagram_manage_comments
instagram_manage_insights
manage_pages?or?pages_show_list
Instagram Public Content Access
Refer to the?reference documentation?to see which permissions each endpoint requires.
請參考參考文檔以查看每個端點需要哪些權限。
You can use the?Facebook Login?product to request permissions from your app's users. All of these permissions can be granted by app users while your app is in?Development Mode. However, with the exception of?pages_show_list, your app must be approved for these permissions through the?App Review?process before app users can grant them to your app while it is in?Live Mode.
您可以使用Facebook登錄產品向您的應用程序用戶請求權限。當您的應用處于開發模式時,所有這些權限都可以由應用用戶授予。但是,除之外pages_show_list,必須先通過“?應用程序審查”流程批準您的應用程序具有這些權限,然后應用程序用戶才能在處于實時模式的情況下將其授予您的應用程序。
Pages(頁數)
Instagram users must connect their Instagram Business Account or Instagram Creator Account to a?Facebook Page?before your app can access the API on their behalf. Once connected, any Facebook User who is able to perform?Tasks?on that Page can grant your app an access token, which can then be used in API requests.
Instagram用戶必須將其Instagram企業帳戶或Instagram創建者帳戶連接到Facebook頁面,然后您的應用才能代表他們訪問API。建立連接后,任何能夠在該頁面上執行任務的?Facebook用戶都可以為您的應用授予訪問令牌,然后可以在API請求中使用該令牌。
Facebook Pages can be connected to a Business or Creator account through the Page's?Settings > Instagramtab.
可以通過頁面的“設置”>“ Instagram”選項卡將Facebook Pages連接到企業或創建者帳戶。
Tasks(任務)
Only Facebook Users who can perform?Tasks?on the Facebook Page connected to the Instagram Business or Creator Account can grant your app User access tokens and permissions to use the API. Note that the API does not support?Business Manager System Users, or Users with Live Contributor defined roles.
只有可以在連接到Instagram業務或創建者帳戶的Facebook頁面上執行任務的Facebook用戶才能向您的應用授予用戶訪問令牌和使用API的權限。請注意,該API不支持Business Manager System用戶或具有Live Contributor定義角色的用戶。
Permissions can be granted by Facebook Users according to the tasks they are able to perform:
Facebook用戶可以根據他們能夠執行的任務來授予權限:
Permission
MANAGE
CREATE_CONTENT
MODERATE
ADVERTISE
ANALYZE
instagram_basic
?
?
?
?
?
instagram_content_publish
?
?
instagram_manage_comments
?
?
?
instagram_manage_insights
?
?
?
?
?
Refer to the?reference documentation?to see which permissions each endpoint requires.
請參考參考文檔以查看每個端點需要哪些權限。
Rate Limiting(限速)
All endpoints are subject to?Instagram Business Use Case rate limiting?except for?Business Discovery?and?Hashtag Search?endpoints, which are subject to?Platform Rate limiting.
除Business Discovery和Hashtag Search端點外,所有終結點均受Instagram業務用例速率的限制,后者受Platform Rate限制。
Webhooks(網絡掛鉤)
You can use Webhooks to have notifications sent to you whenever someone comments on your app users' media objects or when any of their stories expire. Refer to our?Webhooks documentation?to learn how to use Webhooks, then set up a webhook for the?Instagram?topic and subscribe to its?comments?and?story_insights?fields.
每當有人對您的應用程序用戶的媒體對象發表評論或他們的任何故事過期時,您都可以使用Webhooks將通知發送給您。請參閱我們的Webhooks文檔以了解如何使用Webhooks,然后為該Instagram主題設置一個Webhook?并訂閱其commentsand?story_insights字段。
Limitations(局限性)
ordering results?is not supported
all endpoints support cursor-based?pagination, but the?/{user-id}/insights?edge?is the only endpoint that supports time-based pagination
不支持訂購結果
所有端點都支持基于游標的分頁,但是/{user-id}/insightsedge是唯一支持基于時間的分頁的端點
Getting Started(入門)
This document explains how to successfully call the Instagram Graph API with your app and get an Instagram Business or Creator Account's media objects. It assumes you are familiar with the?Graph API?and?Facebook Login, and know how to perform REST API calls. If you do not have an app yet, you can use the?Graph API Explorer?instead and skip steps 1 and 2.
本文檔說明了如何使用您的應用程序成功調用Instagram Graph API并獲取Instagram Business或Creator帳戶的媒體對象。假定您熟悉Graph API和Facebook Login,并且知道如何執行REST API調用。如果還沒有應用程序,則可以改用Graph API Explorer,并跳過步驟1和2。
Before You Start(開始前的準備)
You will need access to the following:
An?Instagram Business Account?or?Instagram Creator Account
A?Facebook Page connected to that account
A Facebook Developer account that can perform?Tasks on that Page
A?registered Facebook App?with?Basic?settings configured
您將需要訪問以下內容:
一個Instagram的企業賬戶或Instagram的創建者賬戶
與該帳戶關聯的Facebook頁面
可以在該頁面上執行任務的?Facebook開發者帳戶
一個注冊的Facebook應用與基本設置配置
1. Configure Facebook Login
Add the Facebook Login product to your app in the App Dashboard.
將Facebook登錄產品添加到App Dashboard中的應用程序中。
You can leave all settings on their defaults. If you are implementing Facebook Login manually (which we don't recommend), enter your?redirect_uri?in the?Valid OAuth redirect URIs?field. If you will be using one of our SDKs, you can leave it blank.
您可以將所有設置保留為默認值。如果您正在手動實施Facebook登錄(我們不建議這樣做),請redirect_uri在“?有效OAuth重定向URI”字段中輸入您的身份。如果您將使用我們的SDK之一,則可以將其留空。
2. Implement Facebook Login(實施Facebook登錄)
Follow our?Facebook Login documentation?for your platform and implement Facebook Login into your app. Set up your implementation to request these permissions:
請遵循我們針對您平臺的Facebook登錄文檔,并在您的應用程序中實現Facebook登錄。設置您的實現以請求以下權限:
instagram_basic
pages_show_list
3. Get a User Access Token(獲取用戶訪問令牌)
Once you've implemented Facebook Login, make sure you are signed into your Facebook Developer account, then access your app and trigger the Facebook Login modal. Remember, your Facebook Developer account must be able to perform?Tasks?on the?Facebook Page?connected to the Instagram account you want to query.
實施Facebook登錄后,請確保您已登錄Facebook開發人員帳戶,然后訪問您的應用并觸發Facebook登錄模式。請記住,您的Facebook開發者帳戶必須能夠在連接到要查詢的Instagram帳戶的Facebook頁面上執行任務。
Once you have triggered the modal, click?OK?to grant your app the?instagram_basic?and?pages_show_listpermissions.
The API should return a User access token. Capture the token so your app can use it in the next few queries. If you are using the Graph API Explorer, it will be captured automatically and displayed in the?Access Token?field for reference:
觸發模式后,單擊“?確定”向您的應用授予instagram_basic和pages_show_list權限。
API應該返回用戶訪問令牌。捕獲令牌,以便您的應用可以在接下來的幾個查詢中使用它。如果您使用的是Graph API Explorer,它將被自動捕獲并顯示在“?訪問令牌”字段中,以供參考:
4. Get the User's Pages(獲取用戶頁面)
Query the?GET /me/accounts?endpoint (this translates to?GET /{user-id}/accounts, which perform a?GETon the Facebook?User?node, based on your access token).
查詢GET /me/accounts端點(這將轉換為,根據您的訪問令牌在Facebook?User節點上GET /{user-id}/accounts執行)。GET
curl -i -X GET \
"https://graph.facebook.com/v4.0/me/accounts?access_token={access-token}"
This should return a collection of Facebook Pages that the current Facebook User can perform the?MANAGE,?CREATE_CONTENT,?MODERATE, or?ADVERTISE?tasks on:
這應返回Facebook網頁的集合,目前Facebook的用戶可以執行的MANAGE,CREATE_CONTENT,MODERATE,或ADVERTISE在任務:
{
"data": [
{
"access_token": "EAAJjmJ...",
"category": "App Page",
"category_list": [
{
"id": "2301",
"name": "App Page"
}
],
"name": "Metricsaurus",
"id": "134895793791914",? // capture the Page ID
"tasks": [
"ANALYZE",
"ADVERTISE",
"MODERATE",
"CREATE_CONTENT",
"MANAGE"
]
}
]
}
Capture the ID of the Facebook Page that's connected to the Instagram account that you want to query. Keep in mind that your app users may be able to perform tasks on multiple pages, so you eventually will have to introduce logic that can determine the correct Page ID to capture (or devise a UI where your app users can identify the correct Page for you).
捕獲連接到要查詢的Instagram帳戶的Facebook頁面的ID。請記住,您的應用程序用戶可能能夠在多個頁面上執行任務,因此您最終將不得不引入可以確定要捕獲的正確頁面ID的邏輯(或設計一個UI,您的應用程序用戶可以在其中為您標識正確的頁面)。
5. Get the Page's Instagram Business Account(獲取頁面的Instagram企業賬戶)
Use the Page ID you captured to query the?GET /{page-id}?fields=instagram_business_accountendpoint:
使用您捕獲的頁面ID來查詢GET /{page-id}?fields=instagram_business_account端點:
curl -i -X GET \
"https://graph.facebook.com/v4.0/134895793791914?fields=instagram_business_account&access_token={access-token}"
This should return the?IG User?— an Instagram Business or Creator Account — that's connected to the Facebook Page.
這應該返回已連接到Facebook頁面的IG用戶(Instagram企業或創建者帳戶)。
{
"instagram_business_account": {
"id": "17841405822304914"? // Connected IG User ID
},
"id": "134895793791914"? // Facebook Page ID
}
Capture the?IG User?ID.捕獲IG用戶?ID。
6. Get the Instagram Business Account's Media Objects(獲取Instagram商業帳戶的媒體對象)
Use the?IG User?ID you captured to query the?GET /{ig-user-id}/media?endpoint:
使用捕獲的IG用戶?ID來查詢GET /{ig-user-id}/media端點:
curl -i -X GET \
"https://graph.facebook.com/v4.0/17841405822304914/media?access_token={access-token}"
This should return the IDs of all the?IG Media?objects on the?IG User:
這應該返回IG用戶上所有IG媒體對象的ID?:
{
"data": [
{
"id": "17918195224117851"
},
{
"id": "17895695668004550"
},
{
"id": "17899305451014820"
},
{
"id": "17896450804038745"
},
{
"id": "17881042411086627"
},
{
"id": "17869102915168123"
}
],
"paging": {
"cursors": {
"before": "QVFIUkdGRXA2eHNNTUs4T1ZAXNGFxQTAtd3U4QjBLd1B2NXRMM1NkcnhqRFdBcEUzSDVJZATFoLWtXMWZAGU2VrRTk2RHVtTVlDckI2NjN0UERFa2JrUk4yMW13",
"after": "QVFIUmlwbnFsM3N2cV9lZAFdCa0hDeV9qMVliT0VuMmJyNENxZA180c0t6VjFQVEJaTE9XV085aU92OUFLNFB6Szd2amo5aV9rTlVBcnNlWmEtMzYxcE1HSFR3"
}
}
}
If you are able to perform this final query successfully, you should be able to perform queries using any of the Instagram Graph API endpoints — just refer to our various guides and references to learn what each endpoint can do and what permissions they require.
如果您能夠成功執行此最終查詢,則應該能夠使用任何Instagram Graph API端點執行查詢-只需參考我們的各種指南和參考資料,以了解每個端點可以做什么以及它們需要什么權限。
Next Steps(下一步)
Develop your app further so it can successfully use any other endpoints it needs, and keep track of the permissions each endpoint requires
Complete the?App Review?process and request approval for all of the permissions your app will need so your app users can grant them while your app is in?Live Mode
Switch your app to Live Mode and market it to potential users
Once your app is in Live Mode, any Facebook User who you've made your app available to can access an Instagram Business or Creator Account's data, as long as they have a Facebook User account that can perform Tasks on the Page connected to that Instagram Business or Creator Account.
進一步開發您的應用程序,使其可以成功使用所需的任何其他端點,并跟蹤每個端點所需的權限
完成應用程序審核過程并請求批準您的應用程序所需的所有權限,以便您的應用程序用戶可以在應用程序處于實時模式時為其授予權限
將您的應用切換到實時模式,并將其推銷給潛在用戶
您的應用進入實時模式后,只要您擁有可在連接到該Instagram的頁面上執行任務的Facebook用戶帳戶,就可以使您的應用可用的任何Facebook用戶都可以訪問Instagram業務或創建者帳戶的數據企業或創建者帳戶。
5G媒體 API
版權聲明:本文內容由網絡用戶投稿,版權歸原作者所有,本站不擁有其著作權,亦不承擔相應法律責任。如果您發現本站中有涉嫌抄襲或描述失實的內容,請聯系我們jiasou666@gmail.com 處理,核實后本網站將在24小時內刪除侵權內容。
版權聲明:本文內容由網絡用戶投稿,版權歸原作者所有,本站不擁有其著作權,亦不承擔相應法律責任。如果您發現本站中有涉嫌抄襲或描述失實的內容,請聯系我們jiasou666@gmail.com 處理,核實后本網站將在24小時內刪除侵權內容。