Line 1: |
Line 1: |
− | You can find full list of Company administration service API methods [https://simplybook.me/api/doc#/admin here]. | + | == Methods == |
− | ==Methods== | + | |
| + | === addClient === |
| + | |
| + | <code>addClient($clientData)</code> |
| + | |
| + | Parameters: |
| + | |
| + | * '''$clientData''' Object |
| + | |
| + | Returns Integer. |
| + | |
| + | Adds new client with specified data. You can specify name, email, phone, address1, address2, city, zip, |
| + | country_id. If client record with specified data exists method will return an id of this record. Otherwise data |
| + | will be stored to database and method will return an id of newly created record. NOTE: name is mandatory field.Also email, phone number or both of them can be mandatory fields. You should call |
| + | <code>getCompanyParam('require_fields')</code> method to check which fields are required. |
| + | |
| + | Method returns an error: |
| + | |
| + | * -32061 Client name value is wrong |
| + | * -32062 Client email value is wrong |
| + | * -32063 Client phone value is wrong |
| + | |
| + | |
| + | Example: |
| + | |
| + | { |
| + | name: "Frances T. Perez", |
| + | phone: "+1502-810-4521", |
| + | email: "FrancesTPerez@teleworm.us", |
| + | address1: "3872 Earnhardt Drive", |
| + | address2: "Louisville, KY 40219", |
| + | city: Louisville, |
| + | zip: 3872 |
| + | } |
| + | |
| + | |
| + | ---- |
| + | |
| + | === addDeviceToken === |
| + | |
| + | <code>addDeviceToken($token, $device)</code> |
| + | |
| + | Parameters: |
| + | |
| + | * '''$token''' String- device token |
| + | * '''$device''' String- device type (android or apple) |
| + | |
| + | Returns boolean. |
| + | |
| + | Subscribe a mobile device to push notifications about new bookings or changes in already created bookings.Use <code>'apple'</code> or <code>'android'</code> for <code>device</code> parameter. |
| + | |
| + | |
| + | ---- |
| + | |
| + | === book === |
| + | |
| + | <code>book($eventId, $unitId, $clientId, $startDate, $startTime, $endDate, $endTime, $clientTimeOffset, $additional, $count, $batchId, $recurringData)</code> |
| + | |
| + | Parameters: |
| + | |
| + | * '''$eventId''' Integer |
| + | * '''$unitId''' Integer |
| + | * '''$clientId''' Integer |
| + | * '''$startDate''' |
| + | * '''$startTime''' |
| + | * '''$endDate''' null |
| + | * '''$endTime''' null |
| + | * '''$clientTimeOffset''' Integer |
| + | * '''$additional''' array|Object- additional params and fields. |
| + | * '''$count''' Integer- bookings count, min. 1 (using for group bookings batch). (optional) |
| + | * '''$batchId''' Integer- add booking to multiple bookings batch. (optional) |
| + | * '''$recurringData''' Array- make booking recurrent. (optional) |
| + | |
| + | Returns Object. |
| + | |
| + | Book service. Returns object with appointment information or throw exception |
| + | If appointment requires confirm, in result object will be require_confirm = true |
| + | You can use $count > 1 or $batchId != null at the same time. |
| + | |
| + | |
| + | ---- |
| + | |
| + | === calculateEndTime === |
| + | |
| + | <code>calculateEndTime($startDateTime, $eventId, $unitId)</code> |
| + | |
| + | Parameters: |
| + | |
| + | * '''$startDateTime''' Stringa date and time string in format 'Y-m-d H:i:s', eg. '2001-10-02 13:30:00'. |
| + | * '''$eventId''' Integer |
| + | * '''$unitId''' Integer |
| + | |
| + | Returns String|Boolean. |
| + | |
| + | Returns end datetime if booking is available, else return false |
| + | |
| + | |
| + | ---- |
| + | |
| + | === cancelBatch === |
| + | |
| + | <code>cancelBatch($id, $bookingIds)</code> |
| + | |
| + | Parameters: |
| + | |
| + | * '''$id''' Integer |
| + | * '''$bookingIds''' Array |
| + | |
| + | Returns boolean. |
| + | |
| + | Cancel batch of bookings. Signature is NOT required.First id is used for information in notifications |
| + | |
| + | |
| + | ---- |
| + | |
| + | === cancelBooking === |
| + | |
| + | <code>cancelBooking($id)</code> |
| + | |
| + | Parameters: |
| + | |
| + | * '''$id''' Integer |
| + | |
| + | Returns Boolean. |
| + | |
| + | Cancel booking. Signature is NOT required |
| + | |
| + | |
| + | ---- |
| + | |
| + | === createBatch === |
| + | |
| + | <code>createBatch()</code> |
| + | |
| + | No arguments. |
| + | Returns Integer. |
| + | |
| + | Create booking batch |
| + | Returns batch id |
| + | |
| + | |
| + | ---- |
| + | |
| + | === deleteDeviceToken === |
| + | |
| + | <code>deleteDeviceToken($token)</code> |
| + | |
| + | Parameters: |
| + | |
| + | * '''$token''' String- device token |
| + | |
| + | Returns boolean. |
| + | |
| + | Unsubscribe to push notifications gloabl or company |
| + | |
| + | |
| + | ---- |
| + | |
| + | === editBook === |
| + | |
| + | <code>editBook($shedulerId, $eventId, $unitId, $clientId, $startDate, $startTime, $endDate, $endTime, $clientTimeOffset, $additional)</code> |
| + | |
| + | Parameters: |
| + | |
| + | * '''$shedulerId''' Integer |
| + | * '''$eventId''' Integer |
| + | * '''$unitId''' Integer |
| + | * '''$clientId''' Integer |
| + | * '''$startDate''' String- in Y-m-d format |
| + | * '''$startTime''' String- in H:i:s format |
| + | * '''$endDate''' String- in Y-m-d format |
| + | * '''$endTime''' String- in H:i:s format |
| + | * '''$clientTimeOffset''' Integer |
| + | * '''$additional''' array|Object- additional params and fields. |
| + | |
| + | Returns Object. |
| + | |
| + | Edit existing booking |
| + | |
| + | |
| + | ---- |
| + | |
| + | === editClient === |
| + | |
| + | <code>editClient($clientId, $clientData)</code> |
| + | |
| + | Parameters: |
| + | |
| + | * '''$clientId''' Integer |
| + | * '''$clientData''' Object |
| + | |
| + | Returns Integer. |
| + | |
| + | Edits client's record. See <code>[[#addClient|addClient]]</code> method description for list of available fields.Method returns an id of client's record. |
| + | |
| + | |
| + | ---- |
| + | |
| + | === getAdditionalFields === |
| + | |
| + | <code>getAdditionalFields($eventId)</code> |
| + | |
| + | Parameters: |
| + | |
| + | * '''$eventId''' Integer |
| + | |
| + | Returns Array. |
| + | |
| + | Return additional fields for certain event if [[Plugins#Additional_fields|Additional fields plugin]] is |
| + | activated. Returns empty array otherwise. Call [[#isPluginActivated|isPluginActivated('event_field')]] API |
| + | method to check if 'event_field' plugin activated. |
| + | |
| + | |
| + | ---- |
| + | |
| + | === getAnyUnitData === |
| + | |
| + | <code>getAnyUnitData()</code> |
| + | |
| + | No arguments. |
| + | Returns Object|null. |
| + | |
| + | Returns information about [[Plugins#Any_Employee_selector|Any Employee selector plugin]] configuration. Returns |
| + | null if plugin not enabled.Example: |
| + | { |
| + | "description" : "Select this option, if you want to find an available time with any of the employees", |
| + | "hide_other_units" : 1, // 1 or 0 |
| + | "image" : null, |
| + | "name" : "Any employee", |
| + | "picture_path" : null, |
| + | "random_selection" : 0 // 1 or 0 |
| + | } |
| + | |
| + | |
| + | ---- |
| + | |
| + | === getAvailableUnits === |
| + | |
| + | <code>getAvailableUnits($eventId, $dateTime, $count)</code> |
| + | |
| + | Parameters: |
| + | |
| + | * '''$eventId''' Integer |
| + | * '''$dateTime''' Stringa date and time string in format Y-m-d H:i:s |
| + | * '''$count''' Integer |
| + | |
| + | Returns Array. |
| + | |
| + | Returns available unit ids for present data or empty array if all units are not allowed |
| + | Eg.: <code>[1, 2, 3]</code> |
| + | |
| + | |
| + | ---- |
| + | |
| + | === getBookingCancellationsInfo === |
| + | |
| + | <code>getBookingCancellationsInfo($dateStart, $dateEnd)</code> |
| + | |
| + | Parameters: |
| + | |
| + | * '''$dateStart''' Stringa date string in format 'Y-m-d'. Pass null to get data from first day of current week. |
| + | * '''$dateEnd''' Stringa date string in format 'Y-m-d'. Pass null to get data filtered to last day of current week. |
| + | |
| + | Returns Array. |
| + | |
| + | Returns statistics about created bookings and cancellations for a time period. Data presented as array of hashes for |
| + | each type of operation (created or cancelled booking) groped by clients. <code>"type"</code> field can be either |
| + | "create", "cancel" or "nopayment_cancel". If <code>"user_id"</code> not specified then bookings where created or |
| + | cancelled by admin or employee. Data with type <code>"nopayment_cancel"</code> represents bookings cancelled |
| + | automatically by system.Example: |
| + | 3 bookings where created by admin or employee and 2 bookings where automatically cancelled by system. |
| + | [{ |
| + | "cnt" : 3, |
| + | "firstname" : null, |
| + | "lastname" : null, |
| + | "login" : null, |
| + | "type" : "create", |
| + | "user_id"" : null |
| + | }, { |
| + | "cnt" : 2, |
| + | "firstname" : null, |
| + | "lastname" : null, |
| + | "login" : null, |
| + | "type" : "nopayment_cancel", |
| + | "user_id"" : null |
| + | }] |
| + | |
| + | |
| + | ---- |
| + | |
| + | === getBookingComment === |
| + | |
| + | <code>getBookingComment($id)</code> |
| + | |
| + | Parameters: |
| + | |
| + | * '''$id''' Integer |
| + | |
| + | Returns String. |
| + | |
| + | Returns booking comment |
| + | |
| + | |
| + | ---- |
| + | |
| + | === getBookingDetails === |
| + | |
| + | <code>getBookingDetails($id)</code> |
| + | |
| + | Parameters: |
| + | |
| + | * '''$id''' integerbooking id |
| + | |
| + | Returns Array. |
| + | |
| + | Returns detailed bookings object by booking id. See [[#getBookingDetails_response|response example]]. |
| + | |
| + | |
| + | ---- |
| + | |
| + | === getBookingLimitUnavailableTimeInterval === |
| + | |
| + | <code>getBookingLimitUnavailableTimeInterval($startDateTime, $endDateTime, $eventId)</code> |
| + | |
| + | Parameters: |
| + | |
| + | * '''$startDateTime''' stringa date and time string in format 'Y-m-d H:i:s' |
| + | * '''$endDateTime''' stringa date and time string in format 'Y-m-d H:i:s' |
| + | * '''$eventId''' integer |
| + | |
| + | Returns Array. |
| + | |
| + | Returns time intervals not available for bookings because of configuration of [[Plugins#Limit bookings|Limit bookings]] |
| + | plugin for period of time. Returns empty array if plugin not available. |
| + | |
| + | |
| ---- | | ---- |
− | ====getCompanyParam====
| |
| | | |
− | <code>getCompanyParam(key)</code>
| + | === getBookingRevenue === |
| | | |
− | Params:
| + | <code>getBookingRevenue($dateStart, $dateEnd, $unitGroupId, $serviceId)</code> |
− | * '''key''' string
| |
| | | |
− | Returns string.
| + | Parameters: |
| | | |
− | <code>getCompanyParam</code> API method returns configuration value for specified key. Method return invalid params error (code [[Errors handling#Error codes|-32602]]) in case if specified key not allowed. See [[#Company_params|list of available keys]].
| + | * '''$dateStart''' null |
| + | * '''$dateEnd''' null |
| + | * '''$unitGroupId''' integer |
| + | * '''$serviceId''' integer |
| + | |
| + | Returns Array. |
| + | |
| + | Return bookings count and revenue value for each date in specified period. Data grouped by unit id and |
| + | represented as array with bookings count at index 0 and revenue amount at index 1. You can filter data either |
| + | by unit or by service.Example: |
| + | ['2015-11-12' : { |
| + | 3 : [ |
| + | 11, // bookings count |
| + | 128.53 // revenue |
| + | ]} |
| | | |
| | | |
| ---- | | ---- |
| | | |
− | ====getPluginStatuses==== | + | === getBookingStats === |
| | | |
− | <code>getPluginStatuses(pluginNames)</code> | + | <code>getBookingStats($groupBy)</code> |
| | | |
− | Params:
| + | Parameters: |
| | | |
− | * '''pluginNames''' an array of strings | + | * '''$groupBy''' String |
| | | |
− | Returns an associative array with strings as keys and booleans as values. | + | Returns Array. |
| + | |
| + | Get bookings stats |
| | | |
− | Returns an associative array (a JSON object) with values from <code>pluginNames</code> parameter as keys and boolean values for each plugin. See [[Company public service methods#pluginName|list of available plugin names]].
| |
| | | |
| ---- | | ---- |
| | | |
− | ====isPluginActivated==== | + | === getBookings === |
| | | |
− | <code>isPluginActivated(pluginName)</code> | + | <code>getBookings($params)</code> |
| | | |
− | Params:
| + | Parameters: |
− | * '''pluginName''' string
| |
| | | |
− | Returns boolean (1 or 0).
| + | * '''$params''' |
| | | |
− | Return plugin status true if status active, else false. <code>pluginName</code> parameter is a plugin. See [[Company public service methods#Plugin's identifiers|list of available plugin names]].
| + | Returns Array. |
| | | |
− | ==Constants== | + | Returns list of bookings filtered by given params. Filter params represented as object with following fields:* '''date_from''' a date of booking in string format 'Y-m-d' |
| + | * '''time_from''' a time string in format 'H:i:s' |
| + | * '''date_to''' a date string in format 'Y-m-d' |
| + | * '''time_to''' a time string in format 'H:i:s' |
| + | * '''created_date_from''' a date string in format 'Y-m-d' |
| + | * '''created_date_to''' a date string in format 'Y-m-d' |
| + | * '''unit_group_id''' an integer. Use it to get bookings assigned for certain service provider. |
| + | * '''event_id''' an integer. Use it to get bookings only for certain service. |
| + | * '''is_confirmed''' 1 or 0. If [[Plugins#Approve booking|Approve booking]] plugin enabled then method will return confirmed bookings with approve status 'new'. |
| + | * '''client_id''' an integer. Use it to get bookings only for certain client. |
| + | * '''order''' string either 'record_date', 'date_start' or 'date_start_asc'. By default used 'date_start' value. |
| + | * '''booking_type''' a string. Value of this fiend depends on Approve booking plugin. |
| + | If plugin not active: |
| + | ** '''all''' for all bookings (default value) |
| + | ** '''cancelled''' alias to 'is_confirmed' equal to 0 |
| + | ** '''non_cancelled''' alias to 'is_confirmed' equal to 1 |
| + | If plugin active: |
| + | ** '''all''' for all bookings (default value) |
| + | ** '''cancelled''' returns bookings with 'is_confirmed' field equals to 0 and approve booking status equals to 'cancelled' (or booking does not have any approve status) |
| + | ** '''non_cancelled''' returns bookings with either 'is_confirmed' field equals to 1 or approve booking status equals to 'new' |
| + | ** '''cancelled_by_client''' returns bookings approved by admin but cancelled by client |
| + | ** '''cancelled_by_admin''' returns bookings cancelled by admin |
| + | ** '''non_approved_yet''' returns bookings with approve status 'new' |
| + | ** '''approved''' returns bookings with either 'is_confirmed' field equals to 1 and approve booking status equals to 'approved' (or booking does not have any approve status) |
| + | |
| + | Example: |
| + | { |
| + | "date_from":"2015-12-29", |
| + | "date_to":"2015-12-29", |
| + | "booking_type":"cancelled", |
| + | "event_id":"5", |
| + | "order":"start_date" |
| + | } |
| + | |
| + | |
| + | ---- |
| + | |
| + | === getBookingsZapier === |
| + | |
| + | <code>getBookingsZapier()</code> |
| + | |
| + | No arguments. |
| + | Returns Array. |
| + | |
| + | Returns list of bookings filtered by given params |
| + | |
| + | |
| + | ---- |
| + | |
| + | === getCategoriesList === |
| + | |
| + | <code>getCategoriesList($isPublic)</code> |
| + | |
| + | Parameters: |
| + | |
| + | * '''$isPublic''' Boolean |
| + | |
| + | Returns Array. |
| + | |
| + | Returns company categories list if [[Plugins#Service categories|Service categories plugin]] is activated. Returns |
| + | an error with code -32001 if plugin is not activated. Use [[#isPluginActivated|isPluginActivated('event_category')]] |
| + | API method to check if plugin activated. |
| + | |
| + | |
| + | ---- |
| + | |
| + | === getClient === |
| + | |
| + | <code>getClient($clientId)</code> |
| + | |
| + | Parameters: |
| + | |
| + | * '''$clientId''' |
| + | |
| + | Returns Array. |
| + | |
| + | Get client by id |
| + | |
| + | |
| + | ---- |
| + | |
| + | === getClientComments === |
| + | |
| + | <code>getClientComments($clientId, $shedulerId)</code> |
| + | |
| + | Parameters: |
| + | |
| + | * '''$clientId''' Integer |
| + | * '''$shedulerId''' Integer |
| + | |
| + | Returns Array. |
| + | |
| + | Returns list of all comments for given client |
| + | |
| + | |
| + | ---- |
| + | |
| + | === getClientList === |
| + | |
| + | <code>getClientList($searchString, $limit)</code> |
| + | |
| + | Parameters: |
| + | |
| + | * '''$searchString''' String |
| + | * '''$limit''' Integer |
| + | |
| + | Returns Array. |
| + | |
| + | Get list of clients |
| + | |
| + | |
| + | ---- |
| + | |
| + | === getCompanyCurrency === |
| + | |
| + | <code>getCompanyCurrency()</code> |
| + | |
| + | No arguments. |
| + | Returns String. |
| + | |
| + | Returns company currency |
| + | |
| + | |
| + | ---- |
| + | |
| + | === getCompanyInfo === |
| + | |
| + | <code>getCompanyInfo()</code> |
| + | |
| + | No arguments. |
| + | Returns Object. |
| + | |
| + | Returns company information |
| + | |
| + | |
| + | ---- |
| + | |
| + | === getCompanyParam === |
| + | |
| + | <code>getCompanyParam($key)</code> |
| + | |
| + | Parameters: |
| + | |
| + | * '''$key''' String |
| + | |
| + | Returns mixed. |
| + | |
| + | Returns company config value for key. A different set of keys available for public API and for company |
| + | administration API. Method return 'invalid params' error (code -32602) in case if access to specified key not |
| + | allowed. See [[#Company_params|list of available keys]]. |
| + | |
| + | |
| + | ---- |
| + | |
| + | === getCountryList === |
| + | |
| + | <code>getCountryList()</code> |
| + | |
| + | No arguments. |
| + | Returns Array. |
| + | |
| + | Get list of all countries |
| + | |
| + | |
| + | ---- |
| + | |
| + | === getCountryPhoneCodes === |
| + | |
| + | <code>getCountryPhoneCodes()</code> |
| + | |
| + | No arguments. |
| + | Returns Array. |
| + | |
| + | Returns country phone code list |
| + | |
| + | |
| + | ---- |
| + | |
| + | === getCurrentTariffInfo === |
| + | |
| + | <code>getCurrentTariffInfo()</code> |
| + | |
| + | No arguments. |
| + | Returns Array. |
| + | |
| + | Return all information about current tariff |
| + | |
| + | |
| + | ---- |
| + | |
| + | === getCurrentUserDetails === |
| + | |
| + | <code>getCurrentUserDetails()</code> |
| + | |
| + | No arguments. |
| + | Returns Array. |
| + | |
| + | Returns current logged user info |
| + | |
| + | |
| + | ---- |
| + | |
| + | === getEventList === |
| + | |
| + | <code>getEventList($isVisibleOnly, $asArray)</code> |
| + | |
| + | Parameters: |
| + | |
| + | * '''$isVisibleOnly''' Boolean |
| + | * '''$asArray''' Boolean |
| + | |
| + | Returns Array. |
| + | |
| + | Returns company events list |
| + | |
| + | |
| + | ---- |
| + | |
| + | === getFeedbacks === |
| + | |
| + | <code>getFeedbacks($approvedOnly, $reviewsOnly, $lastOnly, $limit)</code> |
| + | |
| + | Parameters: |
| + | |
| + | * '''$approvedOnly''' Boolean |
| + | * '''$reviewsOnly''' Boolean |
| + | * '''$lastOnly''' Boolean |
| + | * '''$limit''' Integer |
| + | |
| + | Returns Array. |
| + | |
| + | Get list of feedbacks |
| + | |
| + | |
| + | ---- |
| + | |
| + | === getFirstWorkingDay === |
| + | |
| + | <code>getFirstWorkingDay($unitId)</code> |
| + | |
| + | Parameters: |
| + | |
| + | * '''$unitId''' Integer |
| + | |
| + | Returns String. |
| + | |
| + | Returns first working date for unit |
| + | |
| + | |
| + | ---- |
| + | |
| + | === getGoogleCalendarBusyTime === |
| + | |
| + | <code>getGoogleCalendarBusyTime($startDateTime, $endDateTime, $unitId)</code> |
| + | |
| + | Parameters: |
| + | |
| + | * '''$startDateTime''' string |
| + | * '''$endDateTime''' string |
| + | * '''$unitId''' integer |
| + | |
| + | Returns Array. |
| + | |
| + | Return busy time by unit id by GoogleCalendar plugin if enabled.If cache is not expired will return from cache, else load from google and save to cache |
| + | |
| + | |
| + | ---- |
| + | |
| + | === getGoogleCalendarBusyTimeAvailableUnits === |
| + | |
| + | <code>getGoogleCalendarBusyTimeAvailableUnits()</code> |
| + | |
| + | No arguments. |
| + | Returns Array. |
| + | |
| + | Returns configured unit ids, allowed to sync busy time |
| + | |
| + | |
| + | ---- |
| + | |
| + | === getLastNotificationUpdate === |
| + | |
| + | <code>getLastNotificationUpdate($type)</code> |
| + | |
| + | Parameters: |
| + | |
| + | * '''$type''' String |
| + | |
| + | Returns String. |
| + | |
| + | Returns last update datetime |
| + | |
| + | |
| + | ---- |
| + | |
| + | === getLocationsList === |
| + | |
| + | <code>getLocationsList($isPublic)</code> |
| + | |
| + | Parameters: |
| + | |
| + | * '''$isPublic''' Boolean |
| + | |
| + | Returns Array. |
| + | |
| + | Returns available locations for company if plugin [[Plugins#Unit location plugin]] is activated. Return an error |
| + | with code -32001 if plugin is not activated. Use [[#isPluginActivated|isPluginActivated('location')]] API method |
| + | to check if plugin activated. |
| + | |
| + | |
| + | ---- |
| + | |
| + | === getPluginList === |
| + | |
| + | <code>getPluginList()</code> |
| + | |
| + | No arguments. |
| + | Returns Array. |
| + | |
| + | Get list of plugins with status |
| + | |
| + | |
| + | ---- |
| + | |
| + | === getPluginStatuses === |
| + | |
| + | <code>getPluginStatuses($pluginNames)</code> |
| + | |
| + | Parameters: |
| + | |
| + | * '''$pluginNames''' Array |
| + | |
| + | Returns Array. |
| + | |
| + | Return plugin status true if status active, else false. See [[#Plugin's identifiers|list of available plugin's names]]. |
| + | |
| + | |
| + | ---- |
| + | |
| + | === getRecentActions === |
| + | |
| + | <code>getRecentActions($lastOnly, $limit)</code> |
| + | |
| + | Parameters: |
| + | |
| + | * '''$lastOnly''' Boolean |
| + | * '''$limit''' Integer |
| + | |
| + | Returns Array. |
| + | |
| + | Returns latest actions |
| + | |
| + | |
| + | ---- |
| + | |
| + | === getRecurringDatetimes === |
| + | |
| + | <code>getRecurringDatetimes($eventId, $unitId, $date, $time, $recurringData, $endDateTime)</code> |
| + | |
| + | Parameters: |
| + | |
| + | * '''$eventId''' Integer |
| + | * '''$unitId''' Integer |
| + | * '''$date''' String |
| + | * '''$time''' String |
| + | * '''$recurringData''' Array |
| + | * '''$endDateTime''' null |
| + | |
| + | Returns Array. |
| + | |
| + | Get list of dates for recurring booking |
| + | |
| + | |
| + | ---- |
| + | |
| + | === getRecurringSettings === |
| + | |
| + | <code>getRecurringSettings($eventId)</code> |
| + | |
| + | Parameters: |
| + | |
| + | * '''$eventId''' Integer |
| + | |
| + | Returns Array. |
| + | |
| + | Get recurring settings for event |
| + | |
| + | |
| + | ---- |
| + | |
| + | === getRegistrations === |
| + | |
| + | <code>getRegistrations($groupBy)</code> |
| + | |
| + | Parameters: |
| + | |
| + | * '''$groupBy''' String |
| + | |
| + | Returns Array. |
| + | |
| + | Get number of registration grouped by day/week/month |
| + | |
| + | |
| + | ---- |
| + | |
| + | === getReservedTime === |
| + | |
| + | <code>getReservedTime($from, $to, $eventId, $unitId, $count)</code> |
| + | |
| + | Parameters: |
| + | |
| + | * '''$from''' String |
| + | * '''$to''' String |
| + | * '''$eventId''' Integer |
| + | * '''$unitId''' Integer |
| + | * '''$count''' Integer |
| + | |
| + | Returns Object. |
| + | |
| + | Returns not available time |
| + | Eg.: <code>{'2014-05-14': [{'events': [{'from': '14:00', 'to': '14:30'}], 'type': "reserved_time"}, ...], ...}</code> |
| + | |
| + | |
| + | ---- |
| + | |
| + | === getSocialCounterStats === |
| + | |
| + | <code>getSocialCounterStats($provider)</code> |
| + | |
| + | Parameters: |
| + | |
| + | * '''$provider''' String |
| + | |
| + | Returns Integer. |
| + | |
| + | Returns social counters value for your domain |
| + | |
| + | |
| + | ---- |
| + | |
| + | === getStartTimeMatrix === |
| + | |
| + | <code>getStartTimeMatrix($from, $to, $eventId, $unitId, $count)</code> |
| + | |
| + | Parameters: |
| + | |
| + | * '''$from''' String |
| + | * '''$to''' String |
| + | * '''$eventId''' Integer |
| + | * '''$unitId''' Mixedcan be Integer or Array of Integers |
| + | * '''$count''' Integer |
| + | |
| + | Returns Object. |
| + | |
| + | Returns available start time, taking into account breaktimes, start and end working time |
| + | Eg.: <code>{'2014-05-14': ['09:00:00', ...], ...}</code> |
| + | |
| + | If locations plugin activated for company you should pass a list as $unitID parameter for filter results with |
| + | units available only for selected location. See [[Plugins#Unit_location|Unit location]] plugin description for |
| + | more details. |
| + | |
| + | |
| + | ---- |
| + | |
| + | === getStatuses === |
| + | |
| + | <code>getStatuses()</code> |
| + | |
| + | No arguments. |
| + | Returns Array. |
| + | |
| + | Return list of available statuses |
| + | |
| + | |
| + | ---- |
| + | |
| + | === getTimeframe === |
| + | |
| + | <code>getTimeframe()</code> |
| + | |
| + | No arguments. |
| + | Returns Integer. |
| + | |
| + | Returns company timeframe |
| + | |
| + | |
| + | ---- |
| + | |
| + | === getTopPerformers === |
| + | |
| + | <code>getTopPerformers()</code> |
| + | |
| + | No arguments. |
| + | Returns Array. |
| + | |
| + | Get list of performers with number of bookings and revenues per service |
| + | |
| + | |
| + | ---- |
| + | |
| + | === getTopServices === |
| + | |
| + | <code>getTopServices($dateStart, $dateEnd)</code> |
| + | |
| + | Parameters: |
| + | |
| + | * '''$dateStart''' String |
| + | * '''$dateEnd''' String |
| + | |
| + | Returns Array. |
| + | |
| + | Get list of services with number of bookings and revenues per service |
| + | |
| + | |
| + | ---- |
| + | |
| + | === getUnitList === |
| + | |
| + | <code>getUnitList($isVisibleOnly, $asArray)</code> |
| + | |
| + | Parameters: |
| + | |
| + | * '''$isVisibleOnly''' Boolean |
| + | * '''$asArray''' Boolean |
| + | |
| + | Returns Array. |
| + | |
| + | Returns service performrs list |
| + | |
| + | |
| + | ---- |
| + | |
| + | === getUnitWorkdayInfo === |
| + | |
| + | <code>getUnitWorkdayInfo($dateStart, $dateEnd, $unitGroupId)</code> |
| + | |
| + | Parameters: |
| + | |
| + | * '''$dateStart''' |
| + | * '''$dateEnd''' |
| + | * '''$unitGroupId''' integer |
| + | |
| + | Returns Array. |
| + | |
| + | Return workday info (date_start and date_end) |
| + | |
| + | |
| + | ---- |
| + | |
| + | === getUnitWorkingDurations === |
| + | |
| + | <code>getUnitWorkingDurations($dateStart, $dateEnd, $unitGroupId)</code> |
| + | |
| + | Parameters: |
| + | |
| + | * '''$dateStart''' null |
| + | * '''$dateEnd''' null |
| + | * '''$unitGroupId''' integer |
| + | |
| + | Returns Array. |
| + | |
| + | Return working durations |
| + | |
| + | |
| + | ---- |
| + | |
| + | === getVisitorStats === |
| + | |
| + | <code>getVisitorStats($groupBy)</code> |
| + | |
| + | Parameters: |
| + | |
| + | * '''$groupBy''' String |
| + | |
| + | Returns Array. |
| + | |
| + | Get visitor stats |
| + | |
| + | |
| + | ---- |
| + | |
| + | === getWorkCalendar === |
| + | |
| + | <code>getWorkCalendar($year, $month, $unitId)</code> |
| + | |
| + | Parameters: |
| + | |
| + | * '''$year''' Integer |
| + | * '''$month''' Integer |
| + | * '''$unitId''' Integer |
| + | |
| + | Returns Object. |
| + | |
| + | Returns company work schedule as array |
| + | Eg.: <code>{'2014-05-01': {'from': '09:00:00', 'to': '21:00:00', 'is_day_off': '0'}, '2014-05-02': ...}</code> |
| + | |
| + | |
| + | ---- |
| + | |
| + | === getWorkDaysInfo === |
| + | |
| + | <code>getWorkDaysInfo($from, $to, $unitId, $eventId)</code> |
| + | |
| + | Parameters: |
| + | |
| + | * '''$from''' String |
| + | * '''$to''' String |
| + | * '''$unitId''' Integer |
| + | * '''$eventId''' null |
| + | |
| + | Returns Object. |
| + | |
| + | Returns working time for date period, taking into account breaktimes |
| + | Eg.: <code>{'2014-05-14': [{'from': '09:00:00', 'to': '10:00:00'}, ...], ...}</code> |
| + | |
| + | |
| + | ---- |
| + | |
| + | === getWorkDaysTimes === |
| + | |
| + | <code>getWorkDaysTimes($startDateTime, $endDateTime)</code> |
| + | |
| + | Parameters: |
| + | |
| + | * '''$startDateTime''' string |
| + | * '''$endDateTime''' string |
| + | |
| + | Returns Array. |
| + | |
| + | Return busy time by unit id by GoogleCalendar plugin if enabled.If cache is not expired will return from cache, else load from google and save to cache |
| + | |
| + | |
| + | ---- |
| + | |
| + | === getWorkload === |
| + | |
| + | <code>getWorkload($dateStart, $dateEnd, $unitGroupId)</code> |
| + | |
| + | Parameters: |
| + | |
| + | * '''$dateStart''' null |
| + | * '''$dateEnd''' null |
| + | * '''$unitGroupId''' integer |
| + | |
| + | Returns Array. |
| + | |
| + | Return workload data for units in period of time. Workload for each unit represented as array with work hours |
| + | at index 0, confirmed booking hours as load at index 1 and cancelled bookings hours at index 2.Example: |
| + | ['2015-10-21' : { |
| + | 5 : [ |
| + | 10, // working hours |
| + | 10, // load hours (confirmed bookings hours) |
| + | 0 // cancelled bookings hours |
| + | ] }] |
| + | |
| + | |
| + | ---- |
| + | |
| + | === isPluginActivated === |
| + | |
| + | <code>isPluginActivated($pluginName)</code> |
| + | |
| + | Parameters: |
| + | |
| + | * '''$pluginName''' String |
| + | |
| + | Returns Boolean. |
| + | |
| + | Return plugin status true if status active, else false. <var>$pluginName</var> parameter is a plugin identifier.See [[Plugins|plugins]] page for full plugins description. See [[#Plugin's identifiers|list of available plugin's names]]. |
| + | |
| + | |
| + | ---- |
| + | |
| + | === pluginApproveBookingApprove === |
| + | |
| + | <code>pluginApproveBookingApprove($id)</code> |
| + | |
| + | Parameters: |
| + | |
| + | * '''$id''' Integer |
| + | |
| + | Returns Array. |
| + | |
| + | Approve booking (approve booking plugin) |
| + | Return approved booking ids |
| + | |
| + | |
| + | ---- |
| + | |
| + | === pluginApproveBookingCancel === |
| + | |
| + | <code>pluginApproveBookingCancel($id)</code> |
| + | |
| + | Parameters: |
| + | |
| + | * '''$id''' Integer |
| + | |
| + | Returns Boolean. |
| + | |
| + | Cancel booking (approve booking plugin) |
| + | |
| + | |
| + | ---- |
| + | |
| + | === pluginApproveGetPendingBookings === |
| + | |
| + | <code>pluginApproveGetPendingBookings()</code> |
| + | |
| + | No arguments. |
| + | Returns array. |
| + | |
| + | Return list of all pending bookings |
| + | |
| + | |
| + | ---- |
| + | |
| + | === pluginApproveGetPendingBookingsCount === |
| + | |
| + | <code>pluginApproveGetPendingBookingsCount()</code> |
| + | |
| + | No arguments. |
| + | Returns Integer. |
| + | |
| + | Return count of pending bookings |
| + | |
| + | |
| + | ---- |
| + | |
| + | === setBookingComment === |
| + | |
| + | <code>setBookingComment($id, $comment)</code> |
| + | |
| + | Parameters: |
| + | |
| + | * '''$id''' Integer |
| + | * '''$comment''' String |
| + | |
| + | Returns Integer. |
| + | |
| + | Set booking comment |
| + | |
| + | |
| + | ---- |
| + | |
| + | === setStatus === |
| + | |
| + | <code>setStatus($bookingId, $statusId)</code> |
| + | |
| + | Parameters: |
| + | |
| + | * '''$bookingId''' Integer |
| + | * '''$statusId''' Integer |
| + | |
| + | Returns Boolean. |
| + | |
| + | Set status |
| + | |
| + | |
| + | ---- |
| + | |
| + | === updateNotification === |
| + | |
| + | <code>updateNotification($type)</code> |
| + | |
| + | Parameters: |
| + | |
| + | * '''$type''' String |
| + | |
| + | Returns . |
| + | |
| + | Mark notifications as readed |
| + | |
| + | |
| + | ---- |
| + | |
| + | |
| + | == Constants == |
| + | |
| + | ==== Error codes ==== |
| + | |
| + | * ERROR_BOOKING_ACCESS_DENIED |
| + | * ERROR_PLUGIN_DISABLED |
| + | * ERROR_EVENT_ID_VALUE |
| + | * ERROR_UNIT_ID_VALUE |
| + | * ERROR_DATE_VALUE |
| + | * ERROR_TIME_VALUE |
| + | * ERROR_RECURRENT_BOOKING |
| + | * ERROR_LIMIT_BOOKING |
| + | * ERROR_CLIENT_NAME_VALUE |
| + | * ERROR_CLIENT_EMAIL_VALUE |
| + | * ERROR_CLIENT_PHONE_VALUE |
| + | * ERROR_CLIENT_ID |
| + | * ERROR_ADDITIONAL_FIELDS |
| + | * ERROR_APPOINTMENT_NOT_FOUND |
| + | * ERROR_SIGN |
| + | * ERROR_APPLICATION_CONFIRMATION |
| + | * ERROR_BATCH_NOT_FOUND |
| + | * ERROR_UNSUPPORTED_PAYMENT_SYSTEM |
| + | * ERROR_PAYMENT_FAILED |
| + | * ERROR_REQUIRED_PARAMS_MISSED |
| + | * ERROR_PARAMS_IS_NOT_ARRAY |
| + | * ERROR_PARAMS_SHEDULER_ID |
| + | * ERROR_PROMOCODE_INVALID |
| + | * ERROR_PROMOCODE_EXPIRED |
| + | * ERROR_PROMOCODE_NOT_ACTIVE_YET |
| + | * ERROR_PROMOCODE_INVALID_SERVICE |
| + | * ERROR_PROMOCODE_COUNT_EXCEED |
| + | * ERROR_PROMOCODE_COUNT_PER_CUSTOMER_EXCEED |
| + | * ERROR_PROMOCODE_INVALID_BOOKING_DATETIME |
| + | * DATETIME_FORMAT |
| + | * DATE_FORMAT |
| + | * RECURRENT_BOOKING_BATCH |
| + | * GROUP_BOOKING_BATCH |
| + | * MULTIPLE_BOOKING_BATCH |
| | | |
| ====Company params==== | | ====Company params==== |
Line 193: |
Line 1,353: |
| * zooz_app_id | | * zooz_app_id |
| * zooz_app_key | | * zooz_app_key |
| + | ---- |
| + | |
| + | ====Plugin's identifiers==== |
| + | |
| + | Plugin identifier is a string constant which represents a plugin in system. These constants used in <code>[[#isPluginActivated|isPluginActivated]]</code> and <code>[[#getPluginStatuses|getPluginStatuses]]</code> API methods. |
| + | |
| + | * advanced_notification |
| + | *:Book Soon notification system plugin |
| + | * any_unit |
| + | *:Any Employee selector plugin |
| + | * api |
| + | *:API plugin |
| + | * approve_booking |
| + | *:Approve booking plugin |
| + | * back_to_site |
| + | *:Take me back home plugin |
| + | * contact_widget |
| + | *:Contact widget plugin |
| + | * counter |
| + | *:Visitor Counter plugin |
| + | * custom_css |
| + | *:Custom CSS plugin |
| + | * data_security |
| + | *:Clean history plugin |
| + | * description |
| + | *:HTML description field for events |
| + | * event_category |
| + | *:Service categories plugin |
| + | * event_field |
| + | *:Additional fields plugin |
| + | * facebookImage |
| + | *:Facebook client info plugin |
| + | * financial_dashboard |
| + | *:Insights plugin |
| + | * google_analytics |
| + | *:Google Adwords and analytics plugin |
| + | * google_calendar_export |
| + | *:Google calendar sync plugin |
| + | * group_booking |
| + | *:Group bookings plugin |
| + | * hipaa |
| + | *:HIPAA plugin |
| + | * limit_bookings |
| + | *:Limit bookings plugin |
| + | * location |
| + | *:Unit location plugin |
| + | * mobile_app_backend |
| + | *:Mobile application plugin |
| + | * multiple_booking |
| + | *:Multiple bookings plugin |
| + | * news |
| + | *:News plugin |
| + | * paid_events |
| + | *:Accept payments plugin |
| + | * promo |
| + | *:Simply Smart Promotions plugin |
| + | * recap |
| + | *:Daily report plugin |
| + | * secure |
| + | *:SSL plugin |
| + | * status |
| + | *:Status plugin |
| + | * unit_colors |
| + | *:Providers color coding plugin |
| + | * user_license |
| + | *:Terms and conditions plugin |
| + | |
| + | See [[Plugins]] page for description for each plugin. |
| + | ---- |
| + | |
| + | == Examples == |
| + | |
| + | ====getBookingDetails response==== |
| + | |
| + | An example of data returned by [[#getBookingDetails|getBookingDetails]] API method. |
| + | |
| + | { |
| + | "id": "321", |
| + | "event_id": "5", |
| + | "event_name": "Massage", |
| + | "unit_id": "3", |
| + | "unit_name": "John", |
| + | "client_id": "1", |
| + | "client_name": "Bob", |
| + | "start_date_time": "2015-11-25 15:00:00", |
| + | "end_date_time": "2015-11-25 16:00:00", |
| + | "is_confirmed": "1", |
| + | "code": "h8v8w5ls", |
| + | "record_date": "2015-11-19 04:06:38", |
| + | "comment": null, |
| + | "company_login": "testzt", |
| + | "company_name": "My Cool Company", |
| + | "company_phone": "+1-555-55-55", |
| + | "company_email": "into@mycoolcompany.com", |
| + | "additional_fields": [{ |
| + | "value": "on", |
| + | "field_name": "201a89517de509f6b3a60858918faac3", |
| + | "field_title": "Include washing", |
| + | "field_position": "4", |
| + | "field_type": "checkbox", |
| + | "field_id": "4" |
| + | }], |
| + | "comments": [], |
| + | "history": [{ |
| + | "id": "536", |
| + | "sheduler_id": "321", |
| + | "datetime": "2015-11-19 11:06:38", |
| + | "type": "create", |
| + | "user_id": "1", |
| + | "agent": "SimplyBook.me\/55 CFNetwork\/758.0.2 Darwin\/15.0.0", |
| + | "ip": "213.174.0.53, 158.69.224.50:127.0.0.1", |
| + | "referer": "", |
| + | "login": "admin", |
| + | "firstname": "Mikhail", |
| + | "lastname": "" |
| + | }], |
| + | "status": { |
| + | "id": "3", |
| + | "name": "Fancy Status", |
| + | "description": null, |
| + | "color": "4cbadb", |
| + | "is_default": "1" |
| + | }, |
| + | "location": { |
| + | "id": "1", |
| + | "title": "location", |
| + | "description": null, |
| + | "picture": "e1e9409fe9682c78b2f8f294dc151af0.jpg", |
| + | "address1": null, |
| + | "address2": "Saint Margaret Street", |
| + | "city": "\u041b\u043e\u043d\u0434\u043e\u043d", |
| + | "zip": null, |
| + | "country_id": "GB", |
| + | "lat": "51.50013000000000000000", |
| + | "lng": "-0.12630500000000000000", |
| + | "phone": "44", |
| + | "position": "1", |
| + | "is_default": "1" |
| + | }, |
| + | "price": [], |
| + | "promo": false |
| + | } |