售 价:¥
温馨提示:数字商品不支持退换货,不提供源文件,不支持导出打印
为你推荐
Learning WordPress REST API
Learning WordPress REST API
Credits
About the Authors
Acknowledgments
About the Reviewer
www.PacktPub.com
Why subscribe?
Free access for Packt account holders
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Errata
Piracy
Questions
1. Getting Started with REST API
Introducing REST API
Defining API
Defining REST
Defining JSON
Using REST API in real-world applications
Advantages of REST services
Key considerations when working with REST
Architectural components in REST
Design principles in REST
Getting started with REST implementation
Passing commands in SOAP versus REST
Handling data in REST
Using REST in different programming languages
Ruby
Python
Perl
C#
Java
PHP
JavaScript
REST API in WordPress
Universality
Remote management
Third-party support
Summary
2. Interacting with REST API in WordPress
Getting started
Issuing requests via Postman
HTTP API in WordPress
Fetching GET post output in JSON objects
Issuing queries
Interacting REST API via PHP
Explanation of function
Issuing POST requests
Implementing GET meta fields using REST API in WordPress
Implementing POST meta fields using REST API in WordPress
Summary
3. Working with Taxonomies and Users with REST API
Working with taxonomies in WordPress using REST API
Basics
HTTP requests
Implementing REST API and JavaScript with taxonomies
How to send GET requests for taxonomies
How to send POST requests for taxonomies
Working with users in WordPress using REST API
How to GET user data using REST API in WordPress
GET public user data
GET privileged user data
How to POST (and edit) user data using REST API in WordPress
Summary
4. Working with Forms Using REST API
Overview
Fundamentals
Setting up the plugin
Creating the form with HTML markup
Enqueueing your JavaScript file
Issuing requests for creating posts
OAuth authorization method
Issuing requests for editing posts
Summary
5. Custom Routes in WordPress REST API
Overview
Adding custom routes to WordPress REST API
Setting up the custom route
Route namespace
URL after namespace
Endpoints to a route
Optional Boolean argument
Setting up the custom endpoints
Transport method
Defining our fields
The callback function
The permissions callback
Processing requests (and responses)
WP_Query
WPDB
get_post_meta
Third-party plugins
Summary
6. Creating a Simple Web App using WordPress REST API
Overview
Setting up your WordPress site
Cross origin problems and bugs
Handling multiple requests
Optimization measures
Steps to disable the default routes
More about WP REST API
The REST architecture
HTTP verbs
Endpoints and routes
JSON REST API for WordPress
JSON REST APIs in WordPress
WP REST API at the moment
Tools
Installing the plugin
Going further
WP REST API – setting up and using basic authentication
Authentication
WP REST API authentication
Basic authentication
Installing the plugin
Postman requests
Authenticated requests from the command line
JavaScript authenticated requests
WP HTTP API for authenticated requests
Status check
WP REST API - setting up and using advanced authentication
OAuth authentication
OAuth security concerns
OAuth 2.0
OAuth authentication flow
Oauth_callback function
OAuth_verifier function
OAuth installation
Assessing the availability of the OAuth API
Application management
Generating OAuth credentials
User authorization
Token exchange
Status check
WP REST API - retrieving data
The GET request
Options request
Retrieving posts from the server
The filter[] syntax
Post revisions, categories, tags, and meta
Other resources
Status check
WP REST API: creating and editing posts
CRUD methods in routes
Creating and updating posts
Creating and updating post meta
Creating and updating data
Sending data as URL parameters
Sending data as a JSON object
Sending data using forms
Uploading media via multipart/form-data
Deleting data
Status check
WP REST API: internals and customization
Internal classes and methods of WP REST API
Infrastructure classes
WP_REST_Server
WP_REST_Request
WP_REST_Response
Modifying server responses
The register_rest_field()
Summary
7. Mastering REST API for Your Projects
Backward compatibility
A universal API
Architectural structure
REST architectural constraints
The formal REST constraints
Stateless
Client-server
Layered system
Cacheable
Code on demand
Uniform interfaces
Resource identification
Representation and resources
Self-descriptive messages
HATEOS
Ever-growing REST API
REST API as a platform
Implementing REST API in apps
Custom data types in WordPress
REST API in later versions of WordPress
REST API and WordPress plugin development
REST API-based authentication
OAuth authentication
Basic authentication
Cookie authentication
REST API and security
REST API being used in WordPress plugins
Overview
Disabling REST API
Summary
8. WordPress REST API in Practice
Key differences between v1 and v2 of the plugin
Internal changes
External changes
Future changes
Functions of APIs
The REST API in theory
A guide to HTTP and REST
HTTP
HTTP client libraries
The WordPress REST API
The JSON REST API
Developers of WP REST API
Overall description
JSON
JavaScript
WP REST API and JavaScript
XML-RPC in WordPress
REST API revenue sources
Mobile applications
Wearable devices
SaaS services
Third-party apps
Web services
Competing architectures on the Web
RESTful architectures
RPC architectures
Combination of REST and RPC
Overview of architectures
JavaScript and WordPress
AJAX in WordPress
Things to consider when using REST API
Interacting with databases using REST API
Doing more with REST API
Current status of REST API
WordPress features
REST API conclusion
Progressive enhancement of WP REST API
WordPress Calypso and the REST API
Securing a REST API
OAuth protocol
WordPress API and regular users
Building your own API
Drawbacks of a custom API
REST API management
Implementation of custom services for REST API
Integration of REST API with mobile applications
Standards for custom REST APIs
Custom API tokens
Summary
9. Summing It Up
Comparison of REST API with XML-RPC
RPC versus REST
Keypoints
Disadvantages of XML-RPC
XML-RPC usage in WordPress
Usage of XML RPC
REST API token-based authentication
Making sure your apps and sites are backward-compatible
Backward compatibility in practice
New functionality
Preventing script breaking
The future of REST API
What will happen with REST in the future?
PHP and WordPress
Mobile integration
The backend
REST API plugin versions
Goals for REST API
Limitations of REST API
Summary
买过这本书的人还买过
读了这本书的人还在读
同类图书排行榜