Customer

Customer queries and mutations are used for working with customers and their information.

In the examples there are // comments serving as an additional information to specific part of the code. Remove them before sending a query. Otherwise, it will throw an error.

Queries

Get customer information

query findCustomer($input: FindCustomerQueryInput!){
  findCustomer(input: $input) {
    customer {
      hash
      parameters{key,value}
    }
  } 
}

with variables:

{
  "input": {
    "token": "__YOUR_STORE_TOKEN_HERE__",
    "customerHash": "__CUSTOMER_HASH__"
  }
}

Mutations

Full customer information synchronization

mutation fullCustomerSynchronization($input: FullCustomerSynchronizationMutationInput!){
  fullCustomerSynchronization(input: $input) {
    result
  }
}

with variables:

{
  "input": {
    "token": "__YOUR_STORE_TOKEN_HERE__",
    "customer": {
      "hash": "__CUSTOMER_HASH__",
      "state": "active",
      "parameters": {
        "externalId": 11,
        "is_internal": true,
        "is_vip": "no"
      }
    }
  }
}

Adding parameters

mutation addCustomerParameters($input: AddCustomerParametersMutationInput!){
  addCustomerParameters(input: $input) {
    message
    result
  }
}

with variables:

{
  "input": {
    "token": "__YOUR_STORE_TOKEN_HERE__",
    "customerHash": "__CUSTOMER_HASH__",
    "parameters": {
      "externalId": "ABC123",
      "billingAddress": {
        "firstName": "john",
        "lastName": "Doe",
        "zip": 11001
      },
      "shippingAddress": {
        "firstName": "John",
        "lastName": "Doe",
        "zip": 11001,
        "city": "Prague"
      },
      "is_vip": false,
      "is_internal": true
    }
  }
}

Removing parameters

mutation removeCustomerParameters($input: RemoveCustomerParametersMutationInput!){
  removeCustomerParameters(input: $input) {
    result
  }
}

with variables:

{
  "input": {
    "token": "__YOUR_STORE_TOKEN_HERE__",
    "customerHash": "__CUSTOMER_HASH__",
    "parameters": [
      "is_vip", "shippingAddress", "externalId"
    ]
  }
}

 

Create E-commerce in 5 minutes

Try it. It is for free.