【问题标题】:wordpress rest api acting like no data is sentwordpress rest api 就像没有发送数据一样
【发布时间】:2017-09-03 08:25:23
【问题描述】:

我正在尝试使用 wordpress rest api 创建一个帖子。使用 curl 和 postman 我得到以下响应。

{"code":"empty_content","message":"Content, title, and excerpt are empty.","data":{"status":400}}

我的 curl 命令是

curl -X POST --user admin:secret http://mysite.local/wp-json/wp/v2/posts/ -d '{"post_title":"My New Title","Content":"the stuff","excerpt":"something"}'

我知道我必须在这里遗漏一些基本的东西。它的行为就像没有发布数据到达它。有什么想法吗?

【问题讨论】:

    标签: wordpress api curl


    【解决方案1】:

    我遇到了同样的问题并通过添加以下选项解决了它

    -H "Content-Type: application/json"

    【讨论】:

    • 当我们评论说...时,SO 不喜欢它,这很愚蠢。天哪,谢谢!!!
    猜你喜欢
    • 1970-01-01
    • 2019-10-14
    • 2019-05-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-10-12
    • 2019-01-23
    • 1970-01-01
    相关资源
    最近更新 更多