wordpress_api 0.3.0 copy "wordpress_api: ^0.3.0" to clipboard
wordpress_api: ^0.3.0 copied to clipboard

outdated

A WordPress REST API client for dart with support for WooCommerce and custom namespaces.

WordPress REST API client for Dart | Flutter #

GitHub stars Pub Build Status Maintenance

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>

Usage #

  • Import the package
import 'package:wordpress_api/wordpress_api';
  • Initialize WPAPI
  WordPressAPI api = WordPressAPI('wp-site.com');
  • Retrieve posts from getPosts

    • You can fetch a list of posts by simply calling .getPosts. More arguments can be passed to further filter the data returned
      void main() async {
        final api = WordPressAPI('wp-site.com');
        final List<Post> posts = await api.getPosts();
        for (final post in posts) {
          print(post.title);
        }
      }
    
    • As of v3.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 Post posts = await api.getPosts(id: 1);
        print(post.title);
      }
      
  • Retrieve data from a custom endpoint

  void main() async {
    final api = WordPressAPI('wp-site.com');
    final WPResponse res = await api.getAsyc(endpoint: 'your-custom-endpoint');
    print(res.data);
  }

ToDo #

  • Support for WP Job Manager.
  • 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 #

99
likes
0
pub points
76%
popularity

Publisher

verified publisherdhmgroup.net

A WordPress REST API client for dart with support for WooCommerce and custom namespaces.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

collection, dio, html, logger

More

Packages that depend on wordpress_api