The MindBody API has quite a lot of issues with regards to the GetClasses
API call in my experience (I used it in a project in mid-late 2015, so perhaps things have changed since then...). Here are a list of gotchas/issues that I found when trying to get the details of a class that will hopefully assist you:
- When you make a
GetClasses
API request, if you pass in a ClassID
only, any StartDateTime
and EndDateTime
parameters seem to just get ignored, meaning you can't actually find a class in the future
- The API seems to ignore the time part of a datetime, so when you make the call, you'll get back a list of classes held throughout the day of the datetime. The times you'll get back for each of those classes will be timezoned classes, but they'll incorrectly declare themselves to be in UTC format, rather than their actual timezone
- Don't attempt to add in a specified
dateTime
type parameter in your API call params as that will cause the datetimes you have in those parameters to be ignored
So, basically, what I had to do was use only ever three parameters in the call:
ClientID
StartDateTime
(which I made 24 hours before the class I wanted's actual start time)
EndDateTime
(which I made 24 hours after the class I wanted's actual end time)
The 24 hours before and after the actual class dates were because, as I mentioned above, I couldn't trust the timezones returned for each of the classes. Anyway, this would obviously return a collection of classes rather than a single class, and from there, I'd just iterate over the collection find the class I actually wanted.
The above findings were gained as a result of copious trial and error and pouring over documentation that was frequently incorrect, if it even existed at all. Good luck.