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
Migrating Customer endpoint to new directories as per Magedoc3973 #5124
Merged
Merged
Changes from 2 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
5e8b0a7
migrating customer to separate dirs
erikmarr cdfb180
fixing broken links in other topics to new customer files
erikmarr 3a41b99
entering Kevin's edits
erikmarr 52d5dd0
entering edits
erikmarr 96b0d19
standardizing the output attribute table lead in sentence
erikmarr 7150519
minor edits
erikmarr 1f58dd1
Merge branch 'develop' into em_magedoc-3973
keharper 52a9b8e
creating and referencing include files
erikmarr acd2e02
Merge branch 'em_magedoc-3973' of github.com:magento/devdocs into em_…
erikmarr b65765c
cleaning up include files
erikmarr 3155213
fixing include files
erikmarr 6d808f1
fixing spacing
erikmarr 802f05a
Merge branch 'develop' into em_magedoc-3973
erikmarr cefb451
merging toc with local branch
erikmarr 61bd95b
fixing toc
erikmarr f2ca438
merging toc
erikmarr 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
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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
Attribute | Data Type | Description | ||
--- | --- | --- | ||
`dob` | String | The customer’s date of birth | ||
`email` | String | The customer’s email address. Required to create a customer | ||
`firstname` | String | The customer’s first name. Required to create a customer | ||
`gender` | Int | The customer's gender (Male - 1, Female - 2) | ||
`is_subscribed` | Boolean | The customer's new password | ||
`lastname` | String | The customer’s last name. Required to create a customer | ||
`middlename` | String | The customer’s middle name | ||
`password` | String | The customer's password. Required to create a customer | ||
`prefix` | String | An honorific, such as Dr., Mr., or Mrs. | ||
`suffix` | String | A value such as Sr., Jr., or III | ||
`taxvat` | String | The customer’s Tax/VAT number (for corporate customers) |
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
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 |
---|---|---|
@@ -0,0 +1,58 @@ | ||
--- | ||
group: graphql | ||
title: changeCustomerPassword mutation | ||
--- | ||
|
||
Use the `changeCustomerPassword` mutation to change the password for the logged-in customer. | ||
|
||
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). | ||
|
||
## Syntax | ||
|
||
`mutation: {changeCustomerPassword(currentPassword: String!newPassword: String!) {Customer}}` | ||
|
||
## Example usage | ||
|
||
The following call updates the customer's password. | ||
|
||
**Request** | ||
|
||
```graphql | ||
mutation { | ||
changeCustomerPassword( | ||
currentPassword: "[email protected]", | ||
newPassword: "[email protected]" | ||
) { | ||
id | ||
} | ||
} | ||
``` | ||
|
||
**Response** | ||
|
||
```json | ||
{ | ||
"data": { | ||
"changeCustomerPassword": { | ||
"id": 1, | ||
"email": "[email protected]" | ||
} | ||
} | ||
} | ||
``` | ||
|
||
## Input attributes | ||
|
||
The `changeCustomerPassword` object requires the following inputs: | ||
|
||
Attribute | Data Type | Description | ||
--- | --- | --- | ||
`currentPassword` | String | The customer's current password | ||
`newPassword` | String | The customer's new password | ||
|
||
## Related topics | ||
|
||
* [customer query]({{page.baseurl}}/graphql/queries/customer.html) | ||
* [createCustomer mutation]({{page.baseurl}}/graphql/mutations/create-customer.html) | ||
* [updateCustomer mutation]({{page.baseurl}}/graphql/mutations/update-customer.html) |
138 changes: 138 additions & 0 deletions
138
guides/v2.3/graphql/mutations/create-customer-address.md
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 |
---|---|---|
@@ -0,0 +1,138 @@ | ||
--- | ||
group: graphql | ||
title: createCustomerAddress mutation | ||
--- | ||
|
||
Use the `createCustomerAddress` mutation to create the customer's address. | ||
|
||
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). | ||
|
||
## Syntax | ||
|
||
`mutation: {createCustomerAddress(input: CustomerAddressInput!) {CustomerAddress}}` | ||
|
||
## Example usage | ||
|
||
The following call creates an address for the specified customer. | ||
|
||
**Request** | ||
|
||
```graphql | ||
mutation { | ||
createCustomerAddress(input: { | ||
region: { | ||
region: "Arizona" | ||
region_id: 4 | ||
region_code: "AZ" | ||
} | ||
country_id: US | ||
street: ["123 Main Street"] | ||
telephone: "7777777777" | ||
postcode: "77777" | ||
city: "Phoenix" | ||
firstname: "Bob" | ||
lastname: "Loblaw" | ||
default_shipping: true | ||
default_billing: false | ||
}) { | ||
id | ||
customer_id | ||
region { | ||
region | ||
region_id | ||
region_code | ||
} | ||
country_id | ||
street | ||
telephone | ||
postcode | ||
city | ||
default_shipping | ||
default_billing | ||
} | ||
} | ||
``` | ||
|
||
**Response** | ||
|
||
```json | ||
{ | ||
"data": { | ||
"createCustomerAddress": { | ||
"id": 4, | ||
"customer_id": 5, | ||
"region": { | ||
"region": "Arizona", | ||
"region_id": 4, | ||
"region_code": "AZ" | ||
}, | ||
"country_id": "US", | ||
"street": [ | ||
"123 Main Street" | ||
], | ||
"telephone": "7777777777", | ||
"postcode": "77777", | ||
"city": "Phoenix", | ||
"default_shipping": true, | ||
"default_billing": false | ||
} | ||
} | ||
} | ||
``` | ||
|
||
## Input attributes | ||
|
||
Attribute | Data Type | Description | ||
--- | --- | --- | ||
`id` | Int | The ID assigned to the address object | ||
`CustomerAddressInput` | [CustomerAddress](#customerAddressInput) | An array containing the customer’s shipping and billing addresses | ||
|
||
### Customer address input attributes {#customerAddressInput} | ||
|
||
Attribute | Data Type | Description | ||
--- | --- | --- | ||
`city` | String | The city or town | ||
`company` | String | The customer's company | ||
`country_id` | CountryCodeEnum | The customer's country | ||
`custom_attributes` | [CustomerAddressAttributeInput](#customerAddressAttributeInput) | Address custom attributes | ||
`customer_id` | Int | The customer ID | ||
`default_billing` | Boolean | Indicates whether the address is the default billing address | ||
`default_shipping` | Boolean | Indicates whether the address is the default shipping address | ||
`fax` | String | The fax number | ||
`firstname` | String | The first name of the person associated with the shipping/billing address | ||
`lastname` | String | The family name of the person associated with the shipping/billing address | ||
`middlename` | String | The middle name of the person associated with the shipping/billing address | ||
`postcode` | String | The customer's ZIP or postal code | ||
`prefix` | String | An honorific, such as Dr., Mr., or Mrs. | ||
`region` | [CustomerAddressRegionInput](#customerAddressRegionInput) | An object that defines the customer's state or province | ||
`street` | [String] | An array of strings that define the street number and name | ||
`suffix` | String | A value such as Sr., Jr., or III | ||
`telephone` | String | The telephone number | ||
`vat_id` | String | The customer's Tax/VAT number (for corporate customers) | ||
|
||
### Customer address attributes {#customerAddressAttributeInput} | ||
|
||
The `CustomerAddressAttributeInput` object can contain the following attributes: | ||
|
||
Attribute | Data Type | Description | ||
--- | --- | --- | ||
`attribute_code` | String | Attribute code | ||
`value` | String | Attribute value | ||
|
||
### Customer address region input attributes {#customerAddressRegionInput} | ||
|
||
The `customerAddressRegionInput` object can contain the following attributes: | ||
|
||
Attribute | Data Type | Description | ||
--- | --- | --- | ||
`region_code` | String | The address region code | ||
`region` | String | The state or province name | ||
`region_id` | Int | Uniquely identifies the region | ||
|
||
## Related topics | ||
|
||
* [customer query]({{page.baseurl}}/graphql/queries/customer.html) | ||
* [createCustomer mutation]({{page.baseurl}}/graphql/mutations/create-customer.html) | ||
* [updateCustomer mutation]({{page.baseurl}}/graphql/mutations/update-customer.html) | ||
* [updateCustomerAddress mutation]({{page.baseurl}}/graphql/mutations/update-customer-address.html) | ||
* [deleteCustomerAddress mutation]({{page.baseurl}}/graphql/mutations/delete-customer-address.html) |
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 |
---|---|---|
@@ -0,0 +1,72 @@ | ||
--- | ||
group: graphql | ||
title: createCustomer mutation | ||
--- | ||
|
||
Use the `createCustomer` mutation to create a new customer. | ||
|
||
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). | ||
|
||
## Syntax | ||
|
||
`mutation: {createCustomer(input: CustomerInput!) {CustomerOutput}}` | ||
|
||
## Example usage | ||
|
||
The following call creates a new customer. | ||
|
||
**Request** | ||
|
||
```graphql | ||
mutation { | ||
createCustomer( | ||
input: { | ||
firstname: "Bob" | ||
lastname: "Loblaw" | ||
email: "[email protected]" | ||
password: "b0bl0bl@w" | ||
is_subscribed: true | ||
} | ||
) { | ||
customer { | ||
id | ||
firstname | ||
lastname | ||
is_subscribed | ||
} | ||
} | ||
} | ||
``` | ||
|
||
**Response** | ||
|
||
```json | ||
{ | ||
"data": { | ||
"createCustomer": { | ||
"customer": { | ||
"id": 5, | ||
"firstname": "Bob", | ||
"lastname": "Loblaw", | ||
"email": "[email protected]", | ||
"is_subscribed": true | ||
} | ||
} | ||
} | ||
} | ||
``` | ||
|
||
## Input attributes | ||
|
||
The following table lists the attributes you can use as input for the `createCustomer` mutation. The [Customer attributes]({{page.baseurl}}/graphql/queries/customer.html#customerAttributes) table lists the attributes Magento returns. | ||
|
||
{% include graphql/create-customer.md %} | ||
|
||
keharper marked this conversation as resolved.
Show resolved
Hide resolved
|
||
## Related topics | ||
|
||
* [customer query]({{page.baseurl}}/graphql/queries/customer.html) | ||
* [updateCustomer mutation]({{page.baseurl}}/graphql/mutations/update-customer.html) | ||
* [createCustomerAddress mutation]({{page.baseurl}}/graphql/mutations/create-customer-address.html) | ||
* [updateCustomerAddress mutation]({{page.baseurl}}/graphql/mutations/update-customer-address.html) | ||
* [deleteCustomerAddress mutation]({{page.baseurl}}/graphql/mutations/delete-customer-address.html) |
Oops, something went wrong.
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.