需要 read_customers 权限点。
接口访问需要令牌,具体如何获取令牌参考:身份认证
客户列表
Arguments
after ● String
返回指定游标之后的元素。如果指定了该参数,也必须要指定 first 参数。
before ● String
返回指定游标之前的元素。如果指定了该参数,也必须要指定 last 参数。
first ● Int
返回列表中的前 n 个元素。
last ● Int
返回列表中的最后 n 个元素。
reverse ● Boolean
是否反转列表的顺序。
● true:反转
● false:不反转
默认值:false
sortKey ● CustomerSortKeys
排序规则枚举
More
rawQuery ● String
人群筛选条件,json字符串
Return
edges ● [CustomerEdge!]non-null
edges 列表
More
nodes ● [Customer]
节点列表
More
pageInfo ● PageInfo!non-null
有助于分页的信息
More
错误码
关于更多通用错误码说明,参考:状态码和错误码
Example
客户列表
query {
customers(first: 2, after:null,rawQuery:null,reverse:false,sortKey:CREATE_TIME) {
edges {
node {
id
locale
state
firstName
lastName
email
phone
createdAt
updatedAt
note
verifiedEmail
tags
amountSpent{
amount
currencyCode
}
numberOfOrders
lifetimeDuration
validEmailAddress
defaultAddress{
address1
address2
city
company
country
countryCodeV2
firstName
lastName
id
phone
province
provinceCode
zip
}
addresses {
address1
address2
city
company
country
countryCodeV2
firstName
lastName
id
phone
province
provinceCode
zip
}
emailMarketingConsent{
consentUpdatedAt
marketingState
}
smsMarketingConsent{
consentUpdatedAt
marketingState
}
}
}
pageInfo {
endCursor
hasNextPage
hasPreviousPage
startCursor
}
}
}
Response
{
"data": {
"customers": {
"pageInfo": {
"endCursor": "E002CE0E792FBA4E98672D39851FDFD6",
"hasNextPage": true,
"hasPreviousPage": false,
"startCursor": "AF52536A1951B28A30AAE8825A2B69B9"
},
"edges": [
{
"node": {
"numberOfOrders": 3,
"createdAt": "2022-09-13T11:32:06.325Z",
"firstName": "S*****",
"verifiedEmail": false,
"defaultAddress": null,
"locale": null,
"tags": null,
"phone": "0086178****4249",
"addresses": [
{
"address1": "Chestnut Street 92",
"country": "United States",
"countryCodeV2": "US",
"firstName": "S*****",
"lastName": "T*****",
"province": "Kentucky",
"provinceCode": "4200021",
"address2": "Apartment 2",
"city": "Louisville",
"company": null,
"id": "gid://shopline/MailingAddress/SL201UA5582461214494581165",
"phone": "0086138****1234",
"zip": "40202"
}
],
"email": "*****@example.com",
"emailMarketingConsent": {
"consentUpdatedAt": "2022-09-13T11:32:06.599Z",
"marketingState": "SUBSCRIBED"
},
"id": "gid://shopline/Customer/4211385613",
"lastName": "T*****",
"lifetimeDuration": "2022-09-13 19:32",
"smsMarketingConsent": {
"marketingState": "SUBSCRIBED",
"consentUpdatedAt": "2022-09-13T11:32:06.640Z"
},
"amountSpent": {
"amount": "37530",
"currencyCode": "CLP"
},
"note": "Placed an order that had a fraud warning",
"state": "NOT_INVITED",
"updatedAt": "2022-09-14T06:33:58.912Z",
"validEmailAddress": true
}
}
]
}
}
}
这篇文章对你有帮助吗?