Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DEVDOCS-5951: [update] add storefront graphql customer updates #660

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 77 additions & 1 deletion docs/store-operations/customers/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -72,6 +72,77 @@ The following endpoints are available:
**GraphQL API**
- Customers GraphQL API

### GraphQL API
bc-traciporter marked this conversation as resolved.
Show resolved Hide resolved

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

#### Examples

Register a customer using the form field configuration set up in the control panel for both the account signup and address fields.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [remark-lint] reported by reviewdog 🐶
signup is misspelt; did you mean signer, signet, signor, signed, sunup? retext-spell retext-spell


<Tabs items={[`Request`, `Response`]}>
<Tab>
```json filename="Example mutation: Register a customer" showLineNumbers copy
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
}
}
}
}
}
`)
```
</Tab>
<Tab>
```json filename="Example mutation: Register a customer" showLineNumbers copy
# Success

{
"data": {
"customer": {
"registerCustomer": {
"customer": {
"firstName": "Jon",
"lastName": "Smith"
},
"errors": []
}
}
}
}
```
</Tab>
</Tabs>

For more information, see [GraphQL Storefront API: Customers](/docs/storefront/graphql/customers).

**REST API**
- V3 customers REST API
- V2 customers REST API
Expand Down Expand Up @@ -195,6 +266,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.
Expand Down Expand Up @@ -245,6 +318,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)
Expand Down
Loading