我正在使用Square Connect API V2,试图做一些非常简单的事情:列出我的所有客户。从我的方形仪表板上可以看到,我有大约8k个客户,但使用ListCustomers端点时,我只收到151个客户。看看我的电话,看起来我只有一个分页
cursor
,从我的第一个请求开始,之后就没有了。以下是相关代码供参考:
def get_customers(api, cursor=None):
customers = {}
count = 0
while cursor or count == 0:
response = api.list_customers(cursor=cursor)
cursor = response.cursor
customers[count] = response.customers
count += 1
return customers
151对8k是一个巨大的区别,使这个电话毫无用处。ListCustomers不会返回所有客户,这是一种已知的行为吗?
编辑:再深入一点,我发现Square将客户分为“由Square创建的”和“由您创建的”。ListCustomers端点似乎只返回“由您创建”的客户,而我的大多数客户都是由Square创建的。因此,为了完善这个问题,我如何从Connect API v2返回所有客户,包括Square创建的客户?