我如何使用 MindBody API python 获得所有客户
How I can get all Clients with MindBody API python
我正在尝试获取所有 clients using MindBody API,我试过了,
from suds.client import Client
from Helper.ClientService import ClientServiceMethods
# Making a call
calls = ClientServiceMethods()
result = calls.GetAllClients()
client_dict = Client.dict(result)
clients = client_dict['Clients']
client_list = clients.Client # transferring clients into a python list
#printing the lenght of received clients list
print len(client_list)
上面的代码可以工作,但问题是它不会拉取超过 27 个客户端,仅此而已。
从 MindBody Docs GettAllClients 应该最多 1000 个客户端,呼叫的限制是 1000,这意味着我最多可以达到 1000,但问题是我注意到为了至少获得那 1000 个,我只获得了 27 个客户。
Note: I am working with Demo Data, Sandbox which can anyone look them,
I used the Sample code from their MindBody Python repository
我正在努力通过 api 获取所有客户数据,这些客户可以查看 from here
用户名:站点所有者 |密码:apitest1234
对于任何在这方面也有问题的人,这将对您有很大帮助。
when we make call GetClients, mindbody will send clients but it will represent them in form of pages so that 25 client was the first page if u want to get the next 25 client you would have to call the page indexed 2 and so on and so forth.
在代码中,这就是您要执行此操作的方法,使用 API Example code ClientService
,在方法 GetClientsByString
中执行此操作
def GetClientsByString(self, searchStr):
"""Convenience method to find clients containing searchStr in their name or e-mail."""
request = self.CreateBasicRequest("GetClientsRequest")
# Since SearchText is just a string, we can assign it directly.
request.SearchText = searchStr
request.CurrentPageIndex = 1 # increase this number by one each time
return self.service.service.GetClients(request)
我就是这样处理的;对没有 API 密集的更好方法持开放态度:
clientService = ClientServiceCalls()
#get all client IDs
clientResponse = clientService.GetClientsByString('')
clientList = clientResponse.Clients.Client
clientVisitsDict = []
for c in clientList:
#Call get ClientVisits API on each Client ID
clientResponseVisits = clientService.GetClientVisits(str(c.ID))
if clientResponseVisits.Visits:
visitsList = clientResponseVisits.Visits.Visit
for v in visitsList:
### your code here
我正在尝试获取所有 clients using MindBody API,我试过了,
from suds.client import Client
from Helper.ClientService import ClientServiceMethods
# Making a call
calls = ClientServiceMethods()
result = calls.GetAllClients()
client_dict = Client.dict(result)
clients = client_dict['Clients']
client_list = clients.Client # transferring clients into a python list
#printing the lenght of received clients list
print len(client_list)
上面的代码可以工作,但问题是它不会拉取超过 27 个客户端,仅此而已。 从 MindBody Docs GettAllClients 应该最多 1000 个客户端,呼叫的限制是 1000,这意味着我最多可以达到 1000,但问题是我注意到为了至少获得那 1000 个,我只获得了 27 个客户。
Note: I am working with Demo Data, Sandbox which can anyone look them, I used the Sample code from their MindBody Python repository
我正在努力通过 api 获取所有客户数据,这些客户可以查看 from here
用户名:站点所有者 |密码:apitest1234
对于任何在这方面也有问题的人,这将对您有很大帮助。
when we make call GetClients, mindbody will send clients but it will represent them in form of pages so that 25 client was the first page if u want to get the next 25 client you would have to call the page indexed 2 and so on and so forth.
在代码中,这就是您要执行此操作的方法,使用 API Example code ClientService
,在方法 GetClientsByString
def GetClientsByString(self, searchStr):
"""Convenience method to find clients containing searchStr in their name or e-mail."""
request = self.CreateBasicRequest("GetClientsRequest")
# Since SearchText is just a string, we can assign it directly.
request.SearchText = searchStr
request.CurrentPageIndex = 1 # increase this number by one each time
return self.service.service.GetClients(request)
我就是这样处理的;对没有 API 密集的更好方法持开放态度:
clientService = ClientServiceCalls()
#get all client IDs
clientResponse = clientService.GetClientsByString('')
clientList = clientResponse.Clients.Client
clientVisitsDict = []
for c in clientList:
#Call get ClientVisits API on each Client ID
clientResponseVisits = clientService.GetClientVisits(str(c.ID))
if clientResponseVisits.Visits:
visitsList = clientResponseVisits.Visits.Visit
for v in visitsList:
### your code here