11# WordPress and WooCommerce JSON API Dart package for Flutter
22
3- [ Official WooSignal WordPress/WooCommerce package] ( https://woosignal.com )
3+ [ Official WooSignal package] ( https://woosignal.com )
44
55API features:
66
@@ -15,12 +15,27 @@ API features:
1515 - Get Customers Info (Billing and Shipping)
1616 - Update Customers details
1717
18- To use this API you must have the [ WP Json API Plugin] ( https://woosignal.com/plugins/wordpress/wpapp-json-api ) installed first on your WordPress site, you can download it via the WooSignal website.
18+ To use this API you must have the [ WP Json API Plugin] ( https://woosignal.com/plugins/wordpress/wp-json-api ) installed first on your WordPress site, you can download it via the WooSignal website.
19+
20+ ### Getting Started #
21+ In your flutter project add the dependency:
22+
23+ ``` dart
24+ dependencies:
25+ ...
26+ wp_json_api: ^0.1.0
27+ ```
28+
29+ ### Usage example #
30+ Import wp_json_api.dart
31+ ``` dart
32+ import 'package:wp_json_api/wp_json_api.dart';
33+ ```
1934
2035### Examples using Wp JSON API
2136
2237``` dart
23- import 'package:woosignal /wp_json_api.dart';
38+ import 'package:wp_json_api /wp_json_api.dart';
2439...
2540
2641void main() {
@@ -41,14 +56,14 @@ WPUserLoginResponse wpUserLoginResponse = await WPJsonAPI.instance
4156
4257### Available API Requests
4358
44- ###WordPress - Get Nonce
59+ #### WordPress - Get Nonce
4560- Used for returning a valid nonce
4661``` dart
4762WPNonceResponse wpNonceResponse = await WPJsonAPI.instance
4863 .api((request) => request.wpNonce());
4964```
5065
51- ###WordPress - Verify Nonce
66+ #### WordPress - Verify Nonce
5267- Used for verifying register and login request
5368``` dart
5469WPNonceVerifiedResponse wpNonceVerifiedResponse = await WPJsonAPI.instance
@@ -57,7 +72,7 @@ WPNonceVerifiedResponse wpNonceVerifiedResponse = await WPJsonAPI.instance
5772 ));
5873```
5974
60- ###WordPress - Login with email
75+ #### WordPress - Login with email
6176- Used to login a user
6277
6378``` dart
@@ -69,7 +84,7 @@ WPUserLoginResponse wpUserLoginResponse = await WPJsonAPI.instance
6984 ));
7085```
7186
72- ###WordPress - Login with username
87+ #### WordPress - Login with username
7388- Used to login a user
7489
7590``` dart
@@ -81,9 +96,9 @@ WPUserLoginResponse wpUserLoginResponse = await WPJsonAPI.instance
8196 ));
8297```
8398
84- ###WordPress - Register
99+ #### WordPress - Register
85100- Used to register a user
86- - The username parameter is required, ensure that this is unquie
101+ - The username parameter is required, ensure that this is unique
87102
88103``` dart
89104WPUserRegisterResponse wpUserRegisterResponse = await WPJsonAPI.instance
@@ -94,9 +109,9 @@ WPUserRegisterResponse wpUserRegisterResponse = await WPJsonAPI.instance
94109 ));
95110```
96111
97- ###WordPress - Get Users Info
112+ #### WordPress - Get Users Info
98113- Used to get a WordPress users info
99- - The first parameter is the userToken which is returned from the login/register response. You should have this saved somewhere e.g. shared_pref
114+ - The first parameter is the ** userToken** which is returned from the login/register response. You should have this saved somewhere e.g. shared_pref
100115
101116``` dart
102117WPUserInfoResponse wpUserInfoResponse = await WPJsonAPI.instance
@@ -105,9 +120,9 @@ WPUserInfoResponse wpUserInfoResponse = await WPJsonAPI.instance
105120 ));
106121```
107122
108- ###WordPress - Update Users Info
123+ #### WordPress - Update Users Info
109124- Used to update a WordPress users info
110- - The first parameter is the userToken which is returned from the login/register response. You should have this saved somewhere e.g. shared_pref
125+ - The first parameter is the ** userToken** which is returned from the login/register response. You should have this saved somewhere e.g. shared_pref
111126
112127``` dart
113128WPUserInfoUpdatedResponse wpUserInfoUpdatedResponse = await WPJsonAPI.instance
@@ -119,9 +134,9 @@ WPUserInfoUpdatedResponse wpUserInfoUpdatedResponse = await WPJsonAPI.instance
119134 ));
120135```
121136
122- ###WordPress - Update users password
137+ #### WordPress - Update users password
123138- Used to update a users password
124- - The first parameter is the userToken which is returned from the login/register response. You should have this saved somewhere e.g. shared_pref
139+ - The first parameter is the ** userToken** which is returned from the login/register response. You should have this saved somewhere e.g. shared_pref
125140
126141``` dart
127142WPUserResetPasswordResponse wpUserResetPasswordResponse = await WPJsonAPI.instance
@@ -131,9 +146,9 @@ WPUserResetPasswordResponse wpUserResetPasswordResponse = await WPJsonAPI.instan
131146 ));
132147```
133148
134- ###WooCommerce - Get users info in WooCommerce
149+ #### WooCommerce - Get users info in WooCommerce
135150- Used to get WooCommerce info for a given user, pass in the userToken which you should have stored somewhere safe in shared_pref or other
136- - The first parameter is the userToken which is returned from the login/register response. You should have this saved somewhere e.g. shared_pref
151+ - The first parameter is the ** userToken** which is returned from the login/register response. You should have this saved somewhere e.g. shared_pref
137152
138153``` dart
139154WCCustomerInfoResponse wcCustomerInfoResponse = await WPJsonAPI.instance
@@ -142,10 +157,10 @@ WCCustomerInfoResponse wcCustomerInfoResponse = await WPJsonAPI.instance
142157 ));
143158```
144159
145- ###WooCommerce - Update users info in WooCommerce
160+ #### WooCommerce - Update users info in WooCommerce
146161- Used to update a users WooCommerce details
147162- All the parameter are optional so if you wanted to just update the name, you could just add first_name and last_name
148- - The first parameter is the userToken which is returned from the login/register response. You should have this saved somewhere e.g. shared_pref
163+ - The first parameter is the ** userToken** which is returned from the login/register response. You should have this saved somewhere e.g. shared_pref
149164
150165``` dart
151166WCCustomerUpdatedResponse wcCustomerUpdatedResponse = await WPJsonAPI.instance
@@ -185,4 +200,4 @@ For help getting started with WooSignal, view our
185200## Usage
186201To use this plugin, add ` wp_json_api ` as a [ dependency in your pubspec.yaml file] ( https://flutter.io/platform-plugins/ ) .
187202
188- Disclaimer: This plugin is not affiliated with or supported by Automattic, Inc. All logos and trademarks are the property of their respective owners.
203+ Disclaimer: This plugin is not affiliated with or supported by Automattic, Inc. All logos and trademarks are the property of their respective owners.
0 commit comments