Skip to content

DocPlanner/integrations-api-sdk-php

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

68 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Requirements

  • PHP 5.5 and later
  • Guzzle 6.2 or later

Installation & Usage

Composer

To install the bindings via Composer, run composer require docplanner/integrations-api-sdk-php.

Manual Installation

Download the files and include autoload.php:

    require_once('/path/to/DocPlanner/Client/vendor/autoload.php');

Getting Started

Please follow the installation procedure and then run the following:

<?php
require_once(__DIR__ . '/vendor/autoload.php');
//Get OAuth2 access token
$authorization = new DocPlanner\Client\Authorization('https://www.{domain}/oauth/v2/token');
$accessToken = $authorization->getAccessToken('YOUR_CLIENT_ID', 'YOUR_CLIENT_SECRET');

// Configure access token for authorization 
$config = DocPlanner\Client\Configuration::getDefaultConfiguration();
$config->setAccessToken($accessToken);
$config->setHost('https://www.{domain}/api/v3/integration');

$apiInstance = new DocPlanner\Client\Api\DoctorsApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$facility_id = 56; // int | ID of the Facility
$with = array(\DocPlanner\Client\Model\DoctorsScopes::SPECIALIZATIONS); // string[] | 

try {
    $result = $apiInstance->getDoctors($facility_id, $with);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling DoctorsApi->getDoctors: ', $e->getMessage(), PHP_EOL;
}

// Configure access token for authorization 
$config = DocPlanner\Client\Configuration::getDefaultConfiguration()->setAccessToken($accessToken);

$apiInstance = new DocPlanner\Client\Api\AddressesApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$facility_id = 56; // int | ID of the Facility
$doctor_id = 56; // int | ID of a doctor in a facility

try {
    $result = $apiInstance->getAddresses($facility_id, $doctor_id);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling AddressesApi->getAddresses: ', $e->getMessage(), PHP_EOL;
}
?>

Authorization

To get access to API you need to make request to https://www.{domain}/oauth/v2/token for access token using your client credentials (client_id and client_secret). Then it could be injected to Configuration which is used to instantiate API clients. Whole authorization process is based on OAuth2 protocol with grant_type = client_credentials and scope = integration. Obtained token is valid for the next 24h, so it is good practice to cache it for that period.

###Example

//Get OAuth2 access token
$authorization = new DocPlanner\Client\Authorization('https://www.{domain}/oauth/v2/token');
$accessToken = $authorization->getAccessToken('YOUR_CLIENT_ID', 'YOUR_CLIENT_SECRET');

// Configure access token for authorization 
$config = DocPlanner\Client\Configuration::getDefaultConfiguration()->setAccessToken($accessToken);

$apiInstance = new DocPlanner\Client\Api\AddressesApi(null, $config);

Documentation for API Endpoints

All URIs are relative to https://www.{domain}/api/v3/integration

