REST API 文档

扩展 REST API

💡 云策文档标注

概述

本文档为 WordPress 开发者提供扩展 REST API 的指南和资源,涵盖修改响应、添加端点、处理自定义内容类型等核心主题。

关键要点

  • 修改响应:使用 register_meta 或 register_rest_field 向 REST API 响应对象添加字段
  • 添加端点:为插件或应用程序创建自定义 REST API 端点
  • 处理自定义内容类型:学习如何通过 REST API 与自定义文章类型和自定义分类法交互
  • 定义 API 架构:定义 REST API 资源及其参数的架构
  • 术语表:熟悉文档中使用的术语
  • 路由与端点:深入了解 REST API 路由及其提供的端点的细微差别
  • 控制器类:探索如何构建和扩展 REST API 端点控制器类
  • 常见问题解答:查看关于 REST API 的常见问题并学习如何解决常见问题

📄 原文内容

Guides

Modifying responses: add fields to REST API response objects using register_meta or register_rest_field

Adding Endpoints: create custom REST API endpoints for your plugin or application

Working with Custom Content Types: learn how to interact with your custom post types and custom taxonomies through the REST API

Resources

Defining your API Schema: define the schema for your REST API resources and their arguments

Glossary: get up to speed with phrases used throughout our documentation

Routes & Endpoints: dive deeper into the nuances of REST API routes and the endpoints they provide

Controller Classes: discover how to structure and extend REST API endpoint controller classes

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