需要 read_customers 权限点。
接口访问需要令牌,具体如何获取令牌参考:身份认证
按ID返回客户信息
Arguments
id ● ID!non-null
要返回的客户的ID
Return
addresses ● [MailingAddress]
地址信息
More
amountSpent ● MoneyV2
总花费金额
More
canDelete ● Boolean
能否被删除
createdAt ● Date
创建时间
defaultAddress ● MailingAddress
默认地址
More
displayName ● String
全名
email ● String
邮箱
emailMarketingConsent ● CustomerEmailMarketingConsentState
邮箱订阅信息
More
firstName ● String
名字
id ● ID
客户id
lastName ● String
姓氏
lifetimeDuration ● String
客户加入店铺的时间,举例,例如 一天、一周、一年
locale ● String
语言
note ● String
备注
numberOfOrders ● Int
订单数
phone ● String
手机号
smsMarketingConsent ● CustomerSmsMarketingConsentState
短信订阅状态
More
state ● CustomerState
客户状态
More
tags ● [String]
标签
taxExempt ● Boolean
客户的订单能免税标识,true:能免税,false:不能免税
taxExemptions ● [FreeAreas]
客户免税列表
More
updatedAt ● Date
更新时间
validEmailAddress ● Boolean
邮箱地址校验,不保证邮箱地址真实性
verifiedEmail ● Boolean
邮箱是否验证
错误码
关于更多通用错误码说明,参考:状态码和错误码
Example
查看客户详情
query {
customer(id: "gid://shopline/Customer/4600419107") {
locale
id
state
firstName
lastName
email
phone
createdAt
updatedAt
note
verifiedEmail
tags
lifetimeDuration
validEmailAddress
amountSpent{
amount
currencyCode
}
taxExempt
taxExemptions{
countryCode
provinceGCodeList
}
numberOfOrders
lifetimeDuration
validEmailAddress
defaultAddress {
address1
address2
city
company
country
countryCodeV2
firstName
lastName
id
phone
province
provinceCode
zip
district
town
}
addresses {
address1
address2
city
company
country
countryCodeV2
firstName
lastName
id
phone
province
provinceCode
zip
district
town
}
canDelete
}
}
Response
{
"data": {
"customer": {
"canDelete": true,
"id": "gid://shopline/Customer/4600419107",
"lifetimeDuration": "14 days ago",
"state": "NOT_INVITED",
"tags": [
"test1"
],
"taxExemptions": [
{
"countryCode": "US",
"provinceGCodeList": [
"AK",
"AL"
]
}
],
"addresses": [
{
"address1": "Chestnut Street 92",
"district": "district",
"firstName": "S*****",
"lastName": "T*****",
"city": "Louisville",
"country": "United States",
"phone": "0086138****1234",
"province": "Kentucky",
"zip": "40202",
"address2": "Apartment 2",
"provinceCode": null,
"town": "Street",
"company": "C*****",
"countryCodeV2": "US",
"id": "gid://shopline/MailingAddress/SL201UA6266776363820652562"
}
],
"createdAt": "2023-12-29T13:38:06.534Z",
"defaultAddress": {
"district": "district",
"id": "gid://shopline/MailingAddress/SL201UA6266776363820652562",
"lastName": "T*****",
"phone": "0086138****1234",
"provinceCode": null,
"address1": "Chestnut Street 92",
"address2": "Apartment 2",
"province": "Kentucky",
"zip": "40202",
"country": "United States",
"town": "Street",
"city": "Louisville",
"company": "C*****",
"countryCodeV2": "US",
"firstName": "S*****"
},
"email": "*****@example.com",
"lastName": "T*****",
"numberOfOrders": 0,
"taxExempt": true,
"updatedAt": "2023-12-29T13:38:08.470Z",
"firstName": "S*****",
"locale": null,
"validEmailAddress": true,
"verifiedEmail": true,
"note": "Placed an order that had a fraud warning",
"phone": "0086138****1234",
"amountSpent": {
"amount": "0",
"currencyCode": "CLP"
}
}
}
}
这篇文章对你有帮助吗?