diff --git a/src/_data/toc/graphql.yml b/src/_data/toc/graphql.yml index 0f7ef894588..4dc3eeca68e 100644 --- a/src/_data/toc/graphql.yml +++ b/src/_data/toc/graphql.yml @@ -309,6 +309,10 @@ pages: - label: generateCustomerToken mutation url: /graphql/mutations/generate-customer-token.html + - label: generateCustomerTokenAsAdmin mutation + url: /graphql/mutations/generate-customer-token-as-admin.html + exclude_versions: ["2.3"] + - label: handlePayflowProResponse mutation url: /graphql/mutations/handle-payflow-pro-response.html diff --git a/src/_includes/graphql/customer-output-24.md b/src/_includes/graphql/customer-output-24.md index 4c832df9cc7..cfa9c27d7f1 100644 --- a/src/_includes/graphql/customer-output-24.md +++ b/src/_includes/graphql/customer-output-24.md @@ -11,6 +11,7 @@ Attribute | Data Type | Description --- | --- | --- `addresses` | {{ customeraddress_text }} | An array containing the customer's shipping and billing addresses +`allow_remote_shopping_assistance` | Boolean! | Indicates whether the customer has enabled remote shopping assistance `created_at` | String | Timestamp indicating when the account was created `date_of_birth` | String | The customer's date of birth `default_billing` | String | The ID assigned to the billing address diff --git a/src/guides/v2.4/graphql/authorization-tokens.md b/src/guides/v2.4/graphql/authorization-tokens.md index a04397ad30a..02c8f574af7 100644 --- a/src/guides/v2.4/graphql/authorization-tokens.md +++ b/src/guides/v2.4/graphql/authorization-tokens.md @@ -43,6 +43,33 @@ You can now use this token in the Authorization request header field for any que If necessary, you also can [revoke the customer's token]({{ page.baseurl }}/graphql/mutations/revoke-customer-token.html +The [`generateCustomerTokenAsAdmin`]({{page.baseurl}}/graphql/mutations/generate-customer-token-as-admin.html) mutation generates a new customer token as an admin so that an administrator can perform remote shopping assistance. +The customer must have enabled the `allow_remote_shopping_assistance` feature while creating the customer profile. The mutation requires the customer email address in the payload, as shown in the following example. + +**Request:** + +```graphql +mutation{ + generateCustomerTokenAsAdmin(input: { + customer_email: "customer1@mail.com" + }){ + customer_token + } +} +``` + +**Response:** + +```json +{ + "data": { + "generateCustomerTokenAsAdmin": { + "customer_token": "cr0717abzoagxty1xjn4lj13kim36r6x" + } + } +} +``` + ## Admin tokens In Magento GraphQL, you specify an admin token only if you need to query products, categories, price rules, or other entities that are scheduled to be in a campaign (staged content). Staging is supported in {{site.data.var.ee}} only. See [Staging queries]({{page.baseurl}}/graphql/queries/index.html#staging) for more information. diff --git a/src/guides/v2.4/graphql/mutations/create-customer-v2.md b/src/guides/v2.4/graphql/mutations/create-customer-v2.md index 5e3519782a8..91713681c3c 100644 --- a/src/guides/v2.4/graphql/mutations/create-customer-v2.md +++ b/src/guides/v2.4/graphql/mutations/create-customer-v2.md @@ -61,6 +61,7 @@ The following table lists the attributes you can use as input for the `createCus Attribute | Data Type | Description --- | --- | --- +`allow_remote_shopping_assistance` | Boolean | Indicates whether the customer has enabled remote shopping assistance `date_of_birth` | String | The customer’s date of birth `dob` | String | Deprecated. Use `date_of_birth` instead. The customer’s date of birth `email` | String! | The customer’s email address diff --git a/src/guides/v2.4/graphql/mutations/generate-customer-token-as-admin.md b/src/guides/v2.4/graphql/mutations/generate-customer-token-as-admin.md new file mode 100644 index 00000000000..43a87c10bfd --- /dev/null +++ b/src/guides/v2.4/graphql/mutations/generate-customer-token-as-admin.md @@ -0,0 +1,64 @@ +--- +group: graphql +title: generateCustomerTokenAsAdmin mutation +contributor_name: EY +--- + +The `generateCustomerTokenAsAdmin` mutation generates a new customer token as an admin so that an administrator can perform remote shopping assistance on behalf of the customer. For example, if a customer has asked for help adding a product into their cart, you would specify the token returned by the `generateCustomerTokenAsAdmin` mutation in the header of your [`addProductsToCart` mutation]({{page.baseurl}}/graphql/mutations/add-products-to-cart.html). + +To run this mutation, the customer must have enabled the **Allow remote shopping assistance** feature. You can specify the `allow_remote_shopping_assistance` attribute in a [`customer` query]({{page.baseurl}}/graphql/queries/customer.html] to determine whether the customer enabled this feature. + +## Syntax + +```graphql +mutation {generateCustomerTokenAsAdmin(input: GenerateCustomerTokenAsAdminInput!) {GenerateCustomerTokenAsAdminOutput}} +``` + +## Example usage + +The following call creates a new customer token. + +**Request:** + +```graphql +mutation{ + generateCustomerTokenAsAdmin(input: { + customer_email: "customer1@mail.com" + }){ + customer_token + } +} +``` + +**Response:** + +```json +{ + "data": { + "generateCustomerTokenAsAdmin": { + "customer_token": "cr0717abzoagxty1xjn4lj13kim36r6x" + } + } +} +``` + +## Input attributes + +The `generateCustomerTokenAsAdmin` mutation requires the following input attribute: + +Attribute | Data Type | Description +--- | --- | --- +`customer_email` | String! | The customer's email address + +## Output attributes + +The `generateCustomerTokenAsAdmin` mutation returns a valid customer token as the output. + +Attribute | Data Type | Description +--- | --- | --- +`customer_token` | String! | The customer token + +## Related topics + +* [customer query]({{page.baseurl}}/graphql/queries/customer.html) +* [revokeCustomerToken mutation]({{page.baseurl}}/graphql/mutations/revoke-customer-token.html) diff --git a/src/guides/v2.4/graphql/mutations/update-customer-v2.md b/src/guides/v2.4/graphql/mutations/update-customer-v2.md index 0e78dde5de1..3f73fec468e 100644 --- a/src/guides/v2.4/graphql/mutations/update-customer-v2.md +++ b/src/guides/v2.4/graphql/mutations/update-customer-v2.md @@ -56,6 +56,7 @@ The following table lists the attributes you can use as input for the `updateCus Attribute | Data Type | Description --- | --- | --- +`allow_remote_shopping_assistance` | Boolean | Indicates whether the customer has enabled remote shopping assistance `date_of_birth` | String | The customer’s date of birth `dob` | String | Deprecated. Use `date_of_birth` instead. The customer’s date of birth `firstname` | String | The customer’s first name