如何從 Tenor 的 V1 API 遷移
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
如果現有整合項目使用 Tenor 的 V1 API,請按照本頁面的步驟遷移至 V2。
取得 V2 API 金鑰
按照快速入門指南設定步驟中的說明,取得 V2 API 金鑰並取代 V1 版本。
更新至第 2 版網域
將 API 網域更新為 https://tenor.googleapis.com/v2/
。Tenor 的 V2 API 僅支援 HTTPS 連線。請確認應用程式支援從 https://media.tenor.com
和 https://c.tenor.com
下載內容。
舉例來說,假設您對下列其中一個 V1 網域發出 API 呼叫:
https://api.tenor.com/v1/search?<parameters>
https://g.tenor.com/v1/search?<parameters>
如要更新 V2 的呼叫,請將其變更為
https://tenor.googleapis.com/v2/search?<parameters>
。
端點變更
大多數 API 端點參數與 V1 文件中記載的內容相同。但有幾個值得注意的例外情況:
- Tenor 的搜尋端點現在支援透過
searchfilter
參數搜尋貼紙。
- 在 API 呼叫中加入
client_key
和 country
參數。
media_filter
參數現在接受以半形逗號分隔的所需格式清單,而非預設列舉。
- 類別端點現在支援
type
參數的 featured
和 trending
。
- API 不再支援
anon_id
參數。
- 如果沒有更多結果頁面可供要求,API 回應的
next
欄位現在會是空白字串,而不是 "0"
。
可用的端點已進行下列變更:
- 系統不再支援熱門趨勢端點。建議改用精選端點。
- GIF 端點已重新命名為貼文端點。
- 隨機 GIF 端點已透過
random
參數併入搜尋端點。
回應物件和錯誤變更
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-07-25 (世界標準時間)。
[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["缺少我需要的資訊","missingTheInformationINeed","thumb-down"],["過於複雜/步驟過多","tooComplicatedTooManySteps","thumb-down"],["過時","outOfDate","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["示例/程式碼問題","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2025-07-25 (世界標準時間)。"],[],["To migrate from Tenor's V1 to V2 API, obtain a new V2 API key and update API domains to `https://tenor.googleapis.com/v2/`, ensuring support for content downloads from `https://media.tenor.com` and `https://c.tenor.com`. Key endpoint updates include sticker search via `searchfilter`, `client_key` and `country` parameters, comma-separated `media_filter` formats, and changes to Categories. `Trending` is replaced by `Featured`, `GIF` becomes `Posts`, `Random GIF` is under `Search`. Response object changes involve `media` to `media_formats` and updated error codes.\n"]]