在Android中使用woocommerce rest api更改用户密码

mau*_*lik 5 wordpress android woocommerce-rest-api

我正在使用woocommerce rest API来构建电子商务Android应用程序.

我想使用woocommerce rest API实现更改密码,我已经参考了这个链接

https://woocommerce.github.io/woocommerce-rest-api-docs/ 但它不起作用.

我如何实现更改密码?

小智 1

我使用 Ionic3 构建以 woocommerce 作为后端的应用程序时遇到了同样的问题。

以下代码对我有用,但您需要找到一种方法来找出客户 ID。

updateCustomer(){
    this.customer.id=YOUR_CUSTOMER_ID;
    this.customer.password = NEW_PASSWORD;
    this.WooCommerce.putAsync("customers/" + this.customer.id, {customer: this.customer}).then((res)=>{
      if(JSON.parse(res.body).customer){
        console.log('customer updated');
      }
    }, (err)=>{
      console.log(err.body)
    })
}
Run Code Online (Sandbox Code Playgroud)