Webflow應用程式介面簡介

使用 Webflow 的 API 建立應用程式或以程式設計方式管理靜態和動態網站內容。

Application programming interfaces (APIs) facilitate interaction between different software applications. Webflow’s APIs offer the ability to link external services, enhance Webflow’s primary functionalities, and develop cutting-edge solutions for designers and developers. 

Pro-tip: If you lack coding skills, there are tools like Integrately, 製作, or Zapier, which enable integrating Webflow with a vast array of third-party applications — without needing to deal directly with APIs or write code. 

本教學將涵蓋以下主題: 

  1. Possible uses of Webflow’s APIs 
  2. Steps to generate an API token 
  3. Creating a webhook 

Exploring Webflow’s API Possibilities 

Webflow’s APIs cater to diverse scenarios: 

  • Sites API — for retrieving site information 
  • Pages API — for fetching page details and related metadata 
  • Assets API — to manage assets in Webflow’s Asset panel, assign assets to folders, or list existing assets 
  • CMS API — for CRUD operations on CMS Collections and Collection items 
  • Ecommerce API — for CRUD operations on Ecommerce products and orders 
  • User Accounts API — to manage User Accounts 
  • Forms API — for form structure and submissions, connecting forms to external data sources 
  • Custom Code API — to add and handle custom scripts 
  • Designer APIs — for direct interaction with the Designer canvas, including managing elements, styles, and components 

Webhooks can also be set up to enable Webflow to communicate with third-party applications. Learn more about the capabilities of Webflow’s APIs 這裡

Creating an API Token 

Accessing Webflow’s APIs necessitates an access token for authentication purposes, obtainable via OAuth or by generating a site API token. 

For internal projects, generating a site API token can fast-track the process. However, for projects meant for wider use, employing a Webflow App for OAuth authentication is recommended. 

This section will guide you on producing an API token to replace passwords in API use. Just like passwords, an API token (also known as an “API key” or “access token”) identifies the requesting site or application. API tokens are also equipped with permissions (“scopes”) that outline and govern their capabilities. 

筆記: API tokens will expire after 365 days of inactivity.

To generate an API token: 

  1. 導航 站點設定 > 應用程式和集成 選項卡 > API存取
  2. 點選 Generate API token 
  3. 輸入一個 姓名 for your API token
  4. Select the desired permissions for each Webflow API (such as no access, read-only, or read and write)
  5. 點選 Generate token
  6. Copy the generated token to your clipboard

重要的: Securely store your API token as it contains personal and sensitive information, akin to passwords. Once created, the token cannot be viewed in your Dashboard again. Concerned about a compromised token? Generate a new one by visiting 站點設定 > 應用程式和集成 選項卡 > API存取, and then replace the compromised token in any third-party connections. 

Establishing a Webhook 

Webhooks serve to transmit live data from Webflow to external applications upon specific site events. Learn more about available webhook events from our developer documentation 這裡

To set up a webhook: 

  1. 使用權 站點設定 > 應用程式和集成 選項卡 > Webhooks
  2. 點選 Add webhook 
  3. Choose the trigger type (e.g., Form submission, Site publish, etc.) 
  4. Select the API version (e.g., v1 or v2)
  5. Insert the webhook URL (e.g., https://yourdomain.com/webhook/webflow)
麥伊凡
Ewan Mak 的最新帖子 (看全部)