Changes

From SimplyBook.me
no edit summary
Line 50: Line 50:  
   }
 
   }
 
</pre>
 
</pre>
      
Example of request with error response:
 
Example of request with error response:
Line 84: Line 83:  
===Authentication===
 
===Authentication===
   −
Using Simplybook API methods require an authentification. To authorize in Simplybook API you need to get an access key — access-token. In order to get this access-token you should call the JSON-RPC method <code>[[Authentication#getUserToken|getUserToken]]</code> API method on https://user-api.simplybook.me/login service passing your personal API-key. You can copy your API-key at admin interface: go to the 'Plugins' link and select [[Plugins#API|API plugin]] 'Settings'.
+
Using Simplybook API methods require an authentification. To authorize in Simplybook API you need to get an access key — access-token. In order to get this access-token you should call the JSON-RPC method <code>[[Authentication#getUserToken|getUserToken]]</code> API method on https://user-api.simplybook.me/login service passing your personal API-key. You can copy your API-key at admin interface: go to the 'Plugins' link and select [[Plugins#API|API plugin]] 'Settings'.  
    
== Methods ==
 
== Methods ==
Line 100: Line 99:  
Adds new client with specified data. You can specify name, email, phone, address1, address2, city, zip,
 
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
 
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
+
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.
 
<code>getCompanyParam('require_fields')</code> method to check which fields are required.
   Line 177: Line 178:  
specify either <code>count</code> more then 1 or valid <code>batchId</code> (only one parameter can be
 
specify either <code>count</code> more then 1 or valid <code>batchId</code> (only one parameter can be
 
specified). You should specify an <code>$additionalFields</code> parameter if service requires some additional
 
specified). You should specify an <code>$additionalFields</code> parameter if service requires some additional
fields (see [[Plugins#Additional fields|Additional fields plugin]]). To create a booking with promo code you
+
fields (see [[Plugins#Additional fields|Additional fields plugin]]).To create a booking with promo code you should pass it as additional field. For example: <code>{"promocode": "some code"}</code>
should pass it as additional field. For example: <code>{"name": "promocode", "value": "some code", "type": "text"}</code>See [[#book response|example]] of <code>book</code> API method response.
+
 
 +
If [[Plugins#Unit location|Unit location]] enabled you need to pass locations ID parameter as additional field
 +
<code>location_id</code>. For example: <code>{"location_id": "1"}</code>. Use <code>[[#isPluginActivated|isPluginActivated('location')]]</code>
 +
to check if plugin active and <code>[[#getLocationsList|getLocationsList()]]</code> method to get list of
 +
available locations.
 +
 
 +
See [[#book response|example]] of <code>book</code> API method response.
    
See also:
 
See also:
    
* [http://wiki.simplybook.me/index.php/Settings#Timeframe Timeframe information]
 
* [http://wiki.simplybook.me/index.php/Settings#Timeframe Timeframe information]
  −
----
  −
  −
=== calculateEndTime ===
  −
  −
<code>calculateEndTime($startDateTime, $eventId, $unitId)</code>
  −
  −
Parameters:
  −
  −
* '''$startDateTime''' String a 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
  −
      
----
 
----
Line 233: Line 223:  
Cancels booking. Returns true on success. Returns an error with code -32080 (Appointment couldn't be found) if
 
Cancels booking. Returns true on success. Returns an error with code -32080 (Appointment couldn't be found) if
 
no booking with specified id were found.
 
no booking with specified id were found.
  −
  −
----
  −
  −
=== createBatch ===
  −
  −
<code>createBatch()</code>
  −
  −
No arguments.
  −
Returns Integer.
  −
  −
Creates new booking batch record. Returns newly created batch id. You can use this id in <code>[[#book|book]]</code>
  −
API method.
        Line 306: Line 283:  
----
 
----
   −
=== getAdditionalFields ===
+
=== getBookingCancellationsInfo ===
   −
<code>getAdditionalFields($eventId)</code>
+
<code>getBookingCancellationsInfo($dateStart, $dateEnd)</code>
    
Parameters:
 
Parameters:
   −
* '''$eventId''' Integer
+
* '''$dateStart''' String a date string in format 'Y-m-d'. Pass null to get data from first day of current week.
 +
* '''$dateEnd''' String a date string in format 'Y-m-d'. Pass null to get data filtered to last day of current week.
    
Returns Array.
 
Returns Array.
   −
Return additional fields for certain event if [[Plugins#Additional_fields|Additional fields plugin]] is
+
Returns statistics about created bookings and cancellations for a time period. Data presented as array of hashes for
activated. Returns empty array otherwise. Call <code>[[#isPluginActivated|isPluginActivated('event_field')]]</code>
+
each type of operation (created or cancelled booking) groped by clients. <code>"type"</code> field can be either
API method to check if 'event_field' plugin activated.
+
"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
 +
  }]
       
----
 
----
   −
=== getAnyUnitData ===
+
=== getBookingComment ===
 +
 
 +
<code>getBookingComment($id)</code>
   −
<code>getAnyUnitData()</code>
+
Parameters:
   −
No arguments.
+
* '''$id''' Integer
Returns Object|null.
+
 
 +
Returns String.
   −
Returns information about [[Plugins#Any_Employee_selector|Any Employee selector plugin]] configuration. Returns
+
Returns booking comment
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 ===
+
=== getBookingDetails ===
   −
<code>getAvailableUnits($eventId, $dateTime, $count)</code>
+
<code>getBookingDetails($id)</code>
    
Parameters:
 
Parameters:
   −
* '''$eventId''' Integer
+
* '''$id''' integer booking id
* '''$dateTime''' String a date and time string in format 'Y-m-d H:i:s'
  −
* '''$count''' Integer
      
Returns Array.
 
Returns Array.
   −
Returns list of available unit ids for specified date and service or empty array if all units are not allowed.Eg.: <code>[1, 2, 3]</code>
+
Returns detailed bookings object by booking id. See [[#getBookingDetails_response|response example]].
       
----
 
----
   −
=== getBookingCancellationsInfo ===
+
=== getBookingLimitUnavailableTimeInterval ===
   −
<code>getBookingCancellationsInfo($dateStart, $dateEnd)</code>
+
<code>getBookingLimitUnavailableTimeInterval($startDateTime, $endDateTime, $eventId)</code>
    
Parameters:
 
Parameters:
   −
* '''$dateStart''' String a date string in format 'Y-m-d'. Pass null to get data from first day of current week.
+
* '''$startDateTime''' string a date and time string in format 'Y-m-d H:i:s'
* '''$dateEnd''' String a date string in format 'Y-m-d'. Pass null to get data filtered to last day of current week.
+
* '''$endDateTime''' string a date and time string in format 'Y-m-d H:i:s'
 +
* '''$eventId''' integer
    
Returns Array.
 
Returns Array.
   −
Returns statistics about created bookings and cancellations for a time period. Data presented as array of hashes for
+
Returns time intervals not available for bookings because of configuration of [[Plugins#Limit bookings|Limit bookings]]
each type of operation (created or cancelled booking) groped by clients. <code>"type"</code> field can be either
+
plugin for period of time. Returns empty array if plugin not available.
"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 ===
+
=== getBookingRevenue ===
   −
<code>getBookingComment($id)</code>
+
<code>getBookingRevenue($dateStart, $dateEnd, $unitGroupId, $serviceId)</code>
    
Parameters:
 
Parameters:
   −
* '''$id''' Integer
+
* '''$dateStart''' string a date string in format 'Y-m-d'.
 +
* '''$dateEnd''' string a date string in format 'Y-m-d'
 +
* '''$unitGroupId''' integer
 +
* '''$serviceId''' integer
 +
 
 +
Returns Array.
   −
Returns String.
+
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. Set <code>$dateStart</code> and <code>$dateEnd</code> to null to get data for current week.
   −
Returns booking comment
+
Example:
 +
  ['2015-11-12' : {
 +
    3 : [
 +
      11, // bookings count
 +
      128.53 // revenue
 +
  ]}
       
----
 
----
   −
=== getBookingDetails ===
+
=== getBookingStats ===
   −
<code>getBookingDetails($id)</code>
+
<code>getBookingStats($groupBy)</code>
    
Parameters:
 
Parameters:
   −
* '''$id''' integer booking id
+
* '''$groupBy''' String either 'day', 'week' or 'month'
    
Returns Array.
 
Returns Array.
   −
Returns detailed bookings object by booking id. See [[#getBookingDetails_response|response example]].
+
Returns statistic about bookings count grouped by 'day', 'week' or 'month'. A time period depends on selected
 +
grouping parameter:
 +
 
 +
* for 'day' methods returns statistics for last 31 days
 +
* for 'week' methods returns data last 10 weeks period
 +
* for 'month' time period is last 12 months
       
----
 
----
   −
=== getBookingLimitUnavailableTimeInterval ===
+
=== getBookings ===
   −
<code>getBookingLimitUnavailableTimeInterval($startDateTime, $endDateTime, $eventId)</code>
+
<code>getBookings($params)</code>
    
Parameters:
 
Parameters:
   −
* '''$startDateTime''' string a date and time string in format 'Y-m-d H:i:s'
+
* '''$params'''
* '''$endDateTime''' string a date and time string in format 'Y-m-d H:i:s'
  −
* '''$eventId''' integer
      
Returns Array.
 
Returns Array.
   −
Returns time intervals not available for bookings because of configuration of [[Plugins#Limit bookings|Limit bookings]]
+
Returns list of bookings filtered by given params. Filter params represented as object with following fields:
plugin for period of time. Returns empty array if plugin not available.
      +
* '''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 field depends on Approve booking plugin status.
 +
*: 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:
 
+
  {
=== getBookingRevenue ===
+
    "date_from":"2015-12-29",
 
+
    "date_to":"2015-12-29",
<code>getBookingRevenue($dateStart, $dateEnd, $unitGroupId, $serviceId)</code>
+
    "booking_type":"cancelled",
 
+
    "event_id":"5",
Parameters:
+
    "order":"start_date"
 
+
  }
* '''$dateStart''' string a date string in format 'Y-m-d'.
+
 
* '''$dateEnd''' string a date string in format 'Y-m-d'
+
 
* '''$unitGroupId''' integer
+
----
* '''$serviceId''' integer
+
 
 +
=== getBookingsZapier ===
 +
 
 +
<code>getBookingsZapier()</code>
    +
No arguments.
 
Returns Array.
 
Returns Array.
   −
Return bookings count and revenue value for each date in specified period. Data grouped by unit id and
+
Returns list of bookings filtered by given params
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. Set <code>$dateStart</code> and <code>$dateEnd</code> to null to get data for current week.Example:
  −
  ['2015-11-12' : {
  −
    3 : [
  −
      11, // bookings count
  −
      128.53 // revenue
  −
  ]}
         
----
 
----
   −
=== getBookingStats ===
+
=== getClient ===
   −
<code>getBookingStats($groupBy)</code>
+
<code>getClient($clientId)</code>
    
Parameters:
 
Parameters:
   −
* '''$groupBy''' String either 'day', 'week' or 'month'
+
* '''$clientId'''
    
Returns Array.
 
Returns Array.
   −
Returns statistic about bookings count grouped by 'day', 'week' or 'month'. A time period depends on selected
+
Returns client's data object. See <code>[[#addClient|addClient]]</code> API method for list of available fields
grouping parameter:
+
of client data object.
 
  −
* for 'day' methods returns statistics for last 31 days
  −
* for 'week' methods returns data last 10 weeks period
  −
* for 'month' time period is last 12 months
         
----
 
----
   −
=== getBookings ===
+
=== getClientComments ===
   −
<code>getBookings($params)</code>
+
<code>getClientComments($clientId, $shedulerId)</code>
    
Parameters:
 
Parameters:
   −
* '''$params'''
+
* '''$clientId''' Integer
 +
* '''$shedulerId''' Integer
    
Returns Array.
 
Returns Array.
   −
Returns list of bookings filtered by given params. Filter params represented as object with following fields:
+
Returns list of all comments for given client
 +
 
 +
 
 +
----
   −
* '''date_from''' a date of booking in string format 'Y-m-d'
+
=== getClientList ===
* '''time_from''' a time string in format 'H:i:s'
+
 
* '''date_to''' a date string in format 'Y-m-d'
+
<code>getClientList($searchString, $limit)</code>
* '''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 field depends on Approve booking plugin status.
  −
*: 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:
+
Parameters:
  {
+
 
    "date_from":"2015-12-29",
+
* '''$searchString''' String
    "date_to":"2015-12-29",
+
* '''$limit''' Integer
    "booking_type":"cancelled",
+
 
    "event_id":"5",
+
Returns Array.
    "order":"start_date"
+
 
  }
+
Returns list of clients associated with company. You can use either phone number, email address or name as value
 +
for <code>$searchString</code>. Pass an empty string for <code>$searchString</code> and null for <code>$limit</code>
 +
parameters to get all records. See <code>[[#addClient|addClient]]</code> API method for list of available fields
 +
of client data object.
       
----
 
----
   −
=== getBookingsZapier ===
+
=== getCompanyCurrency ===
   −
<code>getBookingsZapier()</code>
+
<code>getCompanyCurrency()</code>
    
No arguments.
 
No arguments.
Returns Array.
+
Returns String.
   −
Returns list of bookings filtered by given params
+
Returns company's currency as three chars code (ISO 4217).
       
----
 
----
   −
=== getCategoriesList ===
+
=== getCountryList ===
   −
<code>getCategoriesList($isPublic)</code>
+
<code>getCountryList()</code>
 
  −
Parameters:
  −
 
  −
* '''$isPublic''' Boolean
      +
No arguments.
 
Returns Array.
 
Returns Array.
   −
Returns company categories list if [[Plugins#Service categories|Service categories plugin]] is activated. Returns
+
Get list of all countries
an error with code -32001 if plugin is not activated. Use <code>[[#isPluginActivated|isPluginActivated('event_category')]]</code>
  −
API method to check if plugin activated.
         
----
 
----
   −
=== getClient ===
+
=== getCurrentTariffInfo ===
   −
<code>getClient($clientId)</code>
+
<code>getCurrentTariffInfo()</code>
   −
Parameters:
+
No arguments.
 
+
Returns Array.
* '''$clientId''' 
     −
Returns Array.
+
Returns all information about current tariff (subscription). For example:
   −
Returns client's data object. See <code>[[#addClient|addClient]]</code> API method for list of available fields
+
  {
of client data object.
+
    "name" : "gold",
 +
    "expire_date" : "2016-02-11 12:32:00",
 +
    "rest" : 41, // number of days until subscription expiration
 +
    "color" : "#fcb322"
 +
  }
       
----
 
----
   −
=== getClientComments ===
+
=== getCurrentUserDetails ===
   −
<code>getClientComments($clientId, $shedulerId)</code>
+
<code>getCurrentUserDetails()</code>
 
  −
Parameters:
  −
 
  −
* '''$clientId''' Integer
  −
* '''$shedulerId''' Integer
      +
No arguments.
 
Returns Array.
 
Returns Array.
   −
Returns list of all comments for given client
+
Returns current logged user info
       
----
 
----
   −
=== getClientList ===
+
=== getFeedbacks ===
   −
<code>getClientList($searchString, $limit)</code>
+
<code>getFeedbacks($approvedOnly, $reviewsOnly, $lastOnly, $limit)</code>
    
Parameters:
 
Parameters:
   −
* '''$searchString''' String
+
* '''$approvedOnly''' Boolean
 +
* '''$reviewsOnly''' Boolean
 +
* '''$lastOnly''' Boolean
 
* '''$limit''' Integer  
 
* '''$limit''' Integer  
    
Returns Array.
 
Returns Array.
   −
Returns list of clients associated with company. You can use either phone number, email address or name as value
+
Get list of feedbacks
for <code>$searchString</code>. Pass an empty string for <code>$searchString</code> and null for <code>$limit</code>
  −
parameters to get all records. See <code>[[#addClient|addClient]]</code> API method for list of available fields
  −
of client data object.
         
----
 
----
   −
=== getCompanyCurrency ===
+
=== getGoogleCalendarBusyTime ===
   −
<code>getCompanyCurrency()</code>
+
<code>getGoogleCalendarBusyTime($startDateTime, $endDateTime, $unitId)</code>
   −
No arguments.
+
Parameters:
Returns String.
+
 
 +
* '''$startDateTime''' string a date and time string in format 'Y-m-d H:i:s'
 +
* '''$endDateTime''' string a date and time string in format 'Y-m-d H:i:s'. You can date string avoiding time in
 +
this parameter. In this case method will use time value '23:59:59'.
 +
* '''$unitId''' integer
 +
 
 +
Returns Array.
 +
 
 +
Returns a list of objects represented a time intervals marked as busy in Google Calendar. Each object of result
 +
contains <code>from</code> and <code>to</code> properties with datetime string as value. This method only actual if
 +
[Plugins#Google calendar sync plugin|Google calendar sync plugin] enabled. If plugin not enabled an empty list will
 +
be returned. You should call <code>[[#isPluginActivated|isPluginActivated('google_calendar_export')]]</code> to
 +
check status of the plugin. Each object of result contains <code>from</code> and <code>to</code> properties with
 +
datetime string as value. Please note that this method may return not actual data because data synchronization
 +
between server and Google Calendar may take some time and synchronized data are cached for 15 minutes.
   −
Returns company's currency as three chars code (ISO 4217).
+
Example:
 +
  [
 +
  {"from" : "2016-02-16 13:30:00",
 +
    "to" : "2016-02-16 16:00:00"},
 +
    ...
 +
  ]
       
----
 
----
   −
=== getCompanyInfo ===
+
=== getGoogleCalendarBusyTimeAvailableUnits ===
   −
<code>getCompanyInfo()</code>
+
<code>getGoogleCalendarBusyTimeAvailableUnits()</code>
    
No arguments.
 
No arguments.
Returns Object.
+
Returns Array.
   −
Returns an object with detailed information about company. See [[#getCompanyInfo response|example of response]].
+
Returns configured unit ids, allowed to sync busy time
       
----
 
----
   −
=== getCompanyParam ===
+
=== getLastNotificationUpdate ===
   −
<code>getCompanyParam($key)</code>
+
<code>getLastNotificationUpdate($type)</code>
    
Parameters:
 
Parameters:
   −
* '''$key''' String  
+
* '''$type''' String  
   −
Returns mixed.
+
Returns String.
   −
Returns company config value for key. A different set of keys available for public API and for company
+
Returns last update datetime
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 ===
+
=== getPluginList ===
   −
<code>getCountryList()</code>
+
<code>getPluginList()</code>
    
No arguments.
 
No arguments.
 
Returns Array.
 
Returns Array.
   −
Get list of all countries
+
Returns a list of all plugins associated with company with status.
       
----
 
----
   −
=== getCountryPhoneCodes ===
+
=== getRecentActions ===
   −
<code>getCountryPhoneCodes()</code>
+
<code>getRecentActions($lastOnly, $limit)</code>
 +
 
 +
Parameters:
 +
 
 +
* '''$lastOnly''' Boolean
 +
* '''$limit''' Integer
   −
No arguments.
   
Returns Array.
 
Returns Array.
   −
Returns country phone code list
+
Returns latest actions
       
----
 
----
   −
=== getCurrentTariffInfo ===
+
=== getRecurringDatetimes ===
 +
 
 +
<code>getRecurringDatetimes($eventId, $unitId, $date, $time, $recurringData, $endDateTime)</code>
 +
 
 +
Parameters:
   −
<code>getCurrentTariffInfo()</code>
+
* '''$eventId''' Integer
 +
* '''$unitId''' Integer
 +
* '''$date''' String
 +
* '''$time''' String
 +
* '''$recurringData''' Array
 +
* '''$endDateTime''' String (optional)
   −
No arguments.
   
Returns Array.
 
Returns Array.
   −
Returns all information about current tariff (subscription). For example:{
+
Get list of dates for recurring booking
    "name" : "gold",
  −
    "expire_date" : "2016-02-11 12:32:00",
  −
    "rest" : 41, // number of days until subscription expiration
  −
    "color" : "#fcb322"
  −
  }
         
----
 
----
   −
=== getCurrentUserDetails ===
+
=== getRecurringSettings ===
 +
 
 +
<code>getRecurringSettings($eventId)</code>
 +
 
 +
Parameters:
   −
<code>getCurrentUserDetails()</code>
+
* '''$eventId''' Integer
   −
No arguments.
   
Returns Array.
 
Returns Array.
   −
Returns current logged user info
+
Returns an object with recurring settings for an event. Returns false if specified event does not configured as
 +
recurring.
 +
 
 +
See also:
    +
* [http://blog.simplybook.me/recurring-and-periodic-bookings/ Recurring services desription]
    
----
 
----
   −
=== getEventList ===
+
=== getRegistrations ===
   −
<code>getEventList($isVisibleOnly, $asArray)</code>
+
<code>getRegistrations($groupBy)</code>
    
Parameters:
 
Parameters:
   −
* '''$isVisibleOnly''' Boolean
+
* '''$groupBy''' String either 'day', 'week' or 'month'
* '''$asArray''' Boolean
      
Returns Array.
 
Returns Array.
   −
Returns company's events list. If <code>$asArray</code> is false then method returns a map with event id as key
+
Returns number of clients registrations  by 'day', 'week' or 'month'. A time period depends on selected
and details object as value. If parameter set to true then method returns a list sorted by 'position' property of
+
grouping parameter:
event's details object.
+
 
 +
* for 'day' methods returns statistics for last 31 days
 +
* for 'week' methods returns data last 10 weeks period
 +
* for 'month' time period is last 12 months
       
----
 
----
   −
=== getFeedbacks ===
+
=== getSocialCounterStats ===
   −
<code>getFeedbacks($approvedOnly, $reviewsOnly, $lastOnly, $limit)</code>
+
<code>getSocialCounterStats($provider)</code>
    
Parameters:
 
Parameters:
   −
* '''$approvedOnly''' Boolean
+
* '''$provider''' String
* '''$reviewsOnly''' Boolean
  −
* '''$lastOnly''' Boolean
  −
* '''$limit''' Integer
     −
Returns Array.
+
Returns Integer.
   −
Get list of feedbacks
+
Returns social counters value for your domain
       
----
 
----
   −
=== getFirstWorkingDay ===
+
=== getStatuses ===
   −
<code>getFirstWorkingDay($unitId)</code>
+
<code>getStatuses()</code>
   −
Parameters:
+
No arguments.
 +
Returns Array.
   −
* '''$unitId''' Integer
+
Returns list of available statuses or an empty list if [[Plugins#Status|Status plugin]] not enabled.
   −
Returns String.
     −
Returns first working date for unit
+
----
    +
=== getTopPerformers ===
   −
----
+
<code>getTopPerformers()</code>
   −
=== getGoogleCalendarBusyTime ===
+
No arguments.
 +
Returns Array.
   −
<code>getGoogleCalendarBusyTime($startDateTime, $endDateTime, $unitId)</code>
+
Returns a list with statistics for performers. This data contains number of bookings and revenues value for each performer.
   −
Parameters:
     −
* '''$startDateTime''' string
+
----
* '''$endDateTime''' string
  −
* '''$unitId''' integer
     −
Returns Array.
+
=== getTopServices ===
   −
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
+
<code>getTopServices($dateStart, $dateEnd)</code>
    +
Parameters:
   −
----
+
* '''$dateStart''' String
 +
* '''$dateEnd''' String
   −
=== getGoogleCalendarBusyTimeAvailableUnits ===
  −
  −
<code>getGoogleCalendarBusyTimeAvailableUnits()</code>
  −
  −
No arguments.
   
Returns Array.
 
Returns Array.
   −
Returns configured unit ids, allowed to sync busy time
+
Returns a list with statistics for services for a period of time. This data contains number of bookings and
 +
revenues value for each service.
       
----
 
----
   −
=== getLastNotificationUpdate ===
+
=== getUnitWorkdayInfo ===
   −
<code>getLastNotificationUpdate($type)</code>
+
<code>getUnitWorkdayInfo($dateStart, $dateEnd, $unitGroupId)</code>
    
Parameters:
 
Parameters:
   −
* '''$type''' String
+
* '''$dateStart''' string
 +
* '''$dateEnd''' string
 +
* '''$unitGroupId''' integer
   −
Returns String.
+
Returns Array.
   −
Returns last update datetime
+
Return workday info (date_start and date_end)
       
----
 
----
   −
=== getLocationsList ===
+
=== getUnitWorkingDurations ===
   −
<code>getLocationsList($isPublic)</code>
+
<code>getUnitWorkingDurations($dateStart, $dateEnd, $unitGroupId)</code>
    
Parameters:
 
Parameters:
   −
* '''$isPublic''' Boolean
+
* '''$dateStart''' string
 +
* '''$dateEnd''' string
 +
* '''$unitGroupId''' integer
    
Returns Array.
 
Returns Array.
   −
Returns available locations for company if plugin [[Plugins#Unit location|Unit location plugin]] is activated. Return
+
Return working durations
an error with code -32001 if plugin is not activated. Use <code>[[#isPluginActivated|isPluginActivated('location')]]</code>
  −
API method to check if plugin activated.
         
----
 
----
   −
=== getPluginList ===
+
=== getVisitorStats ===
   −
<code>getPluginList()</code>
+
<code>getVisitorStats($groupBy)</code>
   −
No arguments.
+
Parameters:
Returns Array.
     −
Returns a list of all plugins associated with company with status.
+
* '''$groupBy''' String
 +
 
 +
Returns Array.
 +
 
 +
Returns statistics about page visits if plugin [[Plugins#Visitor Counter|Visitor Counter plugin]] enabled. Returns
 +
an empty list if plugin not enabled. Use <code>[[#isPluginActivated|isPluginActivated('counter')]]</code> API method
 +
call to check if plugin enabled. Results can be grouped by 'day', 'week' or 'month'. A time period depends on
 +
selected grouping parameter:
 +
 
 +
* for 'day' methods returns statistics for last 31 days
 +
* for 'week' methods returns data last 10 weeks period
 +
* for 'month' time period is last 12 months
       
----
 
----
   −
=== getPluginPromoInfoByCode ===
+
=== getWarnings ===
   −
<code>getPluginPromoInfoByCode($code)</code>
+
<code>getWarnings($lastOnly)</code>
    
Parameters:
 
Parameters:
   −
* '''$code'''   
+
* '''$lastOnly'''   
    
Returns Array.
 
Returns Array.
   −
Returns an object with detailed information about promotion by promotion code. You can get promotion code
+
Returns warnings for admin
using <code>[[Catalogue#getPromotionList|getPromotionList]]</code> API method. If promotion record with specified
+
(sms limit, bookings limit, etc)
code not found then method returns an empty array (an empty object). If [[Plugins#Simply Smart Promotions|Simply Smart Promotions plugin]]
  −
not enabled then method returns an error with code -32001 (Plugin is not activated). Use
  −
<code>[[#isPluginActivated|isPluginActivated('promo')]]</code> API method call to check if plugin enabled.See [[#getPromotionList response|example]] of <code>getPromotionList</code> API method response. Please note that
  −
response contains a list of services for wich promotion discount can be applied (<code>service_ids</code> key).
         
----
 
----
   −
=== getPluginStatuses ===
+
=== getWorkDaysTimes ===
   −
<code>getPluginStatuses($pluginNames)</code>
+
<code>getWorkDaysTimes($startDateTime, $endDateTime)</code>
    
Parameters:
 
Parameters:
   −
* '''$pluginNames''' Array
+
* '''$startDateTime''' string
 +
* '''$endDateTime''' string
    
Returns Array.
 
Returns Array.
   −
Return plugin status true if status active, else false. See [[#Plugin's identifiers|list of available plugin's names]].
+
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
       
----
 
----
   −
=== getRecentActions ===
+
=== getWorkload ===
   −
<code>getRecentActions($lastOnly, $limit)</code>
+
<code>getWorkload($dateStart, $dateEnd, $unitGroupId)</code>
    
Parameters:
 
Parameters:
   −
* '''$lastOnly''' Boolean
+
* '''$dateStart''' string
* '''$limit''' Integer
+
* '''$dateEnd''' string
 +
* '''$unitGroupId''' integer
    
Returns Array.
 
Returns Array.
   −
Returns latest actions
+
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:
----
  −
 
  −
=== 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.
  −
 
  −
Returns an object with recurring settings for an event. Returns false if specified event does not configured as
  −
recurring.
  −
 
  −
See also:
  −
 
  −
* [http://blog.simplybook.me/recurring-and-periodic-bookings/ Recurring services desription]
  −
 
  −
----
  −
 
  −
=== getRegistrations ===
  −
 
  −
<code>getRegistrations($groupBy)</code>
  −
 
  −
Parameters:
  −
 
  −
* '''$groupBy''' String either 'day', 'week' or 'month'
  −
 
  −
Returns Array.
  −
 
  −
Returns number of clients registrations  by 'day', 'week' or 'month'. A time period depends on selected
  −
grouping parameter:
  −
 
  −
* for 'day' methods returns statistics for last 31 days
  −
* for 'week' methods returns data last 10 weeks period
  −
* for 'month' time period is last 12 months
  −
 
  −
 
  −
----
  −
 
  −
=== 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''' Mixed can 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.
  −
 
  −
Returns list of available statuses or an empty list if [[Plugins#Status|Status plugin]] not enabled.
  −
 
  −
 
  −
----
  −
 
  −
=== getTimeframe ===
  −
 
  −
<code>getTimeframe()</code>
  −
 
  −
No arguments.
  −
Returns Integer.
  −
 
  −
Returns company's timeframe configuration (in minutes). Timeframe can be either 5, 10, 15, 20, 30 or 60 minutes.You can find more details about timeframe [[Settings#Timeframe|here]].
  −
 
  −
 
  −
----
  −
 
  −
=== getTopPerformers ===
  −
 
  −
<code>getTopPerformers()</code>
  −
 
  −
No arguments.
  −
Returns Array.
  −
 
  −
Returns a list with statistics for performers. This data contains number of bookings and revenues value for each performer.
  −
 
  −
 
  −
----
  −
 
  −
=== getTopServices ===
  −
 
  −
<code>getTopServices($dateStart, $dateEnd)</code>
  −
 
  −
Parameters:
  −
 
  −
* '''$dateStart''' String
  −
* '''$dateEnd''' String
  −
 
  −
Returns Array.
  −
 
  −
Returns a list with statistics for services for a period of time. This data contains number of bookings and
  −
revenues value for each service.
  −
 
  −
 
  −
----
  −
 
  −
=== getUnitList ===
  −
 
  −
<code>getUnitList($isVisibleOnly, $asArray)</code>
  −
 
  −
Parameters:
  −
 
  −
* '''$isVisibleOnly''' Boolean
  −
* '''$asArray''' Boolean
  −
 
  −
Returns Array.
  −
 
  −
Returns list of service performers. If <code>$asArray</code> is false then method returns a map with event id as
  −
key and details object as value. If parameter set to true then method returns a list sorted by 'position' property
  −
of event's details object.
  −
 
  −
 
  −
----
  −
 
  −
=== getUnitWorkdayInfo ===
  −
 
  −
<code>getUnitWorkdayInfo($dateStart, $dateEnd, $unitGroupId)</code>
  −
 
  −
Parameters:
  −
 
  −
* '''$dateStart''' string
  −
* '''$dateEnd''' string
  −
* '''$unitGroupId''' integer
  −
 
  −
Returns Array.
  −
 
  −
Return workday info (date_start and date_end)
  −
 
  −
 
  −
----
  −
 
  −
=== getUnitWorkingDurations ===
  −
 
  −
<code>getUnitWorkingDurations($dateStart, $dateEnd, $unitGroupId)</code>
  −
 
  −
Parameters:
  −
 
  −
* '''$dateStart''' string
  −
* '''$dateEnd''' string
  −
* '''$unitGroupId''' integer
  −
 
  −
Returns Array.
  −
 
  −
Return working durations
  −
 
  −
 
  −
----
  −
 
  −
=== getVisitorStats ===
  −
 
  −
<code>getVisitorStats($groupBy)</code>
  −
 
  −
Parameters:
  −
 
  −
* '''$groupBy''' String
  −
 
  −
Returns Array.
  −
 
  −
Returns statistics about page visits if plugin [[Plugins#Visitor Counter|Visitor Counter plugin]] enabled. Returns
  −
an empty list if plugin not enabled. Use <code>[[#isPluginActivated|isPluginActivated('counter')]]</code> API method
  −
call to check if plugin enabled. Results can be grouped by 'day', 'week' or 'month'. A time period depends on
  −
selected grouping parameter:
  −
 
  −
* for 'day' methods returns statistics for last 31 days
  −
* for 'week' methods returns data last 10 weeks period
  −
* for 'month' time period is last 12 months
  −
 
  −
 
  −
----
  −
 
  −
=== 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 (optional)
  −
* '''$eventId''' Integer (optional)
  −
 
  −
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''' string
  −
* '''$dateEnd''' string
  −
* '''$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' : {
 
   ['2015-10-21' : {
 
     5 : [
 
     5 : [
Line 1,206: Line 912:  
       0  // cancelled 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]].
        Line 1,345: Line 1,036:  
* -32011 Params is not array
 
* -32011 Params is not array
 
* -32012 Sheduler id not found
 
* -32012 Sheduler id not found
 +
* -32015 Passed event id is not reccuren
 
* -32020 Sorry, you have no permissions to perform this action
 
* -32020 Sorry, you have no permissions to perform this action
 
* -32030 Invalid promotion code
 
* -32030 Invalid promotion code
Line 1,394: Line 1,086:  
* borgun_payment_gateway_id
 
* borgun_payment_gateway_id
 
* borgun_secret_code
 
* borgun_secret_code
* changable_prefix_by_client
   
* client_batch_cancel_template
 
* client_batch_cancel_template
 
* client_batch_cancel_template_email
 
* client_batch_cancel_template_email
Line 1,778: Line 1,469:  
* modern_week
 
* modern_week
 
* classic
 
* classic
 +
* classes
      −
<code>timeframe</code> field can be 5, 10, 15, 20, 30 or 60 minutes. More information about timeframe you can read [[Settings#Timeframe|here]].
+
Please note that <code>classic</code> timeline type is deprecated and not supported anymore.
    
<code>description</code> field contains raw data of company's description which can include HTML tags. <code>description_text</code> field contains only text information without HTML tags.
 
<code>description</code> field contains raw data of company's description which can include HTML tags. <code>description_text</code> field contains only text information without HTML tags.
    +
For information about <code> timeframe</code>, <code>timezone</code>, <code>allow_event_day_break</code> and <code>allow_event_breaktime_break</code> see [[#Company params|Company params section]].
 
----
 
----