Author:
Fluent Commerce
Changed on:
12 July 2024
A best practice guide of creating customer entity.
The user can use the
`customers`
`customer`
The GraphQL schema can be found here:https://api.production.shared-sydney-01.fluentcommerce.com/graphql/docs/operation/query/
Here is a sample GraphQL
`customer`
1POST: {{fluentApiHost}}/graphql
2
3// QUERY
4query getCustomer($customerRef:String!){
5 customer(ref:$customerRef) {
6 id
7 ref
8 username
9 firstName
10 lastName
11 status
12 createdOn
13 updatedOn
14 }
15}
16
17
18
19// GraphQL Variables:
20{
21 "customerRef":"1_Marietta_Will5@gmail.com"
22}
23
24
Language: json
Name: customer query
Description:
example of customer query via GraphQL
1POST: {{fluentApiHost}}/graphql
2
3// QUERY
4{
5 customers(ref:"%arietta_Will5@gmail.com%"){
6 edges{
7 node{
8 createdOn
9 updatedOn
10 status
11 ref
12 department
13 username
14 firstName
15 lastName
16 timezone
17 primaryEmail
18 promotionOptIn
19 primaryPhone
20 status
21 retailer{
22 id
23 }
24 }
25 }
26 }
27}
28
Language: json
Name: customers query
Description:
example of customers query via GraphQL
The user can use the
`createCustomer`
The GraphQL schema can be found here:https://api.production.shared-sydney-01.fluentcommerce.com/graphql/docs/mutation/createcustomer/
Here is a sample GraphQL
`createCustomer`
1POST: {{fluentApiHost}}/graphql
2
3// QUERY
4mutation createCustomer($retailerId:ID!, $username:String!){
5 createCustomer(input:{
6 username:$username
7 title:"Ms"
8 firstName:"{{$randomFirstName}}"
9 lastName:"{{$randomLastName}}"
10 primaryEmail:"{{$randomEmail}}"
11 primaryPhone:"+1234567890"
12 promotionOptIn: false
13 timezone:"GMT+10"
14 retailer:{
15 id: $retailerId
16 }
17 }) {
18 id
19 ref
20 username
21 primaryEmail
22
23 }
24}
25
26
27// GraphQL Variables:
28{
29 "retailerId": "{{retailer_id}}",
30 "username": "{{retailer_id}}_{{$randomEmail}}"
31}
32
33
Language: json
Name: createCustomer mutation
Description:
example of createCustomer mutation via GraphQL
The user can use the
`updateCustomer`
The GraphQL schema can be found here:https://api.production.shared-sydney-01.fluentcommerce.com/graphql/docs/mutation/updatecustomer/
Here is a sample GraphQL
`updateCustomer`
1POST: {{fluentApiHost}}/graphql
2
3// QUERY
4mutation updateCustomer ($input: UpdateCustomerInput) {
5 updateCustomer (input: $input) {
6 id
7 ref
8 status
9 createdOn
10 updatedOn
11 retailer{
12 id
13 }
14 title
15 country
16 firstName
17 lastName
18 username
19 primaryEmail
20 primaryPhone
21 timezone
22 promotionOptIn
23 }
24}
25
26
27// GraphQL Variables:
28{
29 "input": {
30 "username": "1_Clarissa.Stokes@yahoo.com",
31 "primaryPhone": "3333344444",
32 "primaryEmail": "new2@emailnew.com"
33 }
34}
35
36
Language: json
Name: updateCustomer mutation
Description:
example of updateCustomer mutation via GraphQL
Since the
`createOrder`
The customer entity is located at the retailer level (same as the Order entity) in the OMS data structure. It is a best practice to ensure the customer->username is unique across the Account level, not just the retailer level. This will reduce any confusion when it comes to cross-retailer setup.
Copyright © 2024 Fluent Retail Pty Ltd (trading as Fluent Commerce). All rights reserved. No materials on this docs.fluentcommerce.com site may be used in any way and/or for any purpose without prior written authorisation from Fluent Commerce. Current customers and partners shall use these materials strictly in accordance with the terms and conditions of their written agreements with Fluent Commerce or its affiliates.