Mutation
mutation UpsertCustomer($input: UpsertCustomerInput!) {
upsertCustomer(input: $input) {
result
customer {
id
externalId
fullName
shortName
email {
email
isVerified
verifiedAt {
__typename
}
}
avatarUrl
}
error {
message
type
code
fields {
field
message
type
}
}
}
}Variables
{
"input": {
"identifier": {},
"onCreate": {
"fullName": "string",
"email": {
"email": "string",
"isVerified": true
}
},
"onUpdate": {}
}
}Response
{
"data": {
"upsertCustomer": {
"result": "UPDATED",
"customer": {
"id": "id",
"externalId": "id",
"fullName": "string",
"shortName": "string",
"email": {
"email": "string",
"isVerified": true,
"verifiedAt": {
"__typename": "DateTime"
}
},
"avatarUrl": "string"
},
"error": {
"message": "string",
"type": "VALIDATION",
"code": "string",
"fields": [
{
"field": "string",
"message": "string",
"type": "VALIDATION"
}
]
}
}
}
}Mutations
upsertCustomer
Creates or updates a customer identified by email address, external ID, or Plain customer ID.
Supply onCreate fields for values to set when creating and onUpdate fields for values to
apply when the customer already exists. The output’s result field indicates whether the
customer was CREATED, UPDATED, or NOOP (existed and no values changed). Requires the
customer:create and customer:edit permissions.
MUTATION
upsertCustomer(input: UpsertCustomerInput!): UpsertCustomerOutput!Arguments
input
required
Returns
result
customer
error
Mutation
mutation UpsertCustomer($input: UpsertCustomerInput!) {
upsertCustomer(input: $input) {
result
customer {
id
externalId
fullName
shortName
email {
email
isVerified
verifiedAt {
__typename
}
}
avatarUrl
}
error {
message
type
code
fields {
field
message
type
}
}
}
}Variables
{
"input": {
"identifier": {},
"onCreate": {
"fullName": "string",
"email": {
"email": "string",
"isVerified": true
}
},
"onUpdate": {}
}
}Response
{
"data": {
"upsertCustomer": {
"result": "UPDATED",
"customer": {
"id": "id",
"externalId": "id",
"fullName": "string",
"shortName": "string",
"email": {
"email": "string",
"isVerified": true,
"verifiedAt": {
"__typename": "DateTime"
}
},
"avatarUrl": "string"
},
"error": {
"message": "string",
"type": "VALIDATION",
"code": "string",
"fields": [
{
"field": "string",
"message": "string",
"type": "VALIDATION"
}
]
}
}
}
}Was this page helpful?

