woocommerce REST API通过电子邮件获取客户

时间:2017-12-02 21:03:33

标签: woocommerce-rest-api

通过电子邮件获取客户

https://localhost/biobays/wp-json/wc/v2/customers/2通过id获取客户正在运作。但 https://localhost/biobays/wp-json/wc/v2/customers/email/test@t.comhttps://localhost/biobays/wp-json/wc/v2/customers?email=test@t.com无效

我希望能够检索用户信息。

我的回复是空的。

PS:这项工作非常适用于旧版本v3 https://localhost/biobays/wc-api/v3/customers/email/test@t.com

1 个答案:

答案 0 :(得分:3)

乔, 我做了一点测试,这是你需要对API做的调用:

$params = array("email" => "test@t.com");
$getContact = $wcApi->get('customers',$params);

echo "<pre>";
print("<pre>".print_r($getContact , true)."</pre>");
echo"</pre>";

如果您要测试网址,请按以下方式拨打电话:

https://localhost/biobays/wp-json/wc/v2/customers?email=test%40t.com&consumer_key=YOUR_CONSUMER_KEY&consumer_secret=YOUR_CONSUMER_SECRET

如果不存在电子邮件,则返回一个空数组。

相关问题