wp_json_api
Flutter 모바일용 워드프레스 및 위즈커머스 JSON API. API를 사용하면 로그인, 새 사용자 등록, 사용자 정보 조회 등이 가능합니다.
Flutter 모바일용 WordPress 및 WooCommerce JSON API. 사용자 등록, 이메일 또는 사용자 이름으로 로그인, 사용자 정보 가져오기, 사용자 정보 업데이트, 사용자 비밀번호 업데이트 + 기타 기능.
^5.9.2^10.0.0^7.17.0{"sdk":"flutter"}^1.19.1^1.0.1{"sdk":"flutter"}^5.6.4^2.13.1아래는 영문 원문 스냅샷입니다. 최신 내용은 GitHub에서 확인하세요.
You can download the WordPress plugin here WP JSON API.
Install the WordPress plugin to use this Flutter package.
WordPress
WooCommerce
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.
In your flutter project add the dependency:
dependencies:
...
wp_json_api: ^4.3.8
Import wp_json_api.dart
import 'package:wp_json_api/wp_json_api.dart';
import 'package:wp_json_api/wp_json_api.dart';
...
void main() {
WPJsonAPI.instance.init(baseUrl: "https://mysite.com");
...
try {
WPUserLoginResponse wpUserLoginResponse = await WPJsonAPI.instance
.api((request) => request.wpLogin(
email: email,
password: password
));
} on Exception catch (e) {
print(e);
}
WPNonceResponse wpNonceResponse = await WPJsonAPI.instance
.api((request) => request.wpNonce());
WPNonceVerifiedResponse wpNonceVerifiedResponse = await WPJsonAPI.instance
.api((request) => request.wpNonceVerify(
nonce: nonce
));
WPUserLoginResponse wpUserLoginResponse = await WPJsonAPI.instance
.api((request) => request.wpLogin(
email: email,
password: password,
authType: WPAuthType.WpEmail
));
WPUserLoginResponse wpUserLoginResponse = await WPJsonAPI.instance
.api((request) => request.wpLogin(
username: username,
password: password,
authType: WPAuthType.WpUsername
));
WPUserRegisterResponse wpUserRegisterResponse = await WPJsonAPI.instance
.api((request) => request.wpRegister(
email: email,
password: password,
// username: username // optional - the library will automatically generate a username if not provided
));
WPUserInfoResponse wpUserInfoResponse = await WPJsonAPI.instance
.api((request) => request.wpGetUserInfo());
WPUserInfoUpdatedResponse wpUserInfoUpdatedResponse = await WPJsonAPI.instance
.api((request) => request.wpUpdateUserInfo(
firstName: firstName,
lastName: lastName,
displayName: displayName
));
WPUserResetPasswordResponse wpUserResetPasswordResponse = await WPJsonAPI.instance
.api((request) => request.wpResetPassword(
password: password
));
WPUserAddRoleResponse wpUserAddRoleResponse = await WPJsonAPI.instance
.api((request) => request.wpUserAddRole(
role: "customer" // e.g. customer, subscriber
));
WPUserRemoveRoleResponse wpUserRemoveRoleResponse = await WPJsonAPI.instance
.api((request) => request.wpUserRemoveRole(
role: "customer" // e.g. customer, subscriber
));
WPUserDeleteResponse wpUserDeleteResponse = await WPJsonAPI.instance
.api((request) => request.wpUserDelete());
WPUserRegisterResponse wpUserRegisterResponse = await WPJsonAPI.instance
.api((request) => request.wpRegister(
email: email,
password: password
));
WCCustomerInfoResponse wcCustomerInfoResponse = await WPJsonAPI.instance
.api((request) => request.wcCustomerInfo(
userToken
));
WCCustomerUpdatedResponse wcCustomerUpdatedResponse = await WPJsonAPI.instance
.api((request) => request.wcUpdateCustomerInfo(
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
));
WcPointsAndRewardUser wcPointsAndRewardUser = await WPJsonAPI.instance
.api((request) => request.wcPointsAndRewardsUser());
WcPointsAndRewardCalculatePoints wcPointsAndRewardsCalculatePoints = await WPJsonAPI.instance
.api((request) => request.wcPointsAndRewardsCalculatePoints(
points: 100
));
For help getting started with WooSignal, view our online documentation, which offers a more detailed guide.
To use this plugin, add wp_json_api as a dependency in your pubspec.yaml file.
Install our WordPress plugin "WP JSON API" v3.4.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.