万本电子书0元读

万本电子书0元读

顶部广告

Learning WordPress REST API电子书

售       价:¥

4人正在读 | 0人评论 9.8

作       者:Sufyan bin Uzayr

出  版  社:Packt Publishing

出版时间:2016-07-01

字       数:140.1万

所属分类: 进口书 > 外文原版书 > 电脑/网络

温馨提示:数字商品不支持退换货,不提供源文件,不支持导出打印

为你推荐

  • 读书简介
  • 目录
  • 累计评论(0条)
  • 读书简介
  • 目录
  • 累计评论(0条)
A practical tutorial to get you up and running with the revolutionary WordPress REST API About This Book Learn how to run the latest WordPress REST API with various platforms Create exciting apps and manage non-WordPress content with them Secure, export, and manage your data through illustrative examples Who This Book Is For This book is for WordPress developers and designers who want to get a complete practical understanding of the WordPress REST API and leverage it to create fully-featured web apps. What You Will Learn Use the WordPress REST API to read, write, and edit posts Create and work with metadata using the WordPress REST API Work with taxonomies using the REST API Add custom routes and build apps using the WordPress REST API Process requests and integrate with external applications and frameworks Make your WordPress projects ready for the RESTful API standard In Detail The WordPress REST API is a recent innovation that has the potential to unlock several new opportunities for WordPress developers. It can help you integrate with technologies outside of WordPress, as well as offer great flexibility when developing themes and plugins for WordPress. As such, the REST API can make developers’ lives easier. The book begins by covering the basics of the REST API and how it can be used along with WordPress. Learn how the REST API interacts with WordPress, allowing you to copy posts and modify post metadata. Move on to get an understanding of taxonomies and user roles are in WordPress and how to use them with the WordPress REST API. Next, find out how to edit and process forms with AJAX and how to create custom routes and functions. You will create a fully-functional single page web app using a WordPress site and the REST API. Lastly, you will see how to deal with the REST API in future versions and will use it to interact it with third-party services. By the end of the book, you will be able to work with the WordPress REST API to build web applications. Style and Approach A step by step tutorial to explain the new and exciting world of the WordPress REST API with the real world examples.
目录展开

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

累计评论(0条) 0个书友正在讨论这本书 发表评论

发表评论

发表评论,分享你的想法吧!

买过这本书的人还买过

读了这本书的人还在读

回顶部