WP JSON API Plugin v5.0.0
Build with our easy JSON API plugin for WordPress. If you need APIs to log in, register or get an authenticated users info, our plugin supports a wide array of API functionality not only for WordPress Users but WooCommerce Customers too.
API features:
- - Register/Sign Up API for Users
- - Login (with email or username)
- - Get Users Info
- - Update Users Info
- - Update Users Password
- - Logout and Delete a user
- - Get Customers Info (Billing and Shipping)
- - Update Customers details
- - Points and Rewards
WordPress
WooCommerce
Version 5 adds a new API with secure, expiring tokens sent in the request headers, so there is no nonce to fetch. 5.0.0 is a security release, please update if you use an older version.
This plugin is also mobile-friendly so you can build WordPress/WooCommerce functionality into your mobile app.
If the app uses Flutter, you can download our wp_json_api Flutter package from pub.dev. Plugin 5.x works with wp_json_api 5.x.
Once you have installed our plugin you can start calling the new APIs available
An example request to Login
#1 Login with a user
URL[POST]: mysite.com/wp-json/wpapp/v4/auth/login
POST Payload
{
"login": "user@gmail.com", // username or email
"password": "password1"
}
Result
{
"data": {
"token": "3f9c2a7d0b6e41f58a1c9d2e7b4f6a0c...", // Use this to authenticate the user for future api requests
"expires_at": 1768402800,
"user": { "id": 12, "email": "user@gmail.com", ... }
},
"message": "",
"status": 200
}
#2 Get the user's info with the token
URL[GET]: mysite.com/wp-json/wpapp/v4/user
Headers
Authorization: Bearer 3f9c2a7d0b6e41f58a1c9d2e7b4f6a0c...
X-WPApp-Token: 3f9c2a7d0b6e41f58a1c9d2e7b4f6a0c...
Result
{
"data": {
"id": 12,
"username": "user",
"email": "user@gmail.com",
"first_name": "Sam",
"last_name": "Cook",
"roles": ["customer"],
...
},
"message": "",
"status": 200
}
Read full documentation here