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

Migrating Customer endpoint to new directories as per Magedoc3973 #5124

Merged
merged 16 commits into from
Aug 27, 2019
Merged
Show file tree
Hide file tree
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
33 changes: 30 additions & 3 deletions _data/toc/graphql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ pages:
- label: customAttributeMetadata query
url: /graphql/queries/custom-attribute-metadata.html

- label: customer query
url: /graphql/queries/customer.html

- label: customerOrders query
url: /graphql/queries/customer-orders.html

Expand All @@ -86,6 +89,9 @@ pages:
- label: getPayflowLinkToken query
url: /graphql/queries/get-payflow-link-token.html

- label: isEmailAvailable query
url: /graphql/queries/is-email-available.html

- label: products query
url: /graphql/queries/products.html

Expand All @@ -106,12 +112,27 @@ pages:
- label: applyStoreCreditToCart mutation
url: /graphql/mutations/apply-store-credit.html

- label: changeCustomerPassword mutation
url: /graphql/mutations/change-customer-password.html

- label: createCustomerAddress mutation
url: /graphql/mutations/create-customer-address.html

- label: createCustomer mutation
url: /graphql/mutations/create-customer.html

- label: createPayflowProToken mutation
url: /graphql/mutations/create-payflow-pro-token.html

- label: deleteCustomerAddress mutation
url: /graphql/mutations/delete-customer-address.html

- label: deletePaymentToken mutation
url: /graphql/mutations/delete-payment-token.html

- label: generateCustomerToken mutation
url: /graphql/mutations/generate-customer-token.html

- label: handlePayflowProResponse mutation
url: /graphql/mutations/handle-payflow-pro-response.html

Expand All @@ -124,6 +145,15 @@ pages:
- label: removeStoreCreditFromCart mutation
url: /graphql/mutations/remove-store-credit.html

- label: revokeCustomerToken mutation
url: /graphql/mutations/revoke-customer-token.html

- label: updateCustomerAddress mutation
url: /graphql/mutations/update-customer-address.html

- label: updateCustomer mutation
url: /graphql/mutations/update-customer.html

- label: Product data types and interfaces
children:
- label: Product interface implementations
Expand All @@ -149,9 +179,6 @@ pages:

- label: Reference
children:
- label: Customer endpoint
url: /graphql/reference/customer.html

- label: Quote endpoint (cart query)
url: /graphql/reference/quote.html
children:
Expand Down
13 changes: 13 additions & 0 deletions _includes/graphql/create-customer.md
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)
46 changes: 46 additions & 0 deletions _includes/graphql/customer-address-input.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
### CustomerAddress input {#customerAddressInput}

The `CustomerAddress` input can contain the following attributes:

