Skip to content
This repository was archived by the owner on Nov 19, 2024. It is now read-only.

Commit d298425

Browse files
authored
GraphQL: Add isEmailAvailable query (#4556)
* Add isEmailAvailable query~ * Update guides/v2.3/graphql/reference/customer.md * Update guides/v2.3/graphql/reference/customer.md
1 parent 74a33cd commit d298425

File tree

1 file changed

+42
-1
lines changed

1 file changed

+42
-1
lines changed

guides/v2.3/graphql/reference/customer.md

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,17 @@ The `Customer` endpoint contains information about a customer account accessible
88
To return or modify information about a customer, Magento recommends you use customer tokens in the header of your GraphQL calls. However, you also can use [session authentication]({{ page.baseurl }}/get-started/authentication/gs-authentication-session.html).
99

1010
## Queries
11-
Use queries to read server-side data, such as a specific customer's address.
11+
12+
The `customer` query returns information about the logged-in customer.
13+
14+
The `isEmailAvailable` query checks whether the specified email has already been used to create a customer account. A value of `true` indicates the email address is available, and the customer can use the email address to create an account.
1215

1316
### Syntax
1417

1518
`{customer: {Customer}}`
1619

20+
`{isEmailAvailable (email): {IsEmailAvailableOutput}}`
21+
1722
### Customer attributes {#customerAttributes}
1823
The customer object can contain the following attributes:
1924

@@ -74,6 +79,18 @@ Attribute | Data Type | Description
7479
`region` | String | The state or province name
7580
`region_id` | Int | Uniquely identifies the region
7681

82+
### isEmailAvailable query attribute
83+
84+
Attribute | Data Type | Description
85+
--- | --- | ---
86+
`email` | String! | The email address to check
87+
88+
### IsEmailAvailableOutput attribute
89+
90+
Attribute | Data Type | Description
91+
--- | --- | ---
92+
`is_email_available` | Boolean | A value of `true` indicates the email address is available, and the customer can use the email address to create an account
93+
7794
### Example usage
7895

7996
The following call returns information about the logged-in customer. Provide the customer's token in the header section of the query.
@@ -140,6 +157,30 @@ The following call returns information about the logged-in customer. Provide the
140157
}
141158
```
142159

160+
The following example checks whether the email address `[email protected]` is available to create a customer account.
161+
162+
**Request**
163+
164+
```text
165+
{
166+
isEmailAvailable(email: "[email protected]") {
167+
is_email_available
168+
}
169+
}
170+
```
171+
172+
**Response**
173+
174+
```json
175+
{
176+
"data": {
177+
"isEmailAvailable": {
178+
"is_email_available": true
179+
}
180+
}
181+
}
182+
```
183+
143184
## Mutations
144185
Use mutations to update server-side data, such as adding a new customer or modifying attributes for an existing customer.
145186

0 commit comments

Comments
 (0)