I am trying to use shopify admin apis to add customers to my shopify store and am unable to make it work so far. Below is the curl call that I am making and its response-
Request:
curl -v --location --request POST 'https://store.juniorfy-Access-Token: ****' --header 'Content-Type: application/json' --header 'Cookie: request_method=POST' --data-raw '{"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"}]}}'
Response
{"errors":{"customer":"Required parameter missing or invalid"}}
For authentication, I have ensured it is correct as I am able to successfully search customers or get counts via GET requests
I have tried using postman to send the queries and all I get in response is 200 OK and a list of existing customers, but the new one does not get added.
I am not well quipped in Node.js, but can try python to do it.
Also, I have noticed that although curl gives me an error, postman or python, both give me a response code of 200 OK, and return the whole json of all the customers, excluding the one I just added. The customers count also does not increase, I get an empty response when I search this customer I am trying to add.
200 Ok should mean my call went through and the customer has been added, but why can’t I see the customer in the list of customers or why the count doesn’t change, I have no clue. I am fairly new to shopify, and these API’s and I assumed it did not work given that I cannot see the customer. It may be my ignorance, but the documentation says I should expect a 201 OK with the post call. Please suggest.
I want to add my existing customers to shopify and get them to review our products.
The specific behaviour of getting a list of customers in return instead of creation of a new customer sounds like a currently known issue with some clients when performing API requests on a secondary .myshopify.com domain instead of the original one. In such cases some clients will respond to the redirect that happens by changing the request to a GET from a POST.
The potentially quick solution for that is to check in Settings > Domains in the store admin to see if there is another .myshopify.com domain present and if so to try use that one.
Since this can be very store specific, if you’re still having trouble and have a staff account on the store it’s best to reach out to Support directly to help maintain privacy.