Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Shopify password update using Shopify API

Tags:

php

api

shopify

Can we update password for a User or Customer that already exists in Shopify using the Shopify API?

like image 342
Pushpender Sharma Avatar asked Mar 04 '16 10:03

Pushpender Sharma


People also ask

How do I update my Shopify API?

Click the app that you want to update. Click App setup. In the Event subscriptions section, from the Event version drop-down list, select an API version. Click Save.


1 Answers

Although the API documentation does not say anything about changing the customer password, you can do actually change the customer password using the PUT /admin/customers/#{id}.json endpoint. Note that my answer is only for customers and not for users.

I have tested it, successfully changed the customer password and log in on the store with the new password. During my tests I used a private app and a normal app both with successful results.

Example:

PUT /admin/customers/5206361102.json

Body:

{
  "customer": {
    "id": 5206361102,
    "password": "mypass2",
    "password_confirmation": "mypass2"
  }
}

If you need the customer id you can use the the GET /admin/customers/search.json end point to find it.

For example you can get the id from the results of this:

GET /admin/customers/search.json?query=email:[email protected]

Result:

{
  "customer": {
    "id": 5206556238,
    ... other parameters ...
  }
}

Thank you to @spviradiya for the comment that pointed me out to this answer, I have tested it and implemented it into my project.

like image 135
Ernesto Andres Gutierrez Avatar answered Oct 26 '22 14:10

Ernesto Andres Gutierrez