REST API 文档

WordPress 站点健康测试

💡 云策文档标注

概述

本文档介绍了 WordPress 站点健康测试的架构和 REST API 端点,用于检索特定测试记录。它定义了测试记录中的字段,包括测试名称、状态、描述等,并提供了多个示例请求。

关键要点

  • 架构定义了 wp site health test 记录的所有字段,如 test、label、status、badge、description 和 actions。
  • status 字段的可能值为 good、recommended 或 critical,用于指示测试结果。
  • 所有字段均为只读,除非使用 _filter 查询参数或字段仅出现在特定上下文中。
  • 提供了多个 REST API 端点示例,用于检索特定测试记录,如 background-updates、loopback-requests、https-status、dotorg-communication 和 authorization-header。
  • 这些端点使用 GET 方法,无需参数,可通过 curl 命令或类似工具访问。

代码示例

GET /wp-site-health/v1/tests/background-updates
$ curl https://example.com/wp-json/wp-site-health/v1/tests/background-updates

📄 原文内容

Schema

The schema defines all the fields that exist within a wp site health test record. Any response from these endpoints can be expected to contain the fields below unless the `_filter` query parameter is used or the schema field only appears in a specific context.

test The name of the test being run.

JSON data type: string

Read only

Context:

label A label describing the test.

JSON data type: string

Read only

Context:

status The status of the test.

JSON data type: string

Read only

Context:

One of: good, recommended, critical

badge The category this test is grouped in.

JSON data type: object

Read only

Context:

description A more descriptive explanation of what the test looks for, and why it is important for the user.

JSON data type: string

Read only

Context:

actions HTML containing an action to direct the user to where they can resolve the issue.

JSON data type: string

Read only

Context:

Retrieve a Wp Site Health Test

Definition & Example Request

GET /wp-site-health/v1/tests/background-updates

Query this endpoint to retrieve a specific wp site health test record.

$ curl https://example.com/wp-json/wp-site-health/v1/tests/background-updates

There are no arguments for this endpoint.

Retrieve a Wp Site Health Test

Definition & Example Request

GET /wp-site-health/v1/tests/loopback-requests

Query this endpoint to retrieve a specific wp site health test record.

$ curl https://example.com/wp-json/wp-site-health/v1/tests/loopback-requests

There are no arguments for this endpoint.

Retrieve a Wp Site Health Test

Definition & Example Request

GET /wp-site-health/v1/tests/https-status

Query this endpoint to retrieve a specific wp site health test record.

$ curl https://example.com/wp-json/wp-site-health/v1/tests/https-status

There are no arguments for this endpoint.

Retrieve a Wp Site Health Test

Definition & Example Request

GET /wp-site-health/v1/tests/dotorg-communication

Query this endpoint to retrieve a specific wp site health test record.

$ curl https://example.com/wp-json/wp-site-health/v1/tests/dotorg-communication

There are no arguments for this endpoint.

Retrieve a Wp Site Health Test

Definition & Example Request

GET /wp-site-health/v1/tests/authorization-header

Query this endpoint to retrieve a specific wp site health test record.

$ curl https://example.com/wp-json/wp-site-health/v1/tests/authorization-header

There are no arguments for this endpoint.