Development discussions around Shopify APIs
Hey, I want to create a customer with password using the graphql api. I followed the documentation to create a customer with password to avoid the activation process by email, this is the query I'm sending:
mutation { customerCreate( input: { firstName: "dave", lastName: "smith", email: "someone@gmail.com", password: "12345" acceptsMarketing: true, } ) { customer { id firstName lastName email } userErrors { field message } customer { id } } }
But I'm getting this error as if the specification changed:
{ "errors": [ { "message": "InputObject 'CustomerInput' doesn't accept argument 'password'", "locations": [ { "line": 7, "column": 11 } ], "path": [ "mutation", "customerCreate", "input", "password" ], "extensions": { "code": "argumentNotAccepted", "name": "CustomerInput", "typeName": "InputObject", "argumentName": "password" } } ] }
How do I do to achieve this? Thanks!
Solved! Go to the solution
This is an accepted solution.
Hey there,
You might be seeing this error because your request is targeting the GraphQL Admin API and not the Storefront API. I would take a look at this guide which outlines the steps you need to follow.
Namely, you need to be using the proper GraphQL endpoint - `POST https://my-store-name.myshopify.com/api/graphql` and you need to provide the `X-Shopify-Storefront-Access-Token` header with your Storefront Access Token which is different from your Admin Access Token.
This is an accepted solution.
Hey there,
You might be seeing this error because your request is targeting the GraphQL Admin API and not the Storefront API. I would take a look at this guide which outlines the steps you need to follow.
Namely, you need to be using the proper GraphQL endpoint - `POST https://my-store-name.myshopify.com/api/graphql` and you need to provide the `X-Shopify-Storefront-Access-Token` header with your Storefront Access Token which is different from your Admin Access Token.
Thanks!
I realize this thread is a bit old and marked as "Solved", but it's worth mentioning that not supporting a password field from the Admin API is a real issue. It doesn't make sense that the only way you can create an account with a password is with the Storefront API. There are other fields (e.g. locale) in the Admin API that we require anyway, so we'd have to use a combination of both. It looks like for now we might have to use a combo of the REST and GraphQL Admin API.
User | RANK |
---|---|
10 | |
4 | |
3 | |
3 | |
3 |
We're excited to announce improvements to the threaded messaging experience in our communi...
By TyW May 31, 2023Thank you to everyone who participated in our AMA with Klaviyo. It was great to see so man...
By Jacqui May 30, 2023Photo by Marco Verch Sales channels on Shopify are various platforms where you can sell...
By Ollie May 25, 2023