Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change user password using woocommerce rest api in Android

I am using woocommerce rest API to build an e commerce Android application.

I want to implement the change password using woocommerce rest API ,I have refer this link

https://woocommerce.github.io/woocommerce-rest-api-docs/ but it is not working.

How I can implement change password?

like image 418
maulik Avatar asked Nov 07 '22 23:11

maulik


1 Answers

I had the same problem using Ionic3 for building an App with woocommerce as backend.

The following code worked for me, but you need to find a way to figure out the customer 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)
    })
}
like image 154
Luis Carlos Mejia Avatar answered Nov 15 '22 07:11

Luis Carlos Mejia