0 purchases
wordpress api
WordPress REST API client for Dart | Flutter #
Description #
A WordPress REST API client for dart with support for WooCommerce and custom namespaces/endpoints.
Features #
Retrieve data from standard WordPress endpoints.
Retrieve data from any custom namespace
Installation #
In the dependencies: section of your pubspec.yaml, add the following line:
dependencies:
wordpress_api: <latest_version>
copied to clipboard
Usage #
Import the package
import 'package:wordpress_api/wordpress_api';
copied to clipboard
Initialize WPAPI
WordPressAPI api = WordPressAPI('wp-site.com');
copied to clipboard
Retrieve posts from .posts getter
You can fetch a list of posts by simply calling .posts. More arguments can be passed to further filter the data returned
void main() async {
final api = WordPressAPI('wp-site.com');
final WPResponse res = await api.posts.fetch();
for (final post in res.data) {
print(post.title);
}
}
copied to clipboard
As of v0.3.0, you can query a single post from the same endpoint by passing an id
void main() async {
final api = WordPressAPI('wp-site.com');
final WPResponse res = await api.posts.fetch(id: 1);
print(res.data.title);
}
copied to clipboard
Retrieve data from a custom endpoint
void main() async {
final api = WordPressAPI('wp-site.com');
final WPResponse res = await api.get(endpoint: 'your-custom-endpoint');
print(res.data);
}
copied to clipboard
ToDo #
Authentication using Application Passwords. WordPress 5.6+ only
Fully integrated WooCommerce support.
Full CRUD operations.
Support for other popular WordPress Plugins.
Contributions are welcome, report any issues here
Special Thanks #
WordPress REST API Handbook - Read the Handbank for additional arguments/query parameter.
Contributors ✨ #
Thanks goes to these wonderful people (emoji key):
anKii💻
Kellvem Barbosa💻
NKlage💻 🐛
Elikem (Junior) Medehou💻
Okan Demir💻
This project follows the all-contributors specification. Contributions of any kind welcome!
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.