pythonmindbody

Mindbody get details of every client visit


Right now I have a very expensive (API intense) way to get every single client's visit history. First I get each Client ID, then I call GetClientVisits to get each client's history. Is there a less API intense way to do this?

See code below:

    clientService = ClientServiceCalls()

    clientResponse = clientService.GetClientsByString(self.USER_NAME, self.USER_PASSWORD, self.SITE_IDS, '')
    clientList = clientResponse.Clients.Client

    clientVisitsDict = []

    for c in clientList:
        clientResponseVisits = clientService.GetClientVisits(self.USER_NAME, self.USER_PASSWORD, self.SITE_IDS, str(c.ID), oneMonthAgo, datetime.today())

        if clientResponseVisits.Visits:
            visitsList = clientResponseVisits.Visits.Visit
            for v in visitsList:
                q = {}
                q['cust_id'] = str(c.ID)
                q['timeframe'] = str(datetime.now().month) + '-' + str(datetime.now().year)
                q['profile'] = str(self.PROFILE)
                q['cust_name'] = str(c.FirstName) + ' ' + str(c.LastName)
                q['class_id'] = str(v.ClassID)
                q['class_time'] = str(v.ClassID)
                q['class_name'] = str(v.Name)
                q['class_location'] = str(v.Location.Name)
                q['class_instructor_id'] = str(v.Staff.ID)
                q['class_instructor_name'] = str(v.Staff.Name)

                print q['class_instructor_name']

                clientVisitsDict.append(q)

Solution

  • To my best knowledge, there's no such way with the currently provided API. And, actually, to me, it seems to be one of the major drawbacks of the MINDBODY API.

    I'm only aware of two possible ways with this situation.

    First one is to wait when updates to the API are implemented. Recently MINDBODY sent a survey to the dev accounts with possible API improvements related questions. So there's some chance the API is going to be improved with time.

    The second is to contact API support and to request implementing a specific function for your needs. According to what I know, this might be possible these days with an additional payment from your (or your company) side.

    Hope it helps. I'd be happy to hear about other possible workarounds too. Might be there's something I've missed.