Deleting media using the Wordpress Rest API

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

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.

/

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745298008a4621258.html

相关推荐

  • Deleting media using the Wordpress Rest API

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

    15小时前
    40

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信