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

时间:2017-04-18 04:30:15

标签: android wordpress woocommerce-rest-api

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

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

https://woocommerce.github.io/woocommerce-rest-api-docs/  但它没有用。

我如何实施更改密码?

1 个答案:

答案 0 :(得分:0)

使用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)
    })
}