Reputation: 5471
I was able to connect to Mind Body api and run a simple command to get all clients data
from Helper.ClientService import ClientServiceCalls
calls = ClientServiceCalls()
clients = calls.GetAllClients()
print(clients)
the server will respond with these information:
(GetClientsResult){
Status = "Success"
ErrorCode = 200
XMLDetail = "Full"
ResultCount = 4503
CurrentPageIndex = 0
TotalPageCount = 181
Clients =
(ArrayOfClient){
Client[] =
(Client){
MobileProvider = None
AppointmentGenderPreference = "None"
Gender = "Female"
IsCompany = False
LiabilityRelease = False
PromotionalEmailOptIn = True
CreationDate = 2017-02-23 00:00:00
Liability =
(Liability){
IsReleased = False
AgreementDate = None
ReleasedBy = None
}
UniqueID = 100015484
ID = "100015484"
FirstName = "Sdfoij"
LastName = "[asodfj"
EmailOptIn = True
State = "CA"
Country = "US"
BirthDate = None
FirstAppointmentDate = 2017-03-03 00:00:00
HomeLocation =
(Location){
SiteID = -99
BusinessDescription = ""The MINDBODY Health Club Demo is awesome." - Anonymous (but probably someone cool and smart)"
AdditionalImageURLs = ""
FacilitySquareFeet = None
TreatmentRooms = None
HasClasses = True
PhoneExtension = None
ID = 1
Name = "Clubville"
}
PhotoURL = "https://clients.mindbodyonline.com/studios/DemoAPISandboxRestore/clients/100015484_large.jpg?v=98"
IsProspect = False
Status = "Active"
ContactMethod = 1
}.... **and continue printing other client informations**
}
}
now The issue is i want to extract these info from it,
Client Email, Client Name, Client Phone Number, Client Status (active or inactive), Client Birthday, Client Address, Most Recent Visit Date, Most Recent Visit Description, Start Date, Custom Field(s)
But i don't know what Library I can use to parse through this output, I am thinking about Beautiful Soup but I am not really sure,
I am really newbie to working with apis, so if anyone could give me an idea about how to do this it would be really great.
Upvotes: 4
Views: 342
Reputation: 3157
OK, I did a search on mindbody WSDL in the googs and got back the following link: https://api.mindbodyonline.com/0_5/SiteService.asmx?wsdl. From looking at the code in the API examples it looks like they are definitely using SOAP. My recommendation is that you try the following:
from suds.client import Client
from Helper.ClientService import ClientServiceMethods
calls = ClientServiceMethods()
clients = calls.GetAllClients()
client_dict = Client.dict(clients)
Or take a look at this link for taking a response and turning it into a dict.
Upvotes: 3