admin管理员组

文章数量:1418699

I'm trying to make a Postman call to the Wordpress API to delete a block. However, I keep getting a 403. This user is used to add and delete pages, tags, and posts just fine using the Application Passwords Plugin for authentication. The user is an Administrator.

I have no idea why I don't have permissions. I can delete in the UI.

I suspect I am not adding a needed parameter to the creation call such as context or a template. But I don't know what values those should be. I hope someone here as experience with using Blocks in the REST API.

ERROR:

{
    "code": "rest_cannot_delete",
    "message": "Sorry, you are not allowed to delete this post.",
    "data": {
        "status": 403
    }
}

I'm deleting these blocks using the API with a call like this:

curl -X DELETE \
  'http://<IP_ADDRESS>/<SUBSUTE>/wp-json/wp/v2/blocks/59?force=1' \
  -H 'Accept: */*' \
  -H 'Accept-Encoding: gzip, deflate' \
  -H 'Authorization: Basic <Token>' \
  -H 'Cache-Control: no-cache' \
  -H 'Connection: keep-alive' \
  -H 'Content-Length: ' \
  -H 'Host: <IP>' \
  -H 'Postman-Token: <TOKEN>' \
  -H 'User-Agent: PostmanRuntime/7.15.2' \
  -H 'cache-control: no-cache'

I'm creating these blocks using the API with a call like this:

curl -X POST \
  'http://<SITE>/<SUBSITE>/wp-json/wp/v2/blocks?title=BLOCKS%20TITLE&content=BLOCKS%20CONTENT' \
  -H 'Accept: */*' \
  -H 'Accept-Encoding: gzip, deflate' \
  -H 'Authorization: Basic <TOKEN>' \
  -H 'Cache-Control: no-cache' \
  -H 'Connection: keep-alive' \
  -H 'Content-Length: ' \
  -H 'Host: <IP>' \
  -H 'Postman-Token: <TOKEN>' \
  -H 'User-Agent: PostmanRuntime/7.15.2' \
  -H 'cache-control: no-cache'

本文标签: multisiteBlocks Rest API restcannotdelete