Attribute | Data Type | Description
--- | --- | ---
`city` | String | The city or town
`company` | String | The customer's company
`country_id` | String | The customer's country
`custom_attributes` | [CustomerAddressAttribute](#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
`extension_attributes` | [CustomerAddressAttribute](#customerAddressAttributeInput) | Address extension attributes
`fax` | String | The fax number
`firstname` | String | The first name of the person associated with the shipping/billing address
`id` | Int | The ID assigned to the address object
`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` | [CustomerAddressRegion](#customerAddressRegionInput) | An object that defines the customer's state or province
`region_id` | Int | A number that uniquely identifies the state, province, or other area
`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)

### CustomerAddressAttribute input {#customerAddressAttributeInput}

The `CustomerAddressAttribute` input can contain the following attributes:

Attribute | Data Type | Description
--- | --- | ---
`attribute_code` | String | Attribute code
`value` | String | Attribute value

### CustomerAddressRegion input {#customerAddressRegionInput}

The `customerAddressRegion` input 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
48 changes: 48 additions & 0 deletions _includes/graphql/customer-address-output.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
### CustomerAddress output {#customerAddressOutput}

The values assigned to attributes such as `firstname` and `lastname` in this object may be different from those defined in the `Customer` object.

The `CustomerAddress` output returns the following attributes:

Attribute | Data Type | Description
--- | --- | ---
`city` | String | The city or town
`company` | String | The customer's company
`country_id` | String | The customer's country
`custom_attributes` | [CustomerAddressAttribute](#customerAddressAttributeOutput) | 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
`extension_attributes` | [CustomerAddressAttribute](#customerAddressAttributeOutput) | Address extension attributes
`fax` | String | The fax number
`firstname` | String | The first name of the person associated with the shipping/billing address
`id` | Int | The ID assigned to the address object
`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` | [CustomerAddressRegion](#customerAddressRegionOutput) | An object that defines the customer's state or province
`region_id` | Int | A number that uniquely identifies the state, province, or other area
`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)

### CustomerAddressAttribute output {#customerAddressAttributeOutput}

The `CustomerAddressAttribute` output returns the following attributes:

Attribute | Data Type | Description
--- | --- | ---
`attribute_code` | String | Attribute code
`value` | String | Attribute value

### CustomerAddressRegion output {#customerAddressRegionOutput}

The `customerAddressRegion` output returns 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
20 changes: 20 additions & 0 deletions _includes/graphql/customer-input.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
Attribute | Data Type | Description
--- | --- | ---
`addresses` | [CustomerAddress](#customerAddressInput) | An array containing the customer's shipping and billing addresses
`created_at` | String | Timestamp indicating when the account was created
`default_billing` | String | The ID assigned to the billing address
`default_shipping` | String | The ID assigned to the shipping address
`dob` | String | The customer's date of birth
`email` | String | The customer's email address
`firstname` | String | The customer's first name
`gender` | Int | The customer's gender (Male - 1, Female - 2)
`group_id` | Int | The group assigned to the user. Default values are 0 (Not logged in), 1 (General), 2 (Wholesale), and 3 (Retailer)
`id` | Int | The ID assigned to the customer
`is_subscribed` | Boolean | Indicates whether the customer is subscribed to the company's newsletter
`lastname` | String | The customer's family name
`middlename` |String | The customer's middle name
`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)

{% include graphql/customer-address-input.md %}
20 changes: 20 additions & 0 deletions _includes/graphql/customer-output.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
Attribute | Data Type | Description
--- | --- | ---
`addresses` | [CustomerAddress](#customerAddressOutput) | An array containing the customer's shipping and billing addresses
`created_at` | String | Timestamp indicating when the account was created
`default_billing` | String | The ID assigned to the billing address
`default_shipping` | String | The ID assigned to the shipping address
`dob` | String | The customer's date of birth
`email` | String | The customer's email address
`firstname` | String | The customer's first name
`gender` | Int | The customer's gender (Male - 1, Female - 2)
`group_id` | Int | The group assigned to the user. Default values are 0 (Not logged in), 1 (General), 2 (Wholesale), and 3 (Retailer)
`id` | Int | The ID assigned to the customer
`is_subscribed` | Boolean | Indicates whether the customer is subscribed to the company's newsletter
`lastname` | String | The customer's family name
`middlename` |String | The customer's middle name
`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)

{% include graphql/customer-address-output.md %}
2 changes: 1 addition & 1 deletion guides/v2.3/graphql/get-customer-authorization-token.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@ You can now use this token in the Authorization request header field for any que

![GraphiQL Authorization Bearer]({{ page.baseurl }}/graphql/images/graphql-authorization.png)

If necessary, you also can [revoke the customer's token]({{ page.baseurl }}/graphql/reference/customer.html#revoke-a-customer-token).
If necessary, you also can [revoke the customer's token]({{ page.baseurl }}/graphql/mutations/revoke-customer-token.html).
2 changes: 1 addition & 1 deletion guides/v2.3/graphql/mutations/apply-store-credit.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ Attribute | Data Type | Description

## Output attributes

The `ApplyStoreCreditToCartOutput` object contains the `Cart` object.
The `ApplyStoreCreditToCartOutput` object returns the `Cart` object.

Attribute | Data Type | Description
--- | --- | ---
Expand Down
64 changes: 64 additions & 0 deletions guides/v2.3/graphql/mutations/change-customer-password.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
---
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
email
}
}
```

**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

## Output attributes

The `changeCustomerPassword` mutation returns the `customer` object.

{% include graphql/customer-output.md %}

## 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)
Loading