maulik
maulik

Reputation: 150

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?

Upvotes: 5

Views: 1699

Answers (1)

Luismejiadev
Luismejiadev

Reputation: 188

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

Upvotes: 1

Related Questions