All Projects → woosignal → wp-json-api-flutter

woosignal / wp-json-api-flutter

Licence: BSD-2-Clause license
WordPress and WooCommerce JSON API for Flutter Mobile. Register Users, Login (with email or username), Get Users Info, Update Users Info, Update Users Password + more.

Programming Languages

dart
5743 projects

Projects that are alternatives of or similar to wp-json-api-flutter

WooCommerceConnector
A Power BI Custom Connector for WooCommerce
Stars: ✭ 27 (+12.5%)
Mutual labels:  woocommerce, woocommerce-api
Woocommerce.net
A .NET Wrapper for WooCommerce/WordPress REST API
Stars: ✭ 247 (+929.17%)
Mutual labels:  wordpress-api, woocommerce
WooDroid
Simple, robust Woocommerce API sdk for java and android
Stars: ✭ 77 (+220.83%)
Mutual labels:  woocommerce, woocommerce-api
DouMao iOS
wordpress博客移动iOS版,点击链接了解更多:
Stars: ✭ 22 (-8.33%)
Mutual labels:  wordpress-api, json-api
Intervention
WordPress plugin to configure wp-admin and application state using a single config file.
Stars: ✭ 481 (+1904.17%)
Mutual labels:  wordpress-api, woocommerce
wc-api-java
Java wrapper for WooCommerce REST API
Stars: ✭ 82 (+241.67%)
Mutual labels:  woocommerce, woocommerce-api
xml-to-json
Simple API that converts dynamic XML feeds to JSON through a URL or pasting the raw XML data. Made 100% in PHP.
Stars: ✭ 38 (+58.33%)
Mutual labels:  json-api
api-test
🌿 A simple bash script to test JSON API from terminal in a structured and organized way.
Stars: ✭ 53 (+120.83%)
Mutual labels:  json-api
json-server
Create a dummy REST API from a json file with zero coding in seconds
Stars: ✭ 34 (+41.67%)
Mutual labels:  json-api
antony-nuxt
👏 Codes that Power ouorz.com | A Tiny Little Nuxt.js + WP REST API App 博客前端
Stars: ✭ 21 (-12.5%)
Mutual labels:  wordpress-api
woocommerce-filter-orders
Filters WooCommerce orders by coupon used -- view only orders in which a certain coupon was used.
Stars: ✭ 41 (+70.83%)
Mutual labels:  woocommerce
sublime-text-2-wpseek
wpseek.com WordPress Developer Assistant for Sublime Text 2 / 3
Stars: ✭ 19 (-20.83%)
Mutual labels:  wordpress-api
json-api-server
A JSON:API server implementation in PHP.
Stars: ✭ 43 (+79.17%)
Mutual labels:  json-api
ErpNet.FP
ErpNet.FP is a light-weight cross-platform Http server facilitating printing to fiscal printers through simple JSON Api.
Stars: ✭ 75 (+212.5%)
Mutual labels:  json-api
json-caching-proxy
Node caching HTTP proxy built on top of express-http-proxy. Persists requests and responses to an in-memory HAR-like data structure based on HAR1.2 . Caches JSON content-type responses by default with the ability to cache an entire site; including content-types describing images. Useful for testing front end code, mocking api, and saving the cac…
Stars: ✭ 31 (+29.17%)
Mutual labels:  json-api
WPGlobus
WPGlobus is a family of WordPress plugins assisting you in making bilingual / multilingual WordPress blogs and sites. This is a development repository. The stable version is on WordPress.org.
Stars: ✭ 40 (+66.67%)
Mutual labels:  woocommerce
woocommerce-simplify-payment-gateway-plugin
WooCommerce Payment Gateway plugin from Simplify Commerce
Stars: ✭ 28 (+16.67%)
Mutual labels:  woocommerce
yllet
Yllet is a set of packages for the WordPress API for both React and non-React projects
Stars: ✭ 46 (+91.67%)
Mutual labels:  wordpress-api
Hypermarket
If you are looking for a stylish and elegant website template for your online store, Hypermarket is the perfect choice for you.
Stars: ✭ 49 (+104.17%)
Mutual labels:  woocommerce
laravel-json-api
Integrate JSON:API resources on Laravel
Stars: ✭ 17 (-29.17%)
Mutual labels:  json-api

WordPress and WooCommerce JSON API Dart package for Flutter

Official WooSignal package

API features:

WordPress

  • Register/Sign Up API for Users
  • Login (with email or username)
  • Get Users Info
  • Update Users Info
  • Update Users Password
  • Add role to a user
  • Remove role from a user
  • Delete a user

WooCommerce

  • Get Customers Info (Billing and Shipping)
  • Update Customers details

To use this API you must have the WP JSON API Plugin installed first on your WordPress site, you can download it via the WooSignal website.

Getting Started

In your flutter project add the dependency:

dependencies:
  ...
  wp_json_api: ^3.2.0

Usage example

Import wp_json_api.dart

import 'package:wp_json_api/wp_json_api.dart';

Example using Wp JSON API

import 'package:wp_json_api/wp_json_api.dart';
...

