REST API 文档

使用 REST API

💡 云策文档标注

概述

本文档介绍了 WordPress REST API 的基本结构,涵盖从全局参数到客户端库的多个核心方面,帮助开发者高效利用 API 进行数据交互。

关键要点

  • 全局参数:学习适用于所有端点的 REST API 查询参数
  • 分页:处理大型资源集合,控制从 REST API 接收的记录数量
  • 链接与嵌入:理解如何读取和修改不同对象间的连接,并在响应中嵌入相关资源(如作者和媒体数据)
  • 发现:确定站点支持的 REST API 资源及其位置
  • 认证:授权 REST API 请求,以实现数据的创建、更新和删除
  • 常见问题解答:查看关于 REST API 的常见疑问并学习解决常见问题
  • 资源与工具:包括 Backbone.js 客户端(用于在 WP-Admin 内交互)和多种编程语言的客户端库

📄 原文内容

These articles explore the basic structure of the WordPress REST API.

Global Parameters: learn about the global REST API query parameters that apply to every endpoint

Pagination: work with large collections of resources & control how many records you receive from the REST API

Linking & Embedding: understand how to read and modify connections between different objects, and embed related resources such as author and media data in the REST API’s responses

Discovery: determine what REST API resources a site supports, and where they are located

Authentication: authorize your REST API requests so that you can create, update and delete your data

Frequently Asked Questions: see some of the most frequent inquiries about the REST API and learn how to solve common problems

Resources & Utilities

Backbone.js Client: interact with the API from within WP-Admin using Backbone models & collections

Client Libraries: utilities in a variety of programming languages that simplify interacting with the API