This repository was archived by the owner on Nov 19, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
GraphQL: Add isEmailAvailable query #4556
Merged
Merged
Changes from 1 commit
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,12 +8,17 @@ The `Customer` endpoint contains information about a customer account accessible | |
| 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). | ||
|
|
||
| ## Queries | ||
| Use queries to read server-side data, such as a specific customer's address. | ||
|
|
||
| The `customer` query returns information about the logged-in customer. | ||
|
|
||
| The `isEmailAvailable` query checks whether the specified email has already been used to create a customer account. A value of `true` indicates the customer can use the email address to create an account. | ||
keharper marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| ### Syntax | ||
|
|
||
| `{customer: {Customer}}` | ||
|
|
||
| `{isEmailAvailable (email): {IsEmailAvailableOutput}}` | ||
|
|
||
| ### Customer attributes {#customerAttributes} | ||
| The customer object can contain the following attributes: | ||
|
|
||
|
|
@@ -74,6 +79,18 @@ Attribute | Data Type | Description | |
| `region` | String | The state or province name | ||
| `region_id` | Int | Uniquely identifies the region | ||
|
|
||
| ### isEmailAvailable query attribute | ||
|
|
||
| Attribute | Data Type | Description | ||
| --- | --- | --- | ||
| `email` | String! | The email address to check | ||
|
|
||
| ### IsEmailAvailableOutput attribute | ||
|
|
||
| Attribute | Data Type | Description | ||
| --- | --- | --- | ||
| `is_email_available` | Boolean | A value of `true` indicates the email address can be used to create an account | ||
|
||
|
|
||
| ### Example usage | ||
|
|
||
| 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 | |
| } | ||
| ``` | ||
|
|
||
| The following example checks whether the email address `[email protected]` is available to create a customer account. | ||
|
|
||
| **Request** | ||
|
|
||
| ```text | ||
| { | ||
| isEmailAvailable(email: "[email protected]") { | ||
| is_email_available | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| **Response** | ||
|
|
||
| ```json | ||
| { | ||
| "data": { | ||
| "isEmailAvailable": { | ||
| "is_email_available": true | ||
| } | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| ## Mutations | ||
| Use mutations to update server-side data, such as adding a new customer or modifying attributes for an existing customer. | ||
|
|
||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Question: Does a value of true indicate that the email has NOT already been used and can therefore be used to create an account?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know it's implied, but do you feel we should explicitly mention that the email has not already been used?