In postman, I want to create a customer by post to this url:
https://user:pass@mysite.myshopify.com/admin/customers.json
{ "customer": { "first_name": "Steve", "last_name": "Lastnameson", "email": "steve.lastnameson@example.com", "phone": "+15142546011", "verified_email": true, "addresses": [ { "address1": "123 Oak St", "city": "Ottawa", "province": "ON", "phone": "555-1212", "zip": "123 ABC", "last_name": "Lastnameson", "first_name": "Mother", "country": "CA" } ], "password": "newpass", "password_confirmation": "newpass", "send_email_welcome": false } }
Instead, I got something like this. I expect it just creates a customer directly
<html> <body> <noscript> <a href="https://accounts.shopify.com/oauth/authorize?client_id=7ee65a63608843c577db8b23c4d7316ea0a01bd2f7594f8a9c06ea668c1b775c&destination_uuid=b4eda884-65f5-4297-b09f-341ec310ab64&nonce=27ced0ba04537fa341d5f2e7b5bd3f72&redirect_uri=https%3A%2F%2Fapp.shopify.com%2Fidentity%2Fauthorize%2Fcallback&response_type=code&scope=openid+email+profile&state=fdc99206a6c218ad88be11250366a45b&ui_locales=en&ux=shop">Continue</a> </noscript> <script type="text/javascript"> window.location = "https:\/\/accounts.shopify.com\/oauth\/authorize?client_id=7ee65a63608843c577db8b23c4d7316ea0a01bd2f7594f8a9c06ea668c1b775c\u0026destination_uuid=b4eda884-65f5-4297-b09f-341ec310ab64\u0026nonce=27ced0ba04537fa341d5f2e7b5bd3f72\u0026redirect_uri=https%3A%2F%2Fapp.shopify.com%2Fidentity%2Fauthorize%2Fcallback\u0026response_type=code\u0026scope=openid+email+profile\u0026state=fdc99206a6c218ad88be11250366a45b\u0026ui_locales=en\u0026ux=shop"; </script> </body> </html>
The admin API will always redirect to login page if cookies are sent along in a POST request. That's documented somewhere.
You need to clear your cookies from the Postman session which are held in Chrome. I don't use Postman so I can't give you specific instructions how to approach this but you can read up here or Google how to do it.
Better solution, switch to Insomnia (and read this little gem written by Shopify) and live happily ever after.
Best wishes!
I have tried creating customer by using customers.json and successfully created a customer with static phone extension for example +91XXXXXXXXXX where +91 is statically set in the json i have created but trying with complete number via dynamic data is not working.
Please suggest me where i am doing wrong?
User | Count |
---|---|
13 | |
12 | |
8 | |
8 | |
4 |