本文档详细介绍了 WordPress REST API 中应用密码的架构和端点操作。应用密码用于通过 API 进行身份验证,支持创建、检索、更新和删除操作。
GET /wp/v2/users/<user_id>/application-passwords
$ curl https://example.com/wp-json/wp/v2/users/<user_id>/application-passwords
POST /wp/v2/users/<user_id>/application-passwords
参数:app_id(UUID v5 推荐)、name(必需)
DELETE /wp/v2/users/<user_id>/application-passwords/<uuid>
$ curl -X DELETE https://example.com/wp-json/wp/v2/users/<user_id>/application-passwords/<uuid>The schema defines all the fields that exist within a application password 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.
uuid
|
The unique identifier for the application password.
JSON data type: string, Read only Context: |
app_id
|
A UUID provided by the application to uniquely identify it. It is recommended to use an UUID v5 with the URL or DNS namespace.
JSON data type: string, Context: |
name
|
The name of the application password.
JSON data type: string Context: |
password
|
The generated password. Only available after adding an application.
JSON data type: string Read only Context: |
created
|
The GMT date the application password was created.
JSON data type: string, Read only Context: |
last_used
|
The GMT date the application password was last used.
JSON data type: string or null, Read only Context: |
last_ip
|
The IP address the application password was last used by.
JSON data type: string or null, Read only Context: |
GET /wp/v2/users/<user_id>)/application-passwords
Query this endpoint to retrieve a specific application password record.
$ curl https://example.com/wp-json/wp/v2/users/<user_id>)/application-passwords
context
|
Scope under which the request is made; determines fields present in response.
Default: One of: |
<a href="#schema-app_id">app_id</a>
|
A UUID provided by the application to uniquely identify it. It is recommended to use an UUID v5 with the URL or DNS namespace. |
<a href="#schema-name">name</a>
|
The name of the application password.
Required: 1 |
POST /wp/v2/users/<user_id>)/application-passwords
There are no arguments for this endpoint.
DELETE /wp/v2/users/<user_id>)/application-passwords
$ curl -X DELETE https://example.com/wp-json/wp/v2/users/<user_id>)/application-passwords
GET /wp/v2/users/<user_id>)/application-passwords/introspect
Query this endpoint to retrieve a specific application password record.
$ curl https://example.com/wp-json/wp/v2/users/<user_id>)/application-passwords/introspect
context
|
Scope under which the request is made; determines fields present in response.
Default: One of: |
GET /wp/v2/users/<user_id>)/application-passwords/<uuid>
Query this endpoint to retrieve a specific application password record.
$ curl https://example.com/wp-json/wp/v2/users/<user_id>)/application-passwords/<uuid>
context
|
Scope under which the request is made; determines fields present in response.
Default: One of: |
<a href="#schema-app_id">app_id</a>
|
A UUID provided by the application to uniquely identify it. It is recommended to use an UUID v5 with the URL or DNS namespace. |
<a href="#schema-name">name</a>
|
The name of the application password. |
POST /wp/v2/users/<user_id>)/application-passwords/<uuid>
There are no arguments for this endpoint.
DELETE /wp/v2/users/<user_id>)/application-passwords/<uuid>
$ curl -X DELETE https://example.com/wp-json/wp/v2/users/<user_id>)/application-passwords/<uuid>