Creating customers from API

Kumar3
Tourist
5 0 1

Hi

We are able to view all customer registered but unable to create a new customer from API.

Thanks & Regards

Kumar

Ryan
Shopify Staff
Shopify Staff
492 42 111

Hi Kumar,  the API allows you to create customers as well.  Check out the documentation here: https://help.shopify.com/api/reference/customer#create.  If you still have issues can you post the code you are using that is having issues?

Cheers.

Developer Experience @ Shopify
0 Likes
stavgeffen
New Member
1 0 0

Having the same issue, here's the Postman generated code:

 

curl -X POST \
  https://cuddlestories.com/admin/api/2019-04/customers.json \
  -H 'Content-Type: application/json' \
  -H 'Postman-Token: %POSTMAN_TOKEN%' \
  -H 'X-Shopify-Access-Token: %SHOPIFY_TOKEN%' \
  -H 'cache-control: no-cache' \
  -d '{
    "customer": {
        "email": "stavgeffen@gmail.com",
        "first_name": "stav"
    }
}'

Instead of receiving a response that's either a successful addition of a customer or an error - I'm receiving a list of existing customers as if I was sending GET /customers.json instead of POST /customers.json

0 Likes
Prasath_M
New Member
2 0 0

Hi 

0 Likes
Prasath_M
New Member
2 0 0

Give read and write access in API permission 

1) login myshopify.com.

2) click in APPS .

3) footer you will find manage private apps click on that.

4) click on your private app name

5) In admin API permission  click on review disabled admin API permission

6) Search discounts - priceRule REST and GraphQL API Give Read and Write access.

0 Likes
greekTRUE
Tourist
8 0 0

That link now redirects to an admin API documentation page. Can you confirm that this needs to be done with the Admin API, and can't be done with the Storefront API?

0 Likes