Class Method HTTP request Description
APINotificationCallbacksApi pullMultipleNotification GET /notifications/multiple
APINotificationCallbacksApi pullNotification GET /notifications
APINotificationCallbacksApi pushNotifications POST /{client-endpoint-url}
APINotificationCallbacksApi releaseNotifications POST /notifications/release
AddressesApi getAddress GET /facilities/{facility_id}/doctors/{doctor_id}/addresses/{address_id}
AddressesApi getAddresses GET /facilities/{facility_id}/doctors/{doctor_id}/addresses
BookingsApi cancelBooking DELETE /facilities/{facility_id}/doctors/{doctor_id}/addresses/{address_id}/bookings/{booking_id}
BookingsApi getBooking GET /facilities/{facility_id}/doctors/{doctor_id}/addresses/{address_id}/bookings/{booking_id}
BookingsApi getBookings GET /facilities/{facility_id}/doctors/{doctor_id}/addresses/{address_id}/bookings
BookingsApi moveBooking POST /facilities/{facility_id}/doctors/{doctor_id}/addresses/{address_id}/bookings/{booking_id}/move
BookingsApi requestOpinion PUT /facilities/{facility_id}/doctors/{doctor_id}/opinion-request
CalendarBreaksApi addCalendarBreak POST /facilities/{facility_id}/doctors/{doctor_id}/addresses/{address_id}/breaks
CalendarBreaksApi deleteCalendarBreak DELETE /facilities/{facility_id}/doctors/{doctor_id}/addresses/{address_id}/breaks/{break_id}
CalendarBreaksApi getCalendarBreak GET /facilities/{facility_id}/doctors/{doctor_id}/addresses/{address_id}/breaks/{break_id}
CalendarBreaksApi getCalendarBreaks GET /facilities/{facility_id}/doctors/{doctor_id}/addresses/{address_id}/breaks
CalendarBreaksApi moveCalendarBreak PATCH /facilities/{facility_id}/doctors/{doctor_id}/addresses/{address_id}/breaks/{break_id}
CalendarsApi disableCalendar POST /facilities/{facility_id}/doctors/{doctor_id}/addresses/{address_id}/calendar/disable
CalendarsApi enableCalendar POST /facilities/{facility_id}/doctors/{doctor_id}/addresses/{address_id}/calendar/enable
DoctorsApi getDoctor GET /facilities/{facility_id}/doctors/{doctor_id}
DoctorsApi getDoctors GET /facilities/{facility_id}/doctors
FacilitiesApi getFacilities GET /facilities
FacilitiesApi getFacility GET /facilities/{facility_id}
InsurancesApi addAddressInsuranceProvider POST /facilities/{facility_id}/doctors/{doctor_id}/addresses/{address_id}/insurance-providers
InsurancesApi deleteAddressInsuranceProvider DELETE /facilities/{facility_id}/doctors/{doctor_id}/addresses/{address_id}/insurance-providers/{insurance_provider}
InsurancesApi getAddressInsuranceProviders GET /facilities/{facility_id}/doctors/{doctor_id}/addresses/{address_id}/insurance-providers
InsurancesApi getInsurancePlans GET /insurance-providers/{insurance_provider_id}/plans
InsurancesApi getInsuranceProviders GET /insurance-providers
InsurancesApi updateOrCreateAddressInsuranceProvider PUT /facilities/{facility_id}/doctors/{doctor_id}/addresses/{address_id}/insurance-providers
PatientPresenceApi markPatientAbsence DELETE /facilities/{facility_id}/doctors/{doctor_id}/addresses/{address_id}/bookings/{booking_id}/presence/patient
PatientPresenceApi markPatientPresence POST /facilities/{facility_id}/doctors/{doctor_id}/addresses/{address_id}/bookings/{booking_id}/presence/patient
ServicesApi addAddressService POST /facilities/{facility_id}/doctors/{doctor_id}/addresses/{address_id}/services
ServicesApi deleteAddressService DELETE /facilities/{facility_id}/doctors/{doctor_id}/addresses/{address_id}/services/{address_service_id}
ServicesApi getAddressService GET /facilities/{facility_id}/doctors/{doctor_id}/addresses/{address_id}/services/{address_service_id}
ServicesApi getAddressServices GET /facilities/{facility_id}/doctors/{doctor_id}/addresses/{address_id}/services
ServicesApi getServices GET /services
ServicesApi updateAddressService PATCH /facilities/{facility_id}/doctors/{doctor_id}/addresses/{address_id}/services/{address_service_id}
SlotsApi bookSlot POST /facilities/{facility_id}/doctors/{doctor_id}/addresses/{address_id}/slots/{start}/book
SlotsApi deleteSlots DELETE /facilities/{facility_id}/doctors/{doctor_id}/addresses/{address_id}/slots/{date}
SlotsApi getSlots GET /facilities/{facility_id}/doctors/{doctor_id}/addresses/{address_id}/slots
SlotsApi replaceSlots PUT /facilities/{facility_id}/doctors/{doctor_id}/addresses/{address_id}/slots

Documentation For Models