📜  PUT wp-json elementor v1 site-editor templates-conditions 23 403(禁止)-任何(1)

📅  最后修改于: 2023-12-03 15:33:49.241000             🧑  作者: Mango

PUT wp-json elementor v1 site-editor templates-conditions 23 403 (禁止) - 介绍

该API的主要作用是更新特定页面的条件属性。但是,在访问此API时,如果用户不具有足够的权限,则会返回403(禁止)状态代码。

请求
终端
PUT wp-json/elementor/v1/site-editor/templates-conditions/23
参数

| 参数 | 描述 | | --------------------- | ------------------------------------------------------------ | | wp-json/elementor/v1/ | 定义API的路由。 | | site-editor/templates-conditions/23 | unique ID of the page to be updated. | | 23 | 要更新的页面的唯一ID。 |

权限要求

要访问此API,用户必须具有编辑该页面的权限。如果用户不具备该权限,则会返回403(禁止)状态代码。

响应
成功响应

如果API调用成功,则将返回以下HTTP状态代码和JSON响应:

HTTP/1.1 200 OK
Content-Type: application/json

{
  "success": true,
  "data": {
    "id": 23,
    "conditions": {
      "include": [
        { "rule": "is_archive", "settings": { "archive": "category" } }
      ]
    }
  }
}
错误响应

如果用户不具备编辑该页面的权限,则API将返回以下HTTP状态代码和JSON响应:

HTTP/1.1 403 Forbidden
Content-Type: application/json

{
  "code": "rest_forbidden",
  "message": "Sorry, you are not allowed to do that.",
  "data": {
    "status": 403
  }
}
示例
要求

我想更新ID为23的页面的条件属性。

请求

我将使用curl命令访问此API:

curl -XPUT -H "Content-Type: application/json" -d '{
  "conditions": {
    "include": [
      { "rule": "url", "settings": { "operator": "contains", "url": "example.com" } }
    ],
    "exclude": []
  }
}' 'example.com/wp-json/elementor/v1/site-editor/templates-conditions/23'
响应

如果API调用成功,则会返回以下JSON响应:

HTTP/1.1 200 OK
Content-Type: application/json

{
  "success": true,
  "data": {
    "id": 23,
    "conditions": {
      "include": [
        { "rule": "url", "settings": { "operator": "contains", "url": "example.com" } }
      ],
      "exclude": []
    }
  }
}

如果API调用未授权,则API将返回以下JSON响应:

HTTP/1.1 403 Forbidden
Content-Type: application/json

{
  "code": "rest_forbidden",
  "message": "Sorry, you are not allowed to do that.",
  "data": {
    "status": 403
  }
}