douzhaiya3968 2016-10-27 09:09
浏览 362

使用POST和GET时出现WooCommerce Rest API错误

in there i try to use api customers from woocommerce, when i try to use it i always get response : url : http://example.com/wp-json/wc/v1/customers

{
  "code": "woocommerce_rest_cannot_view",
  "message": "Sorry, you cannot list resources.",
  "data": {
    "status": 401
  }
}


{
  "code": "woocommerce_rest_authentication_error",
  "message": "Invalid Signature - provided signature does not match.",
  "data": {
    "status": 401
  }
}

and sometime :

and for create :

{
  "code": "woocommerce_rest_cannot_create",
  "message": "Sorry, you are not allowed to create resources.",
  "data": {
    "status": 401
  }
}

what should i do ?

i already add the key :

here

or i only can have 1 key ? : here

or i need to update one of the script ?

hope, someone can help me to resolve my problem

  • 写回答

1条回答 默认 最新

  • dongxieyou3314 2016-11-01 11:37
    关注

    I have encountered this exact issue, however I have good and bad news from my experience, sometimes the API would shut me out when I had made literally no changes, sometimes rebooting the NGINX server would fix this.

    At the moment my connection with postman and OAuth 1.0 yields the following;

    {
      "code": "woocommerce_rest_cannot_view",
      "message": "Sorry, you cannot list resources.",
      "data": {
        "status": 401
      }
    }
    

    With that our of the way:

    1. Ensure the 'Type' is set to OAuth 1.0 in postman.
    2. Ensure your URL is correct, (http, or https).

    As I said above, I never managed to keep mine stable, and it would drop out without changing a single thing.

    How I solved this was by using 'Basic Auth', Username your_ck, password your_cs. I believe that you need to be using SSL to use Basic Auth but setting up SSL isn't a big deal so it was definitely worth it.

    If you do find out why OAuth 1.0 is failing i'd love to hear.

    EDIT: There are many examples of people with this issue example with image may help you. But it seems most people settle for Basic Auth.

    评论

报告相同问题?

悬赏问题

  • ¥15 如何用stata画出文献中常见的安慰剂检验图
  • ¥15 c语言链表结构体数据插入
  • ¥40 使用MATLAB解答线性代数问题
  • ¥15 COCOS的问题COCOS的问题
  • ¥15 FPGA-SRIO初始化失败
  • ¥15 MapReduce实现倒排索引失败
  • ¥15 ZABBIX6.0L连接数据库报错,如何解决?(操作系统-centos)
  • ¥15 找一位技术过硬的游戏pj程序员
  • ¥15 matlab生成电测深三层曲线模型代码
  • ¥50 随机森林与房贷信用风险模型