https://github.com/elbatanony/webflow_api
A Webflow CMS API Dart package
https://github.com/elbatanony/webflow_api
dart webflow
Last synced: 4 months ago
JSON representation
A Webflow CMS API Dart package
- Host: GitHub
- URL: https://github.com/elbatanony/webflow_api
- Owner: ElBatanony
- License: mit
- Created: 2022-07-24T20:56:15.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2023-08-29T17:01:43.000Z (over 2 years ago)
- Last Synced: 2025-03-23T21:08:56.670Z (about 1 year ago)
- Topics: dart, webflow
- Language: Dart
- Homepage:
- Size: 16.6 KB
- Stars: 1
- Watchers: 1
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Webflow API
This Webflow API package is aimed to facilitate communicating with the Webflow Content Management System (CMS).
The package could be used to develop admin apps to manage Webflow sites' content, e.g., blogs, events.
The package communicates with the Webflow API via the HTTPS methods.
The design of the package is inspired by the official [Webflow API npm package](https://www.npmjs.com/package/webflow-api).
This package is not officially supported by Webflow.
## Features
The package provides functions to:
- Fetch collections
- Fetch a collection by collection ID
- Fetch items in a collection
- Fetch a collection item by item ID
- Create a new collection item
- Delete a collection item
- Update the fields of an item
## Getting started
To set up the package, first install the package.
```cmd
flutter pub add webflow_api
```
1. Then generate an Webflow API token.
You can find instructions in the official Webflow documentation [here](https://university.webflow.com/lesson/intro-to-the-webflow-api).
1. Retreive the Webflow project ID (Site ID) from the Webflow project settings dashboard.
1. Set up the Webflow object.
```dart
import 'package:webflow_api/webflow_api.dart';
const siteId = "insert site ID here";
const authToken = "insert auth token here";
void main() async {
Webflow webflow = Webflow(token: authToken, siteId: siteId);
}
```
The official CMS API reference can be found [here](https://developers.webflow.com/).
Note that not all the API methods are currently implemented in this package.
## Usage
### Setup
```dart
const siteId = "insert site ID here";
const authToken = "insert auth token here";
Webflow webflow = Webflow(token: authToken, siteId: siteId);
```
### Fetch all collections
```dart
// Fetch all the CMS Collections
List collections = await webflow.collections();
// Display the ID and fields of the first collection
print(collections[0].id);
print(collections[0].fields);
```
### Fetch Item by ID
```dart
// Fetch an item from a collection by ID
const collectionId = "insert collection ID";
const itemId = "insert item ID";
ItemsResponse fetchedItem = await webflow.item(collectionId: collectionId, itemId: itemId);
// Print fetched item name and slug
print(fetchedItem.items[0].name);
print(fetchedItem.items[0].slug);
```
## Additional information
Package developed by [Ahmed ElBatanony](https://github.com/elbatanony),
as part of a Flutter course at Innopolis University.