WC API,无效参数:角色

时间:2018-11-28 09:56:17

标签: wordpress wordpress-rest-api woocommerce-rest-api

运行此请求时,出现无效参数错误。

curl http://localhost/wp-json/wc/v3/customers -u user:pass

错误:

{"code":"rest_invalid_param","message":"Invalid parameter(s): role","data":
{"status":400,"params":{"role":"role is not one of all, administrator, shop_manager, retail, member, wholesale."}}}%

我在     html/wp-includes/rest-api/class-wp-rest-request.php

https://github.com/WordPress/WordPress/blob/91da29d9afaa664eb84e1261ebb916b18a362aa9/wp-includes/rest-api/class-wp-rest-request.php#L803-L812

在我注释掉WP_Error之后,请求正常运行。停用其他woocommerce插件后,仍然出现此错误。有什么想法吗?

1 个答案:

答案 0 :(得分:0)

我找到了解决方案。它正在寻找值为customer的角色。我删除了创建客户角色后,该错误消失了。