PHP code example of vasylisa / mindbody-api

1. Go to this page and download the library: Download vasylisa/mindbody-api library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

vasylisa / mindbody-api example snippets



vice = MindbodyAPI\MindbodyClient::service('SiteService');

$credentials = $service::credentials(
    'YourSourceName',
    'YourPassword',
    [
        -99 // Your Site ID(s)
    ]
);

$request   = $service::request('GetLocations', $credentials);
$locations = $service->GetLocations($request);

var_dump($locations);


vice = MindbodyAPI\MindbodyClient::service('AppointmentService');

$credentials = $service::credentials(
    'YourSourceName',
    'YourPassword',
    [
        -99 // Your Site ID(s)
    ]
);

$userCredentials = $service::userCredentials(
    'Siteowner',
    'apitest1234',
    [
        -99 // Your Site ID(s)
    ]
);

$request = $service::request('AddOrUpdateAppointments', $credentials, $userCredentials);

$appointment    = $service::structure('Appointment', [
    'Location'      => $service::structure('Location', ['ID' => $locationId]),
    'Staff'         => $service::structure('Staff', ['ID' => $staffId]),
    'Client'        => $service::structure('Client', ['ID' => $clientId]),
    'SessionType'   => $service::structure('SessionType', ['ID' => $sessionTypeId]),
    'StartDateTime' => $date->format('Y-m-d\TH:i:s'),
]);

$request->Request->UpdateAction = $appointment->ID ? 'Update' : 'AddNew';
$request->Request->Appointments = [$appointment];

$response = $service->AddOrUpdateAppointments($request);


vice = MindbodyAPI\MindbodyClient::service('AppointmentService');

$credentials = $service::credentials(
    'YourSourceName',
    'YourPassword',
    [
        -99 // Your Site ID(s)
    ]
);

$request = $service::request('GetStaffAppointments', $credentials);

$request->Request->StaffCredentials = $service::staffCredentials(
    'Siteowner',
    'apitest1234',
    [
        -99 // Your Site ID(s)
    ]
);

$request->Request->StaffIDs       = $staffID;
$request->Request->ClientIDs      = $clientIDs;
$request->Request->AppointmentIDs = $appointmentIDs;
$request->Request->LocationIDs    = $locationIDs;
$request->Request->StartDate      = $startDate ? $startDate->format('Y-m-d\TH:i:s') : null;
$request->Request->EndDate        = $endDate ? $endDate->format('Y-m-d\TH:i:s') : null;

$response = $service->GetStaffAppointments($request);