void main() {

WPJsonAPI.instance.initWith(baseUrl: "https://mysite.com");

...

Call a method from the request callback

try {
WPUserLoginResponse wpUserLoginResponse = await WPJsonAPI.instance
          .api((request) => request.wpLogin(
            email: email,
            password: password
          ));
} on Exception catch (e) {
    print(e);
}

Available API Requests

WordPress - Get Nonce

  • Used for returning a valid nonce
WPNonceResponse wpNonceResponse = await WPJsonAPI.instance
          .api((request) => request.wpNonce());

WordPress - Verify Nonce

  • Used for verifying register and login request
WPNonceVerifiedResponse wpNonceVerifiedResponse = await WPJsonAPI.instance
          .api((request) => request.wpNonceVerify(
            nonce: nonce
          ));

WordPress - Login with email

  • Used to login a user
WPUserLoginResponse wpUserLoginResponse = await WPJsonAPI.instance
      .api((request) => request.wpLogin(
          email: email,
          password: password,
          authType: WPAuthType.WpEmail
      ));

WordPress - Login with username

  • Used to login a user
WPUserLoginResponse wpUserLoginResponse = await WPJsonAPI.instance
      .api((request) => request.wpLogin(
          username: username,
          password: password,
          authType: WPAuthType.WpUsername
      ));

WordPress - Register

  • Used to register a user
  • The username parameter is required, ensure that this is unique
WPUserRegisterResponse wpUserRegisterResponse = await WPJsonAPI.instance
      .api((request) => request.wpRegister(
          email: email,
          password: password,
          username: username
      ));

WordPress - Get Users Info

  • Used to get a WordPress users info
  • The first parameter is the userToken which is returned from the login/register response. You should have this saved somewhere e.g. shared_pref
WPUserInfoResponse wpUserInfoResponse = await WPJsonAPI.instance
        .api((request) => request.wpGetUserInfo(
            userToken
          ));

WordPress - Update Users Info

  • Used to update a WordPress users info
  • The first parameter is the userToken which is returned from the login/register response. You should have this saved somewhere e.g. shared_pref
WPUserInfoUpdatedResponse wpUserInfoUpdatedResponse = await WPJsonAPI.instance
        .api((request) => request.wpUpdateUserInfo(
          userToken,
          firstName: firstName,
          lastName: lastName,
          displayName: displayName
      ));

WordPress - Update users password

  • Used to update a users password
  • The first parameter is the userToken which is returned from the login/register response. You should have this saved somewhere e.g. shared_pref
WPUserResetPasswordResponse wpUserResetPasswordResponse = await WPJsonAPI.instance
        .api((request) => request.wpResetPassword(
            userToken,
            password: password
        ));

WordPress - Add a role to a user

  • Used to add a role to a user in WordPress
  • The first parameter is the userToken which is returned from the login/register response. You should have this saved somewhere e.g. shared_pref
WPUserAddRoleResponse wpUserAddRoleResponse = await WPJsonAPI.instance
        .api((request) => request.wpUserAddRole(
            userToken,
            role: "customer" // e.g. customer, subscriber
        ));

WordPress - Remove a role from a user

  • Used to remove a role from a user in WordPress
  • The first parameter is the userToken which is returned from the login/register response. You should have this saved somewhere e.g. shared_pref
WPUserRemoveRoleResponse wpUserRemoveRoleResponse = await WPJsonAPI.instance
        .api((request) => request.wpUserRemoveRole(
            userToken,
            role: "customer" // e.g. customer, subscriber
        ));

WordPress - Delete a user

  • Used to delete a user in WordPress
  • The first parameter is the userToken which is returned from the login/register response. You should have this saved somewhere e.g. shared_pref
  • You can pass an optional argument 'reassign' to reassign posts and links to new User ID.
WPUserDeleteResponse wpUserDeleteResponse = await WPJsonAPI.instance
        .api((request) => request.wpUserDelete(
            userToken
        ));

WooCommerce - Get users info in WooCommerce

  • Used to get WooCommerce info for a given user
  • The first parameter is the userToken which is returned from the login/register response. You should have this saved somewhere e.g. shared_pref
WCCustomerInfoResponse wcCustomerInfoResponse = await WPJsonAPI.instance
          .api((request) => request.wcCustomerInfo(
          userToken
      ));

WooCommerce - Update users info in WooCommerce

  • Used to update a users WooCommerce details
  • All the parameter are optional so if you wanted to just update the name, you could just add first_name and last_name
  • The first parameter is the userToken which is returned from the login/register response. You should have this saved somewhere e.g. shared_pref
WCCustomerUpdatedResponse wcCustomerUpdatedResponse = await WPJsonAPI.instance
        .api((request) => request.wcUpdateCustomerInfo(
            userToken,
            firstName: firstName,
            lastName: lastName,
            displayName: displayName,
            billingFirstName: billingFirstName,
            billingLastName: billingLastName,
            billingCompany: billingCompany,
            billingAddress1: billingAddress1,
            billingAddress2: billingAddress2,
            billingCity: billingCity,
            billingState: billingState,
            billingPostcode: billingPostcode,
            billingCountry: billingCountry,
            billingEmail: billingEmail,
            billingPhone: billingPhone,
            shippingFirstName: shippingFirstName,
            shippingLastName: shippingLastName,
            shippingCompany: shippingCompany,
            shippingAddress1: shippingAddress1,
            shippingAddress2: shippingAddress2,
            shippingCity: shippingCity,
            shippingState: shippingState,
            shippingPostcode: shippingPostcode,
            shippingCountry: shippingCountry,
            shippingEmail: shippingEmail,
            shippingPhone: shippingPhone
        ));

For help getting started with WooSignal, view our online documentation, which offers a more detailed guide.

Usage

To use this plugin, add wp_json_api as a dependency in your pubspec.yaml file.

Note

Install our WordPress plugin "WP JSON API" v3.2.0 to use this flutter plugin.

Disclaimer: This plugin is not affiliated with or supported by Automattic, Inc. All logos and trademarks are the property of their respective owners.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].