admin管理员组

文章数量:1419905

I am trying to delete a media object from my Wordpress instance using the Wordpress API in Postman.

I'm having trouble finding the endpoint according to the documentation.

Here is my http method and route:

DELETE {{site}}/wp-json/wp/v2/media/{{mediaId}}?force=1

I keep getting route not found however:

{
    "code": "rest_no_route",
    "message": "No route was found matching the URL and request method",
    "data": {
        "status": 404
    }
}

This is how I'm trying to call it generated in curl:

curl -X DELETE \
  http://<site>/<subsite>/wp-json/wp/v2/media/?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: <Host IP>' \
  -H 'Postman-Token: <Postman-Token>' \
  -H 'User-Agent: PostmanRuntime/7.15.2' \
  -H 'cache-control: no-cache' \

Following the documentation for the delete endpoint.

/

本文标签: Deleting media using the Wordpress Rest API