From 64f27bd9f2523b7c92a7c603835b2557827818ee Mon Sep 17 00:00:00 2001 From: Traci Porter Date: Thu, 14 Nov 2024 15:07:47 -0600 Subject: [PATCH 1/4] DEVDOCS-5951 --- docs/store-operations/customers/index.mdx | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/docs/store-operations/customers/index.mdx b/docs/store-operations/customers/index.mdx index 6d9de8ed6..ed4043b6c 100644 --- a/docs/store-operations/customers/index.mdx +++ b/docs/store-operations/customers/index.mdx @@ -19,7 +19,7 @@ You can extend the data for customer records using [customer metafields](/docs/r You can use the following APIs to work with customer data and authentication: -* [GraphQL Storefront API](/docs/storefront/graphql/customers) +* [GraphQL storefront API](/docs/storefront/graphql/customers) * [REST storefront customers API](/docs/rest-storefront/customers) * [REST management API V3 customers](/docs/rest-management/customers/addresses) * [REST management API V2 customers](/docs/rest-management/customers-v2) @@ -72,6 +72,22 @@ The following endpoints are available: **GraphQL API** - Customers GraphQL API +### GraphQL API + +The [customers GraphQL storefront API](/docs/storefront/graphql/customers) offers an end-to-end shopper experience and customer account management. Developers can perform the following mutations and queries: + +* Register a customer +* Update a customer +* Add a customer address +* Update a customer address +* Delete a customer address +* Change a customer password +* Request a password reset +* Reset a password +* Get a customer address book + +For more information, see [GraphQL Storefront API: Customers](/docs/storefront/graphql/customers). + **REST API** - V3 customers REST API - V2 customers REST API @@ -195,6 +211,8 @@ The V3 customers API offers two ways to set a customer's password: [Password confirmation](/docs/rest-management/subscribers#create-a-subscriber) and [validation](/docs/rest-management/customers-v2/customer-passwords#validate-a-password) are still available under the V2 customers API. +The storefront GraphQL API allows you to authenticate calls using the [Create a storefront token](/docs/rest-authentication/tokens#create-a-token) REST endpoint. For more information, see [Authenticating requests to the GraphQL Storefront API](/docs/start/authentication/graphql-storefront). + ## Subscribers API The subscribers API allows you to manage subscribers who have signed up for the store’s newsletter or have signed up for abandoned cart emails. @@ -245,6 +263,9 @@ Accept: application/json * [Customer Login API](/docs/start/authentication/customer-login) * [Current Customer API](/docs/start/authentication/current-customer) +#### GraphQL storefront API +* [Customers](/docs/storefront/graphql/customers) + #### REST storefront API * [Customers](/docs/rest-storefront/customers) From a54063aa8d0904eab75ceda03ab3059639be89df Mon Sep 17 00:00:00 2001 From: Traci Porter Date: Mon, 9 Dec 2024 15:59:35 -0600 Subject: [PATCH 2/4] example --- docs/store-operations/customers/index.mdx | 50 +++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/docs/store-operations/customers/index.mdx b/docs/store-operations/customers/index.mdx index ed4043b6c..092f66c0a 100644 --- a/docs/store-operations/customers/index.mdx +++ b/docs/store-operations/customers/index.mdx @@ -86,6 +86,56 @@ The [customers GraphQL storefront API](/docs/storefront/graphql/customers) offer * Reset a password * Get a customer address book +#### Examples + +Register a customer using the form field configuration set up in the control panel for both the account signup and address fields. + + + + mutation RegisterCustomer($input: RegisterCustomerInput!, $reCaptchaV2: ReCaptchaV2Input) { + customer { + registerCustomer(input: $input, reCaptchaV2: $reCaptchaV2) { + customer { + firstName + lastName + } + errors { + ... on EmailAlreadyInUseError { + message + } + ... on AccountCreationDisabledError { + message + } + ... on CustomerRegistrationError { + message + } + ... on ValidationError { + message + } + } + } + } + } +`) + + + ```json filename="Example mutation: Register a customer" showLineNumbers copy + # Success + + { + "data": { + "customer": { + "registerCustomer": { + "customer": { + "firstName": "Jon", + "lastName": "Smith" + }, + "errors": [] + } + } + } + } + For more information, see [GraphQL Storefront API: Customers](/docs/storefront/graphql/customers). **REST API** From 3e5285e8737cb71d6ceca24707bae713fccf7e34 Mon Sep 17 00:00:00 2001 From: Traci Porter Date: Thu, 12 Dec 2024 15:06:05 -0600 Subject: [PATCH 3/4] fix alignment --- docs/store-operations/customers/index.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/store-operations/customers/index.mdx b/docs/store-operations/customers/index.mdx index 092f66c0a..6487b36f4 100644 --- a/docs/store-operations/customers/index.mdx +++ b/docs/store-operations/customers/index.mdx @@ -93,7 +93,7 @@ Register a customer using the form field configuration set up in the control pan mutation RegisterCustomer($input: RegisterCustomerInput!, $reCaptchaV2: ReCaptchaV2Input) { - customer { + customer { registerCustomer(input: $input, reCaptchaV2: $reCaptchaV2) { customer { firstName From 394ed5c956b27c19dd35bb574475e16fe5cb7e92 Mon Sep 17 00:00:00 2001 From: Traci Porter Date: Thu, 12 Dec 2024 15:28:18 -0600 Subject: [PATCH 4/4] fix errors in example schema --- docs/store-operations/customers/index.mdx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/docs/store-operations/customers/index.mdx b/docs/store-operations/customers/index.mdx index 6487b36f4..3f5863a7f 100644 --- a/docs/store-operations/customers/index.mdx +++ b/docs/store-operations/customers/index.mdx @@ -92,6 +92,7 @@ Register a customer using the form field configuration set up in the control pan + ```json filename="Example mutation: Register a customer" showLineNumbers copy mutation RegisterCustomer($input: RegisterCustomerInput!, $reCaptchaV2: ReCaptchaV2Input) { customer { registerCustomer(input: $input, reCaptchaV2: $reCaptchaV2) { @@ -117,6 +118,7 @@ Register a customer using the form field configuration set up in the control pan } } `) +``` ```json filename="Example mutation: Register a customer" showLineNumbers copy @@ -135,6 +137,9 @@ Register a customer using the form field configuration set up in the control pan } } } +``` + + For more information, see [GraphQL Storefront API: Customers](/docs/storefront/graphql/customers).