Difference between revisions of "Company administration service methods"

From SimplyBook.me
 
(51 intermediate revisions by the same user not shown)
Line 1: Line 1:
 +
==General Information==
 +
 +
SimplyBook.me API service build on [https://en.wikipedia.org/wiki/JSON-RPC JSON-RPC] remote procedure call protocol. A remote method is invoked by sending a request to a remote service using HTTPS. All transfer types are single objects, serialized using [http://www.json.org JSON]. A request is a call to a specific method provided by a remote system. It must contain three certain properties:
 +
 +
* <code>jsonrpc</code> - a version of JSON-RPC protocol. Always <code>"2.0"</code>
 +
* <code>method</code> - A String with the name of the method to be invoked.
 +
* <code>params</code> - An Array of objects to be passed as parameters to the defined method.
 +
* <code>id</code> - A value of any type, which is used to match the response with the request that it is replying to.
 +
 +
The receiver of the request must reply with a valid response to all received requests. A response must contain the properties mentioned below.
 +
 +
* <code>result</code> - The data returned by the invoked method. If an error occurred while invoking the method, this value must be null.
 +
* <code>error</code> - A specified error code if there was an error invoking the method, otherwise null.
 +
* <code>id</code> - The id of the request it is responding to.
 +
 +
Example
 +
 +
<pre>
 +
  Request
 +
  {
 +
    "jsonrpc": "2.0",
 +
    "method": "getEventList",
 +
    "params":[],
 +
    "id":1
 +
  }
 +
 
 +
  Response
 +
  {
 +
    "result": {
 +
        "1": {
 +
            "id": "1",
 +
            "name": "Часовая фотосесcия",
 +
            "duration": "60",
 +
            "hide_duration": "0",
 +
            "description": "<p>Если Вы хотите попробовать себя в роли модели, но не определились с образом. <br /> 5-7 отретушированных и готовых к печати фотографий + отснятый материал на диске</p>",
 +
            "picture": "a200edab10b669225e22d2b3803a38b5.jpg",
 +
            "is_public": "1",
 +
            "is_active": "1",
 +
            "position": "0",
 +
            "is_recurring": "0",
 +
            "picture_path": "/uploads/mib/event__picture/small/a200edab10b669225e22d2b3803a38b5.jpg",
 +
            "price": "300.0000",
 +
            "currency": "UAH",
 +
            "categories": ["1"]
 +
        },
 +
        ...
 +
    },
 +
    "id": "1",
 +
    "jsonrpc": "2.0"
 +
  }
 +
</pre>
 +
 +
Example of request with error response:
 +
 +
<pre>
 +
  Request
 +
  {
 +
    "jsonrpc": "2.0",
 +
    "method": "someNotExistingMethod",
 +
    "params":[],
 +
    "id":1
 +
  }
 +
 
 +
  Response
 +
  {
 +
    "jsonrpc": "2.0",
 +
    "id":1,
 +
    "error": {
 +
      "code": -32601,
 +
      "message": "Method not found"
 +
    }
 +
  }
 +
</pre>
 +
 +
All calls of public service methods should have additional HTTP header:
 +
 +
* <code>X-Token</code> an authentication token. See [[#Authentication|authentication]] section.
 +
 +
===Endpoint===
 +
 +
Use URL <code>https://user-api.simplybook.me/admin</code> for all administration service API calls.
 +
 +
===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 'Custom Features' link and select [[Custom_Features#API|API Custom Feature]] 'Settings'.
 +
 +
== Methods ==
 +
 
== Methods ==
 
== Methods ==
  
Line 45: Line 133:
  
 
* '''$token''' String a device token string
 
* '''$token''' String a device token string
* '''$device''' String a device type (&#039;android&#039; or &#039;apple&#039;)
+
* '''$device''' String a device type ('android' or 'apple')
  
 
Returns boolean.
 
Returns boolean.
  
Subscribe a mobile device to push notifications about new bookings or changes in already created bookings. Use
+
Subscribe a mobile device to push notifications service. Device will recieve notifications about new bookings or
<code>'apple'</code> or <code>'android'</code> for <code>device</code> parameter.
+
changes in already created bookings. Use either <code>'apple'</code> or <code>'android'</code> for <code>device</code>
 
+
parameter.
  
 
----
 
----
Line 64: Line 152:
 
* '''$unitId''' Integer  
 
* '''$unitId''' Integer  
 
* '''$clientId''' Integer  
 
* '''$clientId''' Integer  
* '''$startDate''' string a date string in format &#039;Y-m-d&#039;
+
* '''$startDate''' string a date string in format 'Y-m-d'
* '''$startTime''' string a time string in format &#039;H:i:s&#039;
+
* '''$startTime''' string a time string in format 'H:i:s'
* '''$endDate''' string a date string in format &#039;Y-m-d&#039;
+
* '''$endDate''' string a date string in format 'Y-m-d'
* '''$endTime''' string a time string in format &#039;H:i:s&#039;
+
* '''$endTime''' string a time string in format 'H:i:s'
 
* '''$clientTimeOffset''' Integer  
 
* '''$clientTimeOffset''' Integer  
 
* '''$additional''' array|Object - additional params and fields.
 
* '''$additional''' array|Object - additional params and fields.
* '''$count''' Integer bookings count used to make group bookings batch. This parameter can&#039;t be less than 1. (optional)
+
* '''$count''' Integer bookings count used to make group bookings batch. This parameter can't be less than 1. (optional)
* '''$batchId''' Integer add booking to group bookings batch. You can&#039;t use $count and $batchId in one call. Please specify only one parameter. (optional)
+
* '''$batchId''' Integer add booking to group bookings batch. You can't use $count and $batchId in one call. Please specify only one parameter. (optional)
 
* '''$recurringData''' Array - make booking recurrent. (optional)
 
* '''$recurringData''' Array - make booking recurrent. (optional)
  
Line 89: Line 177:
 
time zone using <code>[[#getCompanyInfo|getCompanyInfo]]</code> API method. To create batch booking you can
 
time zone using <code>[[#getCompanyInfo|getCompanyInfo]]</code> API method. To create batch booking you can
 
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 intake forms (see [[Custom_Features#Intake_Forms|Intake Forms Custom feature]]).To create a booking with promo code you should pass it as additional field. For example: <code>{"promocode": "some code"}</code>
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>{"name": "promocode", "value": "some code", "type": "text"}</code>See [[#book response|example]] of <code>book</code> API method response.
 
  
 +
If [[Custom_Features#Multiple_Locations| Multiple locations]] 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 Custom feature 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:
 +
 +
* [https://help.simplybook.me/index.php/Need_to_change_interval_(timeframe) Timeframe information]
  
 
----
 
----
Line 102: Line 198:
 
Parameters:
 
Parameters:
  
* '''$startDateTime''' String a date and time string in format &#039;Y-m-d H:i:s&#039;, eg. &#039;2001-10-02 13:30:00&#039;.
+
* '''$startDateTime''' String a date and time string in format 'Y-m-d H:i:s', eg. '2001-10-02 13:30:00'.
 
* '''$eventId''' Integer  
 
* '''$eventId''' Integer  
 
* '''$unitId''' Integer  
 
* '''$unitId''' Integer  
Line 119: Line 215:
 
Parameters:
 
Parameters:
  
* '''$id''' Integer  
+
* '''$id''' Integer identifier of batch. See <code>[[#createBatch|createBatch]]</code> API method.
* '''$bookingIds''' Array  
+
* '''$bookingIds''' Array ids of bookings included to batch.
  
 
Returns boolean.
 
Returns boolean.
  
Cancel batch of bookings. Signature is NOT required.First id is used for information in notifications
+
Cancel batch of bookings. Returns true on success. Returns an error with code -32080 (Appointment couldn't be found)
 +
if no booking with specified id were found. A booking with first id in <code>$bookingIds</code> list is used for
 +
information in notifications.
  
  
Line 139: Line 237:
 
Returns Boolean.
 
Returns Boolean.
  
Cancel booking. Signature is NOT required
+
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.
  
  
Line 167: Line 266:
 
Returns boolean.
 
Returns boolean.
  
Unsubscribe to push notifications gloabl or company
+
Unsubscribe from push notifications service.
  
  
Line 178: Line 277:
 
Parameters:
 
Parameters:
  
* '''$shedulerId''' Integer an id of booking to edit. See &lt;code&gt;[[#book|book]]&lt;/code&gt; or &lt;code&gt;[[#getBookings|getBookings]]&lt;/code&gt; API methods.
+
* '''$shedulerId''' Integer an id of booking to edit. See <code>[[#book|book]]</code> or <code>[[#getBookings|getBookings]]</code> API methods.
 
* '''$eventId''' Integer  
 
* '''$eventId''' Integer  
 
* '''$unitId''' Integer  
 
* '''$unitId''' Integer  
Line 192: Line 291:
  
 
Edit existing booking record. See [[#book|book]] API method description for more details about date/time parameters,
 
Edit existing booking record. See [[#book|book]] API method description for more details about date/time parameters,
time zone handling and additional fields.
+
time zone handling and additional fields. Returns null if parameters not valid.
  
  
Line 209: Line 308:
  
 
Edits client's record. See <code>[[#addClient|addClient]]</code> method description for list of available fields.Method returns an id of client's record.
 
Edits client's record. See <code>[[#addClient|addClient]]</code> method description for list of available fields.Method returns an id of client's record.
 +
 +
 +
----
 +
 +
=== filterAvailableUnits ===
 +
 +
<code>filterAvailableUnits($eventId, $dateTime, $unitIds, $count)</code>
 +
 +
Parameters:
 +
 +
* '''$eventId''' Integer
 +
* '''$dateTime''' String a date and time string in format 'Y-m-d H:i:s'
 +
* '''$unitIds''' 
 +
* '''$count''' Integer
 +
 +
Returns Array.
 +
 +
Returns list of available unit ids for specified date and service from provided $unitIds list.You can use this method with location Custom Feature.
 +
Returns empty array if all units are not allowed.
 +
Eg.: <code>[1, 2, 3]</code>
  
  
Line 223: Line 342:
 
Returns Array.
 
Returns Array.
  
Return additional fields for certain event if [[Plugins#Additional_fields|Additional fields plugin]] is
+
Return intake forms for certain event if [[Custom_Features#Intake_Forms|Intake Forms Custom Feature]] is
 
activated. Returns empty array otherwise. Call <code>[[#isPluginActivated|isPluginActivated('event_field')]]</code>
 
activated. Returns empty array otherwise. Call <code>[[#isPluginActivated|isPluginActivated('event_field')]]</code>
API method to check if 'event_field' plugin activated.
+
API method to check if 'event_field' Custom Feature activated.
  
  
Line 237: Line 356:
 
Returns Object|null.
 
Returns Object|null.
  
Returns information about [[Plugins#Any_Employee_selector|Any Employee selector plugin]] configuration. Returns
+
Returns information about [[Custom_Features#Any_Employee_Selector|Any Employee selector Custom Feature]] configuration. Returns
null if plugin not enabled.Example:
+
null if Custom Feature not enabled.Example:
 
   {
 
   {
 
     "description" : "Select this option, if you want to find an available time with any of the employees",
 
     "description" : "Select this option, if you want to find an available time with any of the employees",
Line 251: Line 370:
 
----
 
----
  
=== getAvailableUnits ===
+
=== getAvailableTimeIntervals ===
  
<code>getAvailableUnits($eventId, $dateTime, $count)</code>
+
<code>getAvailableTimeIntervals($dateFrom, $dateTo, $eventId, $unitId, $count)</code>
  
 
Parameters:
 
Parameters:
  
 +
* '''$dateFrom''' String
 +
* '''$dateTo''' String
 
* '''$eventId''' Integer  
 
* '''$eventId''' Integer  
* '''$dateTime''' String a date and time string in format &#039;Y-m-d H:i:s&#039;
+
* '''$unitId''' Mixed can be Integer or Array of Integers
 
* '''$count''' Integer  
 
* '''$count''' Integer  
  
Returns Array.
+
Returns Object.
  
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 available time intervals for all service providers for given period, taking into account breaktimes, start and end working time
 +
Eg.: <code>{['2016-03-04': ['1': [['09:00:00','09:30:00'], ['11:15:00','14:45:00']] , ...], ...]}</code>
  
  
 
----
 
----
  
=== getBookingCancellationsInfo ===
+
=== getAvailableUnits ===
  
<code>getBookingCancellationsInfo($dateStart, $dateEnd)</code>
+
<code>getAvailableUnits($eventId, $dateTime, $count)</code>
  
 
Parameters:
 
Parameters:
  
* '''$dateStart''' String a date string in format &#039;Y-m-d&#039;. Pass null to get data from first day of current week.
+
* '''$eventId''' Integer
* '''$dateEnd''' String a date string in format &#039;Y-m-d&#039;. Pass null to get data filtered to last day of current week.
+
* '''$dateTime''' String a date and time string in format 'Y-m-d H:i:s'
 +
* '''$count''' Integer
 +
 
 +
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>
 +
 
 +
 
 +
----
 +
 
 +
=== getBookingCancellationsInfo ===
 +
 
 +
<code>getBookingCancellationsInfo($dateStart, $dateEnd)</code>
 +
 
 +
Parameters:
 +
 
 +
* '''$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.
Line 340: Line 479:
 
Parameters:
 
Parameters:
  
* '''$startDateTime''' string a date and time string in format &#039;Y-m-d H:i:s&#039;
+
* '''$startDateTime''' string a date and time string in format 'Y-m-d H:i:s'
* '''$endDateTime''' string a date and time string in format &#039;Y-m-d H:i:s&#039;
+
* '''$endDateTime''' string a date and time string in format 'Y-m-d H:i:s'
 
* '''$eventId''' integer  
 
* '''$eventId''' integer  
  
 
Returns Array.
 
Returns Array.
  
Returns time intervals not available for bookings because of configuration of [[Plugins#Limit bookings|Limit bookings]]
+
Returns time intervals not available for bookings because of configuration of [[Custom_Features#Limit_Bookings|Limit bookings]]
plugin for period of time. Returns empty array if plugin not available.
+
Custom Feature for period of time. Returns empty array if Custom Feature not available.
  
  
Line 358: Line 497:
 
Parameters:
 
Parameters:
  
* '''$dateStart''' string a date string in format &#039;Y-m-d&#039;.
+
* '''$dateStart''' string a date string in format 'Y-m-d'.
* '''$dateEnd''' string a date string in format &#039;Y-m-d&#039;
+
* '''$dateEnd''' string a date string in format 'Y-m-d'
 
* '''$unitGroupId''' integer  
 
* '''$unitGroupId''' integer  
 
* '''$serviceId''' integer  
 
* '''$serviceId''' integer  
Line 383: Line 522:
 
Parameters:
 
Parameters:
  
* '''$groupBy''' String  
+
* '''$groupBy''' String either 'day', 'week' or 'month'
  
 
Returns Array.
 
Returns Array.
  
Get bookings stats
+
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
  
  
Line 402: Line 544:
 
Returns Array.
 
Returns Array.
  
Returns list of bookings filtered by given params. Filter params represented as object with following fields:
+
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'
 
 
* '''date_from''' a date of booking in string format 'Y-m-d'
 
 
* '''time_from''' a time string in format 'H:i:s'
 
* '''time_from''' a time string in format 'H:i:s'
 
* '''date_to''' a date string in format 'Y-m-d'
 
* '''date_to''' a date string in format 'Y-m-d'
Line 412: Line 552:
 
* '''unit_group_id''' an integer. Use it to get bookings assigned for certain service provider.
 
* '''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.
 
* '''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'.
+
* '''is_confirmed''' 1 or 0. If [[Custom_Features#Approve_Bookings|Approve booking]] Custom Feature enabled then method will return confirmed bookings with approve status 'new'.
 
* '''client_id''' an integer. Use it to get bookings only for certain client.
 
* '''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.
 
* '''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.
+
* '''booking_type''' a string. Value of this field depends on Approve booking Custom Feature status.
*: If plugin not active:
+
*: If Custom Feature not active:
 
** '''all''' for all bookings (default value)
 
** '''all''' for all bookings (default value)
 
** '''cancelled''' alias to 'is_confirmed' equal to 0
 
** '''cancelled''' alias to 'is_confirmed' equal to 0
 
** '''non_cancelled''' alias to 'is_confirmed' equal to 1
 
** '''non_cancelled''' alias to 'is_confirmed' equal to 1
*: If plugin active:
+
*: If Custom Feature active:
 
** '''all''' for all bookings (default value)
 
** '''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)
 
** '''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)
Line 463: Line 603:
 
Returns Array.
 
Returns Array.
  
Returns company categories list if [[Plugins#Service categories|Service categories plugin]] is activated. Returns
+
Returns company categories list if [[Custom_Features#Service_Categories|Service Categories Custom Feature]] is activated. Returns
an error with code -32001 if plugin is not activated. Use <code>[[#isPluginActivated|isPluginActivated('event_category')]]</code>
+
an error with code -32001 if Custom Feature is not activated. Use <code>[[#isPluginActivated|isPluginActivated('event_category')]]</code>
API method to check if plugin activated.
+
API method to check if Custom Feature activated.
  
  
Line 540: Line 680:
 
Returns Object.
 
Returns Object.
  
Returns company information
+
Returns an object with detailed information about company. See [[#getCompanyInfo response|example of response]].
  
  
Line 562: Line 702:
 
----
 
----
  
=== getCountryList ===
+
=== getCompanyParams ===
 +
 
 +
<code>getCompanyParams($keys)</code>
 +
 
 +
Parameters:
  
<code>getCountryList()</code>
+
* '''$keys''' Array
  
No arguments.
 
 
Returns Array.
 
Returns Array.
  
Get list of all countries
+
Returns company config values for keys. 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]].For non-existent and not-allowed params it will return false as result
  
  
 
----
 
----
  
=== getCountryPhoneCodes ===
+
=== getCompanyTimezoneOffset ===
 +
 
 +
<code>getCompanyTimezoneOffset()</code>
 +
 
 +
No arguments.
 +
Returns array.
 +
 
 +
Returns company timezone offset and company timezone
 +
 
 +
 
 +
----
 +
 
 +
=== getCountryList ===
 +
 
 +
<code>getCountryList()</code>
 +
 
 +
No arguments.
 +
Returns Array.
 +
 
 +
Get list of all countries
 +
 
 +
 
 +
----
 +
 
 +
=== getCountryPhoneCodes ===
  
 
<code>getCountryPhoneCodes()</code>
 
<code>getCountryPhoneCodes()</code>
Line 607: Line 776:
 
<code>getCurrentUserDetails()</code>
 
<code>getCurrentUserDetails()</code>
  
No arguments.
+
No arguments. Returns Object.
Returns Array.
 
  
Returns current logged user info
+
Returns an object with information about logged in user. Note: you are responsible for implementation of some
 +
access rights based on <code>group</code> property value. Most of API methods returns an error if user has low access
 +
rights but not all. There are 4 roles:
  
 +
* '''Administrator''' - have full access to the system
 +
* '''Senior Employee''' - have access to calendar, services and providers, and can modify bookings related with user
 +
* '''Junior Employee''' - can access caledar (but only to own bookings), services associated with user
 +
* '''Viewer''' - have only access to calendar and services in read only mode
  
----
 
  
=== getEventList ===
+
<code>group</code> property can be one of the values:
  
<code>getEventList($isVisibleOnly, $asArray)</code>
+
* <code>shop_user</code> - "Senior Employee" access role
 +
* <code>station_user</code> - "Junior Employee" access role
 +
* <code>admin</code> - "Administrator" access role
 +
* <code>viewer</code> - "Viewer" access role
 +
* <code>reseller_company_admin</code> - reserved
 +
 
 +
 
 +
Example:
 +
 
 +
  {
 +
    "id": 1,
 +
    "login": admin,
 +
    "email": "admin@mycoolcompany.com";
 +
    "firstname": "Michail",
 +
    "lastname": " ",
 +
    "phone": "",
 +
    "group": "admin",
 +
    "is_blocked": 0,
 +
    "last_access_time": "2016-06-06 17:55:51",
 +
    "unit_group_id": null
 +
  }
 +
 
 +
 
 +
----
 +
 
 +
=== getEventList ===
 +
 
 +
<code>getEventList($isVisibleOnly, $asArray)</code>
  
 
Parameters:
 
Parameters:
Line 626: Line 826:
 
Returns Array.
 
Returns Array.
  
Returns company events list
+
Returns company's events list. 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.
  
  
Line 670: Line 872:
 
Parameters:
 
Parameters:
  
* '''$startDateTime''' string  
+
* '''$startDateTime''' string a date and time string in format 'Y-m-d H:i:s'
* '''$endDateTime''' string  
+
* '''$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  
 
* '''$unitId''' integer  
  
 
Returns Array.
 
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
+
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
 +
[Custom_Features#Calendar_Sync|Calendar Sync Custom Feature] enabled. If Custom Feature not enabled an empty list will
 +
be returned. You should call <code>[[#isPluginActivated|isPluginActivated('google_calendar_export')]]</code> to
 +
check status of the Custom Feature. 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/Outlook Calendar may take some time and synchronized data are cached for 15 minutes.Example:
 +
<code>
 +
  [
 +
  {"from" : "2016-02-16 13:30:00",
 +
    "to" : "2016-02-16 16:00:00"},
 +
    ...
 +
  ]
 +
</code>
  
  
Line 710: Line 926:
 
=== getLocationsList ===
 
=== getLocationsList ===
  
<code>getLocationsList($isPublic)</code>
+
<code>getLocationsList($isPublic, $asArray)</code>
  
 
Parameters:
 
Parameters:
  
* '''$isPublic''' Boolean  
+
* '''$isPublic''' Boolean Optional. Default value is '''false'''.
 +
* '''$asArray''' boolean Optional. Default value is '''false'''.
  
 
Returns Array.
 
Returns Array.
  
Returns available locations for company if plugin [[Plugins#Unit location|Unit location plugin]] is activated. Return
+
Returns available locations for company if Custom Feature [[Custom_Features#Multiple_Locations|Multiple locations Custom Feature]] is activated. Return
an error with code -32001 if plugin is not activated. Use <code>[[#isPluginActivated|isPluginActivated('location')]]</code>
+
an error with code -32001 if Custom Feature is not activated. Use <code>[[#isPluginActivated|isPluginActivated('location')]]</code>
API method to check if plugin activated.
+
API method to check if Custom Feature activated.
  
 +
This method accepts two boolean flags as parameters. If '''isPublic''' flag is '''true''' then method returns only
 +
public locations. If '''asArray''' flag is '''true''' method returns list of objects. Otherwise method returns
 +
map of objects with object id as key. You can omit both parameters.
  
 
----
 
----
Line 732: Line 952:
 
Returns Array.
 
Returns Array.
  
Returns a list of all plugins associated with company with status.
+
Returns a list of all Custom Features associated with company with status.
  
  
 +
----
 +
 +
<!---=== getPluginPromoInfoByCode ===
 +
 +
<code>getPluginPromoInfoByCode($code)</code>
 +
 +
Parameters:
 +
 +
* '''$code''' 
 +
 +
Returns Array.
 +
 +
Returns an object with detailed information about Rewards and referrals promotion by promotion code. You can get promotion code
 +
using <code>[[Catalogue#getPromotionList|getPromotionList]]</code> API method. If promotion record with specified code not found then method returns an empty array (an empty object). If [[Rewards_and_Referrals_custom_feature|Rewards and Referrals Custom Feature]]
 +
not enabled then method returns an error with code -32001 (Custom Feature is not activated). Use
 +
<code>[[#isPluginActivated|isPluginActivated('promo')]]</code> API method call to check if Custom Feature 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).
 +
--->
 
----
 
----
  
Line 747: Line 985:
 
Returns Array.
 
Returns Array.
  
Return plugin status true if status active, else false. See [[#Plugin's identifiers|list of available plugin's names]].
+
Return Custom Feature status true if status active, else false. See [[Company_administration_service_methods#Custom_Features.27_identifiers|list of available plugin's names]].
  
  
Line 779: Line 1,017:
 
* '''$time''' String  
 
* '''$time''' String  
 
* '''$recurringData''' Array  
 
* '''$recurringData''' Array  
* '''$endDateTime''' null
+
* '''$endDateTime''' String (optional)
  
 
Returns Array.
 
Returns Array.
Line 798: Line 1,036:
 
Returns Array.
 
Returns Array.
  
Get recurring settings for event
+
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]
  
 
----
 
----
Line 809: Line 1,051:
 
Parameters:
 
Parameters:
  
* '''$groupBy''' String  
+
* '''$groupBy''' String either 'day', 'week' or 'month'
  
 
Returns Array.
 
Returns Array.
  
Get number of registration grouped by day/week/month
+
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
  
  
Line 828: Line 1,073:
 
* '''$eventId''' Integer  
 
* '''$eventId''' Integer  
 
* '''$unitId''' Integer  
 
* '''$unitId''' Integer  
 +
* '''$count''' Integer
 +
 +
Returns Object.
 +
 +
Returns map of objects for each day in specified date range. The key of the result mps is a date string. The value
 +
is an array of two objects. Both objects contains list of time slots for type <code>reserved_time</code> and type
 +
<code>not_worked_time</code>. <code>reserved_time</code> type represents time slots working time but already booked
 +
by clients. Nobody knows what kind of data represented by <code>not_worked_time</code> type. Please don't use it.If [[Custom_Features#Calendar_Sync| Calendar Sync Custom Feature]] enabled then object with
 +
<code>reserved_time</code> type will contain not empty list of time slots marked as busy in Google calendar. Call
 +
<code>[[#isPluginActivated|isPluginActivated('google_calendar_export')]]</code> API method to check if Calendar Sync Custom Feature activated.
 +
 +
 +
Example:
 +
<pre>
 +
  {
 +
    "2016-02-05": [
 +
      {
 +
        "dd": [], // time slots from Google calendar
 +
        "events": [ // reserved time slots
 +
          { "from": "16:00", "to": "16:30" },
 +
          { "from": "16:30", "to": "17:00" },
 +
          ... ],
 +
        "type": "reserved_time",
 +
      },
 +
      {
 +
        "events": [
 +
          { "from": "09:00", "to": "09:30" },
 +
          { "from": "09:30", "to": "10:00" },
 +
          ... ],
 +
        "type": "not_worked_time"
 +
    }],
 +
    ...
 +
  }
 +
</pre>
 +
 +
 +
----
 +
 +
=== getReservedTimeIntervals ===
 +
 +
<code>getReservedTimeIntervals($dateFrom, $dateTo, $eventId, $unitId, $count)</code>
 +
 +
Parameters:
 +
 +
* '''$dateFrom''' String
 +
* '''$dateTo''' String
 +
* '''$eventId''' Integer
 +
* '''$unitId''' Integer|Array
 
* '''$count''' Integer  
 
* '''$count''' Integer  
  
Line 833: Line 1,126:
  
 
Returns not available time
 
Returns not available time
Eg.: <code>{'2014-05-14': [{'events': [{'from': '14:00', 'to': '14:30'}], 'type': "reserved_time"}, ...], ...}</code>
+
Eg.: <code>{'2014-05-14': [{'reserved_time': [{'from': '14:00', 'to': '16:30'}], 'type': "reserved_time"}, ...], ...}</code>
  
  
Line 870: Line 1,163:
 
Eg.: <code>{'2014-05-14': ['09:00:00', ...], ...}</code>
 
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
+
If locations Custom Feature 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
+
units available only for selected location. See [[Custom_Features#Multiple_Locations|Multiple locations]] Custom Feature description for
 
more details.
 
more details.
  
Line 884: Line 1,177:
 
Returns Array.
 
Returns Array.
  
Returns list of available statuses or an empty list if [[Plugins#Status|Status plugin]] not enabled.
+
Returns list of available statuses or an empty list if [[Custom_Features#Status|Status Custom feature]] not enabled.
  
  
Line 896: Line 1,189:
 
Returns Integer.
 
Returns Integer.
  
Returns company timeframe
+
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 [[Need_to_change_interval_(timeframe)|here]].
  
  
 
----
 
----
  
=== getTopPerformers ===
+
=== getTimelineType ===
  
<code>getTopPerformers()</code>
+
<code>getTimelineType()</code>
  
 
No arguments.
 
No arguments.
Returns Array.
+
Returns String.
  
Returns a list with statistics for performers. This data contains number of bookings and revenues value for each performer.
+
Returns company calendar layout type
 +
 
 +
 
 +
----
 +
 
 +
=== 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.
  
  
Line 941: Line 1,246:
 
Returns Array.
 
Returns Array.
  
Returns service performrs list
+
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.
  
  
Line 952: Line 1,259:
 
Parameters:
 
Parameters:
  
* '''$dateStart'''
+
* '''$dateStart''' string
* '''$dateEnd'''
+
* '''$dateEnd''' string
 
* '''$unitGroupId''' integer  
 
* '''$unitGroupId''' integer  
  
Line 969: Line 1,276:
 
Parameters:
 
Parameters:
  
* '''$dateStart''' null
+
* '''$dateStart''' string
* '''$dateEnd''' null
+
* '''$dateEnd''' string
 
* '''$unitGroupId''' integer  
 
* '''$unitGroupId''' integer  
  
Line 990: Line 1,297:
 
Returns Array.
 
Returns Array.
  
Get visitor stats
+
Returns statistics about page visits if Custom Feature [[Custom_Features#Visitor_Counter|Visitor Counter Custom Feature]] enabled. Returns
 +
an empty list if Custom Feature not enabled. Use <code>[[#isPluginActivated|isPluginActivated('counter')]]</code> API method
 +
call to check if Custom Feature 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
  
 +
 +
----
 +
 +
=== getWarnings ===
 +
 +
<code>getWarnings($lastOnly)</code>
 +
 +
Parameters:
 +
 +
* '''$lastOnly'''  Boolean. Default value is '''false'''.
 +
 +
Returns Array.
 +
 +
Returns a list of objects represented system warnings. Each warning contains <code>warning_type</code> and <code>warning_text</code>
 +
properties. <code>warning_text</code> property contains localized message. <code>warning_type</code> can be one of the values:
 +
 +
* '''sms_limit''' – warning indicates low amount of SMS credits
 +
* '''sheduler_limit''' – warning indicates low amount of available bookings
  
 
----
 
----
Line 1,015: Line 1,345:
 
=== getWorkDaysInfo ===
 
=== getWorkDaysInfo ===
  
<code>getWorkDaysInfo($from, $to, $unitId, $eventId)</code>
+
<code>getWorkDaysInfo($from, $to, $unitId, $eventId, $count)</code>
  
 
Parameters:
 
Parameters:
Line 1,021: Line 1,351:
 
* '''$from''' String  
 
* '''$from''' String  
 
* '''$to''' String  
 
* '''$to''' String  
* '''$unitId''' Integer  
+
* '''$unitId''' Integer (optional)
* '''$eventId''' null
+
* '''$eventId''' Integer (optional)
 +
* '''$count''' Integer (optional)
  
 
Returns Object.
 
Returns Object.
  
Returns working time for date period, taking into account breaktimes
+
Returns an information about working hours and break times for specified service and performer for a period
Eg.: <code>{'2014-05-14': [{'from': '09:00:00', 'to': '10:00:00'}, ...], ...}</code>
+
between two dates. If only service specified then information about performer (or performers) will be taken from
 +
service configuration. Method returns a list of objects for each date in specified period. Count of objects in
 +
list depends on break times. For example if performer works from 9:00 till 19:00 with one hour break at 13:00 method
 +
returns:<pre>
 +
  {'2014-05-14' : [
 +
    {'from': '09:00:00', 'to': '13:00:00'},
 +
    {'from': '14:00:00', 'to': '19:00:00'}
 +
  ] }
 +
</pre>
 +
 
 +
Warning! Method can return a time string '24:00:00' as right edge of time range. This happens in case if time
 +
range finishes on midnight.
  
  
Line 1,034: Line 1,376:
 
=== getWorkDaysTimes ===
 
=== getWorkDaysTimes ===
  
<code>getWorkDaysTimes($startDateTime, $endDateTime)</code>
+
<code>getWorkDaysTimes($startDateTime, $endDateTime, $type = 'unit_group')</code>
  
 
Parameters:
 
Parameters:
Line 1,040: Line 1,382:
 
* '''$startDateTime''' string  
 
* '''$startDateTime''' string  
 
* '''$endDateTime''' string  
 
* '''$endDateTime''' string  
 +
* '''$type''' string. Optional. Either 'unit_group' or 'event'.
  
 
Returns Array.
 
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
+
Return busy time by unit id by Calendar Sync Custom Feature if enabled. Please note that this method may return not actual data because data synchronization between server and Google/Outlook Calendar may take some time and synchronized data are cached for 15 minutes.
 
 
  
 
----
 
----
Line 1,054: Line 1,396:
 
Parameters:
 
Parameters:
  
* '''$dateStart''' null
+
* '''$dateStart''' string
* '''$dateEnd''' null
+
* '''$dateEnd''' string
 
* '''$unitGroupId''' integer  
 
* '''$unitGroupId''' integer  
  
Line 1,082: Line 1,424:
 
Returns Boolean.
 
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]].
+
Return Custom Feature status true if status active, else false. <var>$pluginName</var> parameter is a Custom Feature identifier.See [[Custom_Features|Custom Features]] page for full Custom Features description. See [[Company_administration_service_methods#Custom_Features.27_identifiers|list of available plugin's names]].
  
  
Line 1,097: Line 1,439:
 
Returns Array.
 
Returns Array.
  
Approve booking (approve booking plugin)
+
Sets approve booking status to 'approved' if [[Custom_Features#Approve_Bookings|Approve booking]] Custom Feature enabled and returns
Return approved booking ids
+
list of approved booking IDs. Returns false if Custom Feature not enabled. Use <code>[[#isPluginActivated|isPluginActivated('approve_booking')]]</code>
 +
API method call to check if Custom Feature enabled.
  
  
Line 1,113: Line 1,456:
 
Returns Boolean.
 
Returns Boolean.
  
Cancel booking (approve booking plugin)
+
Sets approve booking status to 'canceled' if [[Custom_Features#Approve_Bookings|Approve bookings]] Custom Feature enabled and returns
 +
true. Returns false if Custom Feature not enabled. Use <code>[[#isPluginActivated|isPluginActivated('approve_booking')]]</code>
 +
API method call to check if Custom Feature enabled.
  
  
Line 1,125: Line 1,470:
 
Returns array.
 
Returns array.
  
Return list of all pending bookings
+
Returns list of objects with information about bookings pending approval if [[Custom_Features#Approve_Bookings|Approve bookings]]
 +
Custom Feature enabled. Returns empty list if Custom Feature not enabled. Use <code>[[#isPluginActivated|isPluginActivated('approve_booking')]]</code>
 +
API method call to check if Custom Feature enabled.
  
  
Line 1,137: Line 1,484:
 
Returns Integer.
 
Returns Integer.
  
Return count of pending bookings
+
Returns count of bookings pending approval if [[Custom_Features#Approve_Bookings|Approve bookings]] Custom Feature enabled. Returns
 +
0 if Custom Feature not enabled. Use <code>[[#isPluginActivated|isPluginActivated('approve_booking')]]</code> API method
 +
call to check if Custom Feature enabled.
  
  
Line 1,157: Line 1,506:
  
 
----
 
----
 +
=== getBookingStatus ===
  
=== setStatus ===
+
<code>getBookingStatus ($bookingId)</code>
 +
 
 +
Parameters:
 +
 
 +
* '''$bookingId''' Integer
 +
 
 +
Returns Array.
 +
 
 +
Returns an object of status of given booking (if status plugin is enabled)
 +
default status will be returned if bookingId does not exists
 +
 
 +
----
 +
 
 +
=== setStatus ===
  
 
<code>setStatus($bookingId, $statusId)</code>
 
<code>setStatus($bookingId, $statusId)</code>
Line 1,170: Line 1,533:
  
 
Sets specified status for booking. Returns an error with code -32020 if logged in user don't have access to edit
 
Sets specified status for booking. Returns an error with code -32020 if logged in user don't have access to edit
bookings. This method does nothing if [[Plugins#Status|Status plugin]] not enabled.
+
bookings. This method does nothing if [[Custom_Features#Status|Status Custom feature]] not enabled.
  
  
Line 1,190: Line 1,553:
 
----
 
----
  
 +
=== setWorkDayInfo===
  
== Constants ==
+
<code>setWorkDayInfo($info)</code>
 +
 
 +
Parameters:
 +
 
 +
* '''$info''' Array
 +
 
 +
Returns true on success
 +
 
 +
Set work day schedule for company|service|provider for week_day|date
 +
 
 +
Example:
 +
<pre>
 +
{
 +
"start_time":"10:00",
 +
"end_time":"18:00",
 +
"is_day_off":0,
 +
"breaktime":[{"start_time":"14:00","end_time":"15:00"}],
 +
"index":"1",
 +
"name":"Monday",
 +
"date":"",
 +
"unit_group_id":"",
 +
"event_id":""
 +
}
  
=== Error codes ===
+
index is 1-7 for Monday - Sunday (used for weekly settings)
 +
date is used to set worktime for special date
 +
unit_group_id is provider id
 +
event_id is service id
 +
if unit_group_id and event_id not passed then it set data for company
 +
</pre>
  
See [[Errors handling]] for details.
+
----
  
* -32001 Plugin is not activated
+
=== deleteSpecialDay===
* -32010 Some required params are missed
+
 
* -32011 Params is not array
+
<code>deleteSpecialDay($date, $params = null)</code>
* -32012 Sheduler id not found
+
 
* -32020 Sorry, you have no permissions to perform this action
+
Parameters:
* -32030 Invalid promotion code
+
 
* -32031 Promotion has expired
+
* '''$date''' String
* -32032 Promotion is not active yet
+
* '''$params''' Array
* -32033 This promocode is not valid for selected service
+
 
* -32034 Exceed max usage limit
+
Returns true on success
* -32035 Exceed max usage per customer limit'const
+
 
* -32036 This promocode is not available for datetime range
+
Delete special date if set
* -32051 Selected event id is not available
+
 
* -32052 Selected unit id is not available
+
Example:
* -32053 Selected date start is not available
+
<pre>
* -32054 Selected time start is not available
+
'2017-08-21',
* -32055 One or more appointments couldn't be reserved
+
{
* -32056 Booking is not allowed at this time
+
    "unit_group_id":"",
* -32061 Client name value is wrong
+
    "event_id":""
* -32062 Client email value is wrong
+
}
* -32063 Client phone value is wrong
+
</pre>
* -32070 Additional field values are wrong
+
 
* -32080 Appointemnt couldn't be found
+
----
* -32085 Signature error
+
=== addServiceProvider===
* -32090 Confirmation with this key type is not available
+
 
* -32095 Batch not found
+
<code>addServiceProvider($data)</code>
* -32097 Unsupported payment system
+
 
* -32099 Payment failed
+
Parameters:
* -32600
+
 
*: An error with this code can be thrown with one of the following messages:
+
* '''$data''' Array
** Access denied
+
 
** Company does not exists
+
Returns Array with result and id of new service provider (unit_group)
* -32601 Method not found
+
 
* -32602 Invalid params
+
Create new service provider
* -32603 Internal error
+
 
* -3264 Client with given id not found
+
Example:
 +
<pre>
 +
{
 +
"name" : "newtagg1 - 4",
 +
"description" : "Description - 1",
 +
"phone" : "1234567890",
 +
"email" : "test@test.com",
 +
"qty" : "2",
 +
"is_visible" : 1,
 +
"is_active" : 1,
 +
"position" : 2,
 +
"seo_url" : null,
 +
"position_in_location" : null,
 +
}
 +
</pre>
  
 
----
 
----
  
===Company params===
+
=== editServiceProvider===
 +
 
 +
<code>editServiceProvider($id, $data)</code>
 +
 
 +
Parameters:
  
Use these values to get configuration params for company with <code>[[#getCompanyParam|getCompanyParam]]</code> API method.
+
* '''$id''' Integer
 +
* '''$data''' Array
  
Administration API inherits all [[Company public service methods#Company_params|keys]] allowed for public API and extends this list with keys:
+
Returns Array with result and id of new service provider (unit_group)
  
* attach_ical
+
Edit service provider
* auto_redirect
+
(there is no way to delete provider via API, in this case set is_active = 0)
* auto_redirect_text
+
 
* blockchain_address
+
 
* blockchain_secret
+
Example:
* borgun_merchant_id
+
<pre>
* borgun_payment_gateway_id
+
1,
* borgun_secret_code
+
{
* changable_prefix_by_client
+
"name" : "newtagg1 - 4",
* client_batch_cancel_template
+
"description" : "Description - 1",
* client_batch_cancel_template_email
+
"phone" : "1234567890",
* client_batch_cancel_template_email_subject
+
"email" : "test@test.com",
* client_event_cancel_template
+
"qty" : "2",
* client_event_cancel_template_email
+
"is_visible" : 1,
* client_event_cancel_template_email_subject
+
"is_active" : 1,
* client_event_change_template
+
"position" : 2,
* client_event_change_template_email
+
"seo_url" : null,
* client_event_change_template_email_subject
+
"position_in_location" : null,
* client_event_creation_template
+
}
* client_event_creation_template_email
+
</pre>
* client_event_creation_template_email_subject
+
 
* client_event_group_creation_template
+
----
* client_event_group_creation_template_email
+
 
* client_event_group_creation_template_email_subject
+
== Constants ==
* client_event_multiple_creation_template
+
 
* client_event_multiple_creation_template_email
+
=== Error codes ===
* client_event_multiple_creation_template_email_subject
+
 
* client_group_notification_template
+
See [[Errors handling]] for details.
* client_group_notification_template_email
+
 
* client_group_notification_template_email_subject
+
* -32001 Custom Feature is not activated
* client_multiple_notification_template
+
* -32010 Some required params are missed
* client_multiple_notification_template_email
+
* -32011 Params is not array
* client_multiple_notification_template_email_subject
+
* -32012 Sheduler id not found
* client_notification_template
+
* -32015 Passed event id is not reccuren
* client_notification_template_email
+
* -32020 Sorry, you have no permissions to perform this action
* client_notification_template_email_subject
+
* -32030 Invalid promotion code
* client_notification_time
+
* -32031 Promotion has expired
* client_recurring_event_creation_template
+
* -32032 Promotion is not active yet
* client_recurring_event_creation_template_email
+
* -32033 This promocode is not valid for selected service
* client_recurring_event_creation_template_email_subject
+
* -32034 Exceed max usage limit
* common_limit_booking
+
* -32035 Exceed max usage per customer limit'const
* company_currency
+
* -32036 This promocode is not available for datetime range
* company_ga_tracking_id
+
* -32051 Selected event id is not available
* default_phone
+
* -32052 Selected unit id is not available
* disconnect_on_timeout
+
* -32053 Selected date start is not available
* dwolla_application_key
+
* -32054 Selected time start is not available
* dwolla_id
+
* -32055 One or more appointments couldn't be reserved
* dwolla_secret_key
+
* -32056 Booking is not allowed at this time
* email_event_list
+
* -32061 Client name value is wrong
* email_events_list_template
+
* -32062 Client email value is wrong
* email_group_events_list_template
+
* -32063 Client phone value is wrong
* event_list_style
+
* -32070 Intake form values are wrong
* feed_back_interval
+
* -32080 Appointemnt couldn't be found
* feedback_invite_template_email
+
* -32081 Service can't be performed when company does not work
* feedback_invite_template_email_subject
+
* -32082 Service performer can't work when company does not work
* google_conversion_color
+
* -32085 Signature error
* google_conversion_currency
+
* -32090 Confirmation with this key type is not available
* google_conversion_format
+
* -32095 Batch not found
* google_conversion_id
+
* -32097 Unsupported payment system
* google_conversion_label
+
* -32099 Payment failed
* google_conversion_language
+
* -32600
* google_conversion_value
+
*: An error with this code can be thrown with one of the following messages:
* hide_working_hours_block
+
** Access denied
* include_cancel_link
+
** Company does not exists
* kortais_merchant
+
* -32601 Method not found
* kortais_secret_code
+
* -32602 Invalid params
* kortais_terminal
+
* -32603 Internal error
* layout_background
+
* -3264 Client with given id not found
* layout_background_repeat
+
 
* liqpay_merchant_id
+
----
* liqpay_merchant_pass
+
 
* mobile_site_link
+
===Company params===
* mobile_site_link_title
+
 
* no_show_period
+
Use these values to get configuration params for company with <code>[[#getCompanyParam|getCompanyParam]]</code> API method.
* on_success_button_link
+
 
* on_success_button_text
+
=====General params=====
* paypal_account
+
 
* recap_interval
+
Administration API inherits all [[Company public service methods#Company_params|keys]] allowed for public API and extends this list with keys:
* recap_send_after_time
+
 
* recap_send_canceled_bookings
+
* attach_ical
* recap_send_new_bookings
+
* auto_redirect
* recap_send_upcomming_bookings
+
* auto_redirect_text
* send_cancel_to_client
+
* blockchain_address
* send_cancel_to_client_email
+
* blockchain_secret
* send_cancel_to_unit
+
* borgun_merchant_id
* send_cancel_to_unit_email
+
* borgun_payment_gateway_id
* send_contact_widget_email_notification
+
* borgun_secret_code
* send_contact_widget_sms_notification
+
* client_batch_cancel_template
* send_notify_to_client
+
* client_batch_cancel_template_email
* send_notify_to_client_email
+
* client_batch_cancel_template_email_subject
* send_notify_to_unit
+
* client_event_cancel_template
* send_notify_to_unit_email
+
* client_event_cancel_template_email
* send_onchange_to_client
+
* client_event_cancel_template_email_subject
* send_onchange_to_client_email
+
* client_event_change_template
* send_onchange_to_unit
+
* client_event_change_template_email
* send_onchange_to_unit_email
+
* client_event_change_template_email_subject
* send_oncreate_to_client
+
* client_event_creation_template
* send_oncreate_to_client_email
+
* client_event_creation_template_email
* send_oncreate_to_unit
+
* client_event_creation_template_email_subject
* send_oncreate_to_unit_email
+
* client_event_group_creation_template
* send_sms_if_push_enabled
+
* client_event_group_creation_template_email
* site_link
+
* client_event_group_creation_template_email_subject
* site_link_title
+
* client_event_multiple_creation_template
* skip_limits_for_admin
+
* client_event_multiple_creation_template_email
* skip_show_mobile_app_ads
+
* client_event_multiple_creation_template_email_subject
* skip_show_on_success_button
+
* client_group_notification_template
* skrill_account
+
* client_group_notification_template_email
* skrill_secret
+
* client_group_notification_template_email_subject
* sms_event_list
+
* client_multiple_notification_template
* sms_events_list_template
+
* client_multiple_notification_template_email
* sms_group_events_list_template
+
* client_multiple_notification_template_email_subject
* unit_batch_cancel_template
+
* client_notification_template
* unit_batch_cancel_template_email
+
* client_notification_template_email
* unit_batch_cancel_template_email_subject
+
* client_notification_template_email_subject
* unit_event_cancel_template
+
* client_notification_time
* unit_event_cancel_template_email
+
* client_recurring_event_creation_template
* unit_event_cancel_template_email_subject
+
* client_recurring_event_creation_template_email
* unit_event_change_template
+
* client_recurring_event_creation_template_email_subject
* unit_event_change_template_email
+
* common_limit_booking
* unit_event_change_template_email_subject
+
* company_ga_tracking_id
* unit_event_creation_template
+
* default_phone
* unit_event_creation_template_email
+
* disconnect_on_timeout
* unit_event_creation_template_email_subject
+
* email_event_list
* unit_event_group_creation_template
+
* email_events_list_template
* unit_event_group_creation_template_email
+
* email_group_events_list_template
* unit_event_group_creation_template_email_subject
+
* event_list_style
* unit_group_notification_template
+
* feed_back_interval
* unit_group_notification_template_email
+
* feedback_invite_template_email
* unit_group_notification_template_email_subject
+
* feedback_invite_template_email_subject
* unit_notification_template
+
* google_conversion_color
* unit_notification_template_email
+
* google_conversion_currency
* unit_notification_template_email_subject
+
* google_conversion_format
* unit_notification_time
+
* google_conversion_id
* unit_recurring_event_creation_template
+
* google_conversion_label
* unit_recurring_event_creation_template_email
+
* google_conversion_language
* unit_recurring_event_creation_template_email_subject
+
* google_conversion_value
* use_common_client_db
+
* hide_working_hours_block
* user_confirmation
+
* include_cancel_link
* user_license_text
+
* kortais_merchant
* user_public_layout
+
* kortais_secret_code
* user_public_theme
+
* kortais_terminal
* waiting_video
+
* layout_background
* zooz_app_id
+
* layout_background_repeat
* zooz_app_key
+
* mobile_site_link
----
+
* mobile_site_link_title
 
+
* no_show_period
===Plugin's identifiers===
+
* on_success_button_link
 
+
* on_success_button_text
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.
+
* recap_interval
 
+
* recap_send_after_time
* advanced_notification
+
* recap_send_canceled_bookings
*:Book Soon notification system plugin
+
* recap_send_new_bookings
* any_unit
+
* recap_send_upcomming_bookings
*:Any Employee selector plugin
+
* send_cancel_to_client
* api
+
* send_cancel_to_client_email
*:API plugin
+
* send_cancel_to_unit
* approve_booking
+
* send_cancel_to_unit_email
*:Approve booking plugin
+
* send_contact_widget_email_notification
* back_to_site
+
* send_contact_widget_sms_notification
*:Take me back home plugin
+
* send_notify_to_client
* contact_widget
+
* send_notify_to_client_email
*:Contact widget plugin
+
* send_notify_to_unit
* counter
+
* send_notify_to_unit_email
*:Visitor Counter plugin
+
* send_onchange_to_client
* custom_css
+
* send_onchange_to_client_email
*:Custom CSS plugin
+
* send_onchange_to_unit
* data_security
+
* send_onchange_to_unit_email
*:Clean history plugin
+
* send_oncreate_to_client
* description
+
* send_oncreate_to_client_email
*:HTML description field for events
+
* send_oncreate_to_unit
* event_category
+
* send_oncreate_to_unit_email
*:Service categories plugin
+
* send_sms_if_push_enabled
* event_field
+
* site_link
*:Additional fields plugin
+
* site_link_title
* facebookImage
+
* skip_limits_for_admin
*:Facebook client info plugin
+
* skip_show_mobile_app_ads
* financial_dashboard
+
* skip_show_on_success_button
*:Insights plugin
+
* sms_event_list
* google_analytics
+
* sms_events_list_template
*:Google Adwords and analytics plugin
+
* sms_group_events_list_template
* google_calendar_export
+
* unit_batch_cancel_template
*:Google calendar sync plugin
+
* unit_batch_cancel_template_email
* group_booking
+
* unit_batch_cancel_template_email_subject
*:Group bookings plugin
+
* unit_event_cancel_template
* hipaa
+
* unit_event_cancel_template_email
*:HIPAA plugin
+
* unit_event_cancel_template_email_subject
* limit_bookings
+
* unit_event_change_template
*:Limit bookings plugin
+
* unit_event_change_template_email
* location
+
* unit_event_change_template_email_subject
*:Unit location plugin
+
* unit_event_creation_template
* mobile_app_backend
+
* unit_event_creation_template_email
*:Mobile application plugin
+
* unit_event_creation_template_email_subject
* multiple_booking
+
* unit_event_group_creation_template
*:Multiple bookings plugin
+
* unit_event_group_creation_template_email
* news
+
* unit_event_group_creation_template_email_subject
*:News plugin
+
* unit_group_notification_template
* paid_events
+
* unit_group_notification_template_email
*:Accept payments plugin
+
* unit_group_notification_template_email_subject
* promo
+
* unit_notification_template
*:Simply Smart Promotions plugin
+
* unit_notification_template_email
* recap
+
* unit_notification_template_email_subject
*:Daily report plugin
+
* unit_notification_time
* secure
+
* unit_recurring_event_creation_template
*:SSL plugin
+
* unit_recurring_event_creation_template_email
* status
+
* unit_recurring_event_creation_template_email_subject
*:Status plugin
+
* use_common_client_db
* unit_colors
+
* user_confirmation
*:Providers color coding plugin
+
* user_public_layout
* user_license
+
* user_public_theme
*:Terms and conditions plugin
+
* waiting_video
 +
 
 +
=====Accept payments Custom Feature params=====
  
See [[Plugins]] page for description for each plugin.
+
Read more about [[Custom_Features#Accept_Payments|Accept Payments Custom Feature configuration]].
----
 
  
== Examples ==
+
* allow_delay_payment
 +
*: Allow delay payment option. Boolean.
 +
* company_currency
 +
*:
 +
* hide_sale_tax
 +
*: Hide sales tax option. Boolean.
 +
* payment_timeout
 +
*: Payment timeout option. String ("5 minutes", "1 hour", ...)
 +
* sale_tax
 +
*: Sales tax option. Integer. You should divide by 100 to get percent value.
 +
* paypal_account
 +
*: PayPal payment processor configuration. String.
 +
* skrill_account
 +
*: Skrill payment processor configuration parameter. String.
 +
* skrill_secret
 +
*: Skrill payment processor configuration parameter. String.
 +
* zooz_app_id
 +
*: ZooZ payment processor configuration parameter. String.
 +
* zooz_app_key
 +
*: ZooZ payment processor configuration parameter. String.
 +
* dwolla_application_key
 +
*: Dwolla payment processor configuration parameter. String.
 +
* dwolla_id
 +
*: Dwolla payment processor configuration parameter. String.
 +
* dwolla_secret_key
 +
*: Dwolla payment processor configuration parameter. String.
 +
* liqpay_merchant_id
 +
* liqpay_merchant_pass
  
====getBookingDetails response====
+
=====Term & Conditions Custom Feature params=====
  
An example of data returned by [[#getBookingDetails|getBookingDetails]] API method.
+
Read more about [[Custom_Features#Terms_and_Conditions|Terms and Conditions Custom Feature]].
  
   {
+
* user_license_text
     "id": "321",
+
*: Terms and conditions text. String.
     "event_id": "5",
+
 
     "event_name": "Massage",
+
----
     "unit_id": "3",
+
 
     "unit_name": "John",
+
===Custom Features' identifiers===
     "client_id": "1",
+
 
     "client_name": "Bob",
+
Custom Feature identifier is a string constant which represents a Custom Feature in system. These constants used in <code>[[#isPluginActivated|isPluginActivated]]</code> and <code>[[#getPluginStatuses|getPluginStatuses]]</code> API methods.
     "start_date_time": "2015-11-25 15:00:00",
+
 
     "end_date_time": "2015-11-25 16:00:00",
+
* advanced_notification
     "is_confirmed": "1",
+
*:Book Soon notification system
     "code": "h8v8w5ls",
+
* any_unit
     "record_date": "2015-11-19 04:06:38",
+
*:Any Employee selector
     "comment": null,
+
* api
     "company_login": "testzt",
+
*:API
     "company_name": "My Cool Company",
+
* approve_booking
     "company_phone": "+1-555-55-55",
+
*:Approve booking
     "company_email": "into@mycoolcompany.com",
+
* back_to_site
     "additional_fields": [{
+
*:Take me back home
       "value": "on",
+
* contact_widget
       "field_name": "201a89517de509f6b3a60858918faac3",
+
*:Contact widget
       "field_title": "Include washing",
+
* counter
       "field_position": "4",
+
*:Visitor Counter
       "field_type": "checkbox",
+
* custom_css
       "field_id": "4"
+
*:Custom CSS
     }],
+
* data_security
     "comments": [],
+
*:Clean history
     "history": [{
+
* description
       "id": "536",
+
*:HTML description field for events
       "sheduler_id": "321",
+
* event_category
       "datetime": "2015-11-19 11:06:38",
+
*:Service categories
       "type": "create",
+
* event_field
       "user_id": "1",
+
*:Intake forms
       "agent": "SimplyBook.me\/55 CFNetwork\/758.0.2 Darwin\/15.0.0",
+
* facebookImage
       "ip": "213.174.0.53, 158.69.224.50:127.0.0.1",
+
*:Facebook client info
       "referer": "",
+
* financial_dashboard
       "login": "admin",
+
*:Insights
       "firstname": "Mikhail",
+
* google_analytics
       "lastname": ""
+
*:Google Adwords and analytics
     }],
+
* google_calendar_export
     "status": {
+
*:Calendar sync
       "id": "3",
+
* group_booking
       "name": "Fancy Status",
+
*:Group bookings
       "description": null,
+
* hipaa
       "color": "4cbadb",
+
*:HIPAA
       "is_default": "1"
+
* limit_bookings
     },
+
*:Limit bookings
     "location": {
+
* location
       "id": "1",
+
*:Multiple locations
       "title": "location",
+
* mobile_app_backend
       "description": null,
+
*:Mobile application
       "picture": "e1e9409fe9682c78b2f8f294dc151af0.jpg",
+
* multiple_booking
       "address1": null,
+
*:Multiple bookings
       "address2": "Saint Margaret Street",
+
* news
       "city": "\u041b\u043e\u043d\u0434\u043e\u043d",
+
*:News
       "zip": null,
+
* paid_events
       "country_id": "GB",
+
*:Accept payments
       "lat": "51.50013000000000000000",
+
<!--* promo
       "lng": "-0.12630500000000000000",
+
*:Rewards and Referrals-->
       "phone": "44",
+
* recap
       "position": "1",
+
*:Daily report
       "is_default": "1"
+
* secure
     },
+
*:SSL
     "price": [],
+
* status
     "promo": false
+
*:Status
   }
+
* unit_colors
 
+
*:Providers color coding
Location field is present in response only if [[Plugins#Unit location|Unit location plugin]] is enabled. Otherwise this field will be an empty array. If locations plugin is enabled but booking doesn't have any locations this fields also will be an empty array.
+
* user_license
 
+
*:Terms and conditions
Status field is present in response only if [[Plugins#Status|Status plugin]] is enabled. Otherwise this field will be an empty array. If plugin enabled but booking doesn't have any statues specified the default status returned.
+
* cancelation_policy
 
+
*:Cancellation Policy
Price field is present in response only if [[Plugins#Accept payments|Accept payments plugin]] is enabled. Otherwise this field will be an empty array. This field contains an empty array if plugin is enabled but booking was created for a free service.
+
 
 
+
See [[Custom_Features|Custom Features]] page for description for each Custom Feature.
Promo field is present in response only if [[Plugins#Simply Smart Promotions|Simply Smart Promotions plugin]] is enabled. Otherwise this field will be an empty array. This field contains false if plugin is enabled but booking was created without any promo codes.
+
 
 
+
----
<code>additional_fields</code> field is present in response only if [[Plugins#Additional fields|Additional fields plugin]] is enabled. Otherwise this field will be an empty array. This field contains an empty array if plugin is enabled but booking was created for a service with no additional fields.
+
 
 
+
== Examples ==
====book response====
+
 
 
+
====getBookingDetails response====
[[#book|<code>book</code>]] API method returns an object which contains list of objects with short description of newly create bookings. Method returns only one item in 'bookings' array for regular bookings and more than one item for recurring or batch bookings.
+
 
 
+
An example of data returned by [[#getBookingDetails|getBookingDetails]] API method.
   {
+
 
     "require_confirm":false,
+
   {
     "bookings":[
+
     "id": "321",
       {
+
     "event_id": "5",
         "id":"434",
+
     "event_name": "Massage",
        "event_id":"7",
+
     "unit_id": "3",
        "unit_id":"3",
+
     "unit_name": "John",
        "client_id":"34",
+
     "client_id": "1",
        "start_date_time":"2015-12-30 13:00:00",
+
     "client_name": "Bob",
        "end_date_time":"2015-12-30 13:30:00",
+
     "start_date_time": "2015-11-25 15:00:00",
        "is_confirmed":"1",
+
     "end_date_time": "2015-11-25 16:00:00",
        "code":"h8vc14ca",
+
     "is_confirmed": "1",
        "hash":"785cb8cce316e64765b94c05a635f4be"
+
     "code": "h8v8w5ls",
      },
+
     "record_date": "2015-11-19 04:06:38",
      {
+
     "comment": null,
        "id":"435",
+
     "company_login": "testzt",
        "event_id":"7",
+
     "company_name": "My Cool Company",
        "unit_id":"3",
+
     "company_phone": "+1-555-55-55",
        "client_id":"34",
+
     "company_email": "into@mycoolcompany.com",
        "start_date_time":"2015-12-31 13:00:00",
+
     "additional_fields": [{
        "end_date_time":"2015-12-31 13:30:00",
+
       "value": "on",
        "is_confirmed":"1",
+
       "field_name": "201a89517de509f6b3a60858918faac3",
        "code":"h8vc2pge",
+
       "field_title": "Include washing",
        "hash":"8b92d634541bfd93c0830967e56f4653"
+
       "field_position": "4",
      },
+
       "field_type": "checkbox",
      {
+
       "field_id": "4"
        "id":"436",
+
     }],
         "event_id":"7",
+
     "comments": [],
         "unit_id":"3",
+
     "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
 +
   }
 +
 
 +
Location field is present in response only if [[Custom_Features#Multiple_Locations|Multiple locations Custom Feature]] is enabled. Otherwise this field will be an empty array. If locations Custom Feature is enabled but booking doesn't have any locations this fields also will be an empty array.
 +
 
 +
Status field is present in response only if [[Custom_Features#Status|Status Custom Feature]] is enabled. Otherwise this field will be an empty array. If Custom Feature enabled but booking doesn't have any statues specified the default status returned.
 +
 
 +
Price field is present in response only if [[Custom_Features#Accept_Payments|Accept payments Custom Feature]] is enabled. Otherwise this field will be an empty array. This field contains an empty array if Custom Feature is enabled but booking was created for a free service.
 +
 
 +
<!--Promo field is present in response only if [[Rewards_and_Referrals_custom_feature|Rewards and Referrals Custom Feature]] is enabled. Otherwise this field will be an empty array. This field contains false if Custom Feature is enabled but booking was created without any promo codes.
 +
-->
 +
<code>additional_fields</code> field is present in response only if [[Custom_Features#Intake_Forms|Intake Forms Custom Feature]] is enabled. Otherwise this field will be an empty array. This field contains an empty array if Custom Feature is enabled but booking was created for a service with no intake forms.
 +
 
 +
----
 +
 
 +
====book response====
 +
 
 +
[[#book|<code>book</code>]] API method returns an object which contains list of objects with short description of newly create bookings. Method returns only one item in 'bookings' array for regular appointment and more than one item for recurring or batch bookings.
 +
 
 +
   {
 +
     "require_confirm":false,
 +
     "bookings":[
 +
       {
 +
         "id":"434",
 +
         "event_id":"7",
 +
         "unit_id":"3",
 
         "client_id":"34",
 
         "client_id":"34",
         "start_date_time":"2016-01-04 13:00:00",
+
         "start_date_time":"2015-12-30 13:00:00",
         "end_date_time":"2016-01-04 13:30:00",
+
         "end_date_time":"2015-12-30 13:30:00",
 
         "is_confirmed":"1",
 
         "is_confirmed":"1",
         "code":"h8vc3urb",
+
         "code":"h8vc14ca",
         "hash":"cd22a0bf183f7350e595988dd2486e5b"
+
         "hash":"785cb8cce316e64765b94c05a635f4be"
 
       },
 
       },
 
       {
 
       {
         "id":"437",
+
        "id":"435",
 +
        "event_id":"7",
 +
        "unit_id":"3",
 +
        "client_id":"34",
 +
        "start_date_time":"2015-12-31 13:00:00",
 +
        "end_date_time":"2015-12-31 13:30:00",
 +
        "is_confirmed":"1",
 +
        "code":"h8vc2pge",
 +
        "hash":"8b92d634541bfd93c0830967e56f4653"
 +
      },
 +
      {
 +
        "id":"436",
 +
        "event_id":"7",
 +
        "unit_id":"3",
 +
        "client_id":"34",
 +
        "start_date_time":"2016-01-04 13:00:00",
 +
        "end_date_time":"2016-01-04 13:30:00",
 +
        "is_confirmed":"1",
 +
        "code":"h8vc3urb",
 +
        "hash":"cd22a0bf183f7350e595988dd2486e5b"
 +
      },
 +
      {
 +
         "id":"437",
 
         "event_id":"7",
 
         "event_id":"7",
 
         "unit_id":"3",
 
         "unit_id":"3",
Line 1,595: Line 2,117:
 
     "batch_hash":"357178bce290381bb7235080941ec143"
 
     "batch_hash":"357178bce290381bb7235080941ec143"
 
   }
 
   }
 +
 +
====getCompanyInfo response====
 +
 +
An example of data returned by [[#getCompanyInfo|getCompanyInfo]] API method.
 +
 +
  {
 +
    "login": "pierrecoetzee",
 +
    "name": "Pierre",
 +
    "description": "Write a description about your company or about you as a service provider. You can add other service providers inside the system and each can have his own description.",
 +
    "address1": "",
 +
    "address2": "Storey's Gate, ",
 +
    "city": "London",
 +
    "country_id": "GB",
 +
    "lat": "51.500435",
 +
    "lng": "-0.129811",
 +
    "email": "pierre.coe@gmail.com",
 +
    "phone": "",
 +
    "web": null,
 +
    "skip_address": null,
 +
    "logo": null,
 +
    "address": "GB, London, Storey's Gate, ",
 +
    "description_text": "Write a description about your company or about you as a service provider. You can add other service providers inside the system and each can have his own description.",
 +
    "timezone": "Europe London",
 +
    "show_in_client_timezone": false,
 +
    "timeframe": "60",
 +
    "timeline_type": "modern_week",
 +
    "allow_event_day_break": "0",
 +
    "allow_event_breaktime_break": "0"
 +
  }
 +
 +
<code>timeline_type</code> field can be one the following values:
 +
 +
* flexible
 +
* modern
 +
* flexible_week
 +
* modern_week
 +
* classic
 +
* classes
 +
 +
 +
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.
 +
 +
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]].
 +
----
 +
 +
<!--====getPluginPromoInfoByCode response====
 +
 +
  {
 +
    "id": "1",
 +
    "title": "[service\/services] with [discount]% discount!",
 +
    "code": "yvuvugum",
 +
    "description": "We are offering [service\/services] with an amazing [discount]% discount! We are running this deal for a limited time only.",
 +
    "discount": "99.9999",
 +
    "start_date": "2015-12-23",
 +
    "expired_date": "2016-01-23",
 +
    "sheduler_start_date": "2015-12-23",
 +
    "sheduler_end_date": "2015-12-31",
 +
    "sheduler_start_time": "09:00:00",
 +
    "sheduler_end_time": "22:30:00",
 +
    "allow_usage_count": "20",
 +
    "fineprint_text": "Deal is limited for new clients only. Reward is claimable [client_claim_times_number] times per client. Deal is only claimable for the locations specified. Deal is cannot be combined with any other promotion. Must be redeemed prior to the expiration date shown on the deal.",
 +
    "redemption_text": "Present your confirmation code when you want to redeem your deal. You may either to print off your confirmation email or show your confirmation code by loggin into Simplybook on your mobile phone\/Pc.\r\n[promocode]\r\n[discount]\r\n[reward]\r\n[referal_qty]",
 +
    "headline": "[service\/services] with [discount]% discount!",
 +
    "image": null,
 +
    "allow_customer_count": "1",
 +
    "show_in_catalogue": "1",
 +
    "status": "active",
 +
    "plugin_promo_message_id": "1",
 +
    "common_promotion_id": "132",
 +
    "service_ids": ["1"]
 +
  }
 +
 +
<code>service_ids</code> contains a list of services for wich promotion discount can be applied.
 +
-->

Latest revision as of 08:50, 26 August 2022

General Information

SimplyBook.me API service build on JSON-RPC remote procedure call protocol. A remote method is invoked by sending a request to a remote service using HTTPS. All transfer types are single objects, serialized using JSON. A request is a call to a specific method provided by a remote system. It must contain three certain properties:

  • jsonrpc - a version of JSON-RPC protocol. Always "2.0"
  • method - A String with the name of the method to be invoked.
  • params - An Array of objects to be passed as parameters to the defined method.
  • id - A value of any type, which is used to match the response with the request that it is replying to.

The receiver of the request must reply with a valid response to all received requests. A response must contain the properties mentioned below.

  • result - The data returned by the invoked method. If an error occurred while invoking the method, this value must be null.
  • error - A specified error code if there was an error invoking the method, otherwise null.
  • id - The id of the request it is responding to.

Example

  Request
  {
    "jsonrpc": "2.0",
    "method": "getEventList",
    "params":[],
    "id":1
  }
  
  Response
  {
    "result": {
        "1": {
            "id": "1",
            "name": "Часовая фотосесcия",
            "duration": "60",
            "hide_duration": "0",
            "description": "<p>Если Вы хотите попробовать себя в роли модели, но не определились с образом. <br /> 5-7 отретушированных и готовых к печати фотографий + отснятый материал на диске</p>",
            "picture": "a200edab10b669225e22d2b3803a38b5.jpg",
            "is_public": "1",
            "is_active": "1",
            "position": "0",
            "is_recurring": "0",
            "picture_path": "/uploads/mib/event__picture/small/a200edab10b669225e22d2b3803a38b5.jpg",
            "price": "300.0000",
            "currency": "UAH",
            "categories": ["1"]
        },
        ...
    },
    "id": "1",
    "jsonrpc": "2.0"
  }

Example of request with error response:

  Request
  {
    "jsonrpc": "2.0",
    "method": "someNotExistingMethod",
    "params":[],
    "id":1
  }
  
  Response
  {
    "jsonrpc": "2.0",
    "id":1,
    "error": {
      "code": -32601,
      "message": "Method not found"
    }
  }

All calls of public service methods should have additional HTTP header:

Endpoint

Use URL https://user-api.simplybook.me/admin for all administration service API calls.

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 getUserToken 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 'Custom Features' link and select API Custom Feature 'Settings'.

Methods

Methods

addClient

addClient($clientData)

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 getCompanyParam('require_fields') 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

addDeviceToken($token, $device)

Parameters:

  • $token String a device token string
  • $device String a device type ('android' or 'apple')

Returns boolean.

Subscribe a mobile device to push notifications service. Device will recieve notifications about new bookings or changes in already created bookings. Use either 'apple' or 'android' for device parameter.


book

book($eventId, $unitId, $clientId, $startDate, $startTime, $endDate, $endTime, $clientTimeOffset, $additional, $count, $batchId, $recurringData)

Parameters:

  • $eventId Integer
  • $unitId Integer
  • $clientId Integer
  • $startDate string a date string in format 'Y-m-d'
  • $startTime string a time string in format 'H:i:s'
  • $endDate string a date string in format 'Y-m-d'
  • $endTime string a time string in format 'H:i:s'
  • $clientTimeOffset Integer
  • $additional array|Object - additional params and fields.
  • $count Integer bookings count used to make group bookings batch. This parameter can't be less than 1. (optional)
  • $batchId Integer add booking to group bookings batch. You can't use $count and $batchId in one call. Please specify only one parameter. (optional)
  • $recurringData Array - make booking recurrent. (optional)

Returns Object.

Creates new booking record. Returns an object with appointment information or throw exception if booking time not available or any of required parameters missed. If appointment requires confirmation, in result object will be require_confirm = true. $startDate and $startTime specifies a date of booking and time slot. Time value should be multiple to 'timeframe' configuration of company (see getTimeframe API method). $endDate and $endTime parameters should be calculated according to service duration. However you can specify different values to make appointment longer or shorter then service configuration. Note that $endDate and $endTime should be later in time than $startDate and $startTime. If your clients located in different time zone you should specify $clientTimeOffset parameter as difference between company's time zone and client's time zone in seconds. For example if company located in city with time zone GMT+2 and customer located in city with GMT+3 then $clientTimeOffset will be -3600 seconds. You can get information about company's time zone using getCompanyInfo API method. To create batch booking you can specify either count more then 1 or valid batchId (only one parameter can be specified). You should specify an $additionalFields parameter if service requires some intake forms (see Intake Forms Custom feature).To create a booking with promo code you should pass it as additional field. For example: {"promocode": "some code"}

If Multiple locations enabled you need to pass locations ID parameter as additional field location_id. For example: {"location_id": "1"}. Use isPluginActivated('location') to check if Custom feature active and getLocationsList() method to get list of available locations.

See example of book API method response.

See also:


calculateEndTime

calculateEndTime($startDateTime, $eventId, $unitId)

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



cancelBatch

cancelBatch($id, $bookingIds)

Parameters:

  • $id Integer identifier of batch. See createBatch API method.
  • $bookingIds Array ids of bookings included to batch.

Returns boolean.

Cancel batch of bookings. Returns true on success. Returns an error with code -32080 (Appointment couldn't be found) if no booking with specified id were found. A booking with first id in $bookingIds list is used for information in notifications.



cancelBooking

cancelBooking($id)

Parameters:

  • $id Integer

Returns Boolean.

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.



createBatch

createBatch()

No arguments. Returns Integer.

Creates new booking batch record. Returns newly created batch id. You can use this id in book API method.



deleteDeviceToken

deleteDeviceToken($token)

Parameters:

  • $token String - device token

Returns boolean.

Unsubscribe from push notifications service.



editBook

editBook($shedulerId, $eventId, $unitId, $clientId, $startDate, $startTime, $endDate, $endTime, $clientTimeOffset, $additional)

Parameters:

  • $shedulerId Integer an id of booking to edit. See book or getBookings API methods.
  • $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 record. See book API method description for more details about date/time parameters, time zone handling and additional fields. Returns null if parameters not valid.



editClient

editClient($clientId, $clientData)

Parameters:

  • $clientId Integer
  • $clientData Object

Returns Integer.

Edits client's record. See addClient method description for list of available fields.Method returns an id of client's record.



filterAvailableUnits

filterAvailableUnits($eventId, $dateTime, $unitIds, $count)

Parameters:

  • $eventId Integer
  • $dateTime String a date and time string in format 'Y-m-d H:i:s'
  • $unitIds
  • $count Integer

Returns Array.

Returns list of available unit ids for specified date and service from provided $unitIds list.You can use this method with location Custom Feature. Returns empty array if all units are not allowed. Eg.: [1, 2, 3]



getAdditionalFields

getAdditionalFields($eventId)

Parameters:

  • $eventId Integer

Returns Array.

Return intake forms for certain event if Intake Forms Custom Feature is activated. Returns empty array otherwise. Call isPluginActivated('event_field') API method to check if 'event_field' Custom Feature activated.



getAnyUnitData

getAnyUnitData()

No arguments. Returns Object|null.

Returns information about Any Employee selector Custom Feature configuration. Returns null if Custom Feature 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
 }



getAvailableTimeIntervals

getAvailableTimeIntervals($dateFrom, $dateTo, $eventId, $unitId, $count)

Parameters:

  • $dateFrom String
  • $dateTo String
  • $eventId Integer
  • $unitId Mixed can be Integer or Array of Integers
  • $count Integer

Returns Object.

Returns available time intervals for all service providers for given period, taking into account breaktimes, start and end working time Eg.: {['2016-03-04': ['1': [['09:00:00','09:30:00'], ['11:15:00','14:45:00']] , ...], ...]}



getAvailableUnits

getAvailableUnits($eventId, $dateTime, $count)

Parameters:

  • $eventId Integer
  • $dateTime String a date and time string in format 'Y-m-d H:i:s'
  • $count Integer

Returns Array.

Returns list of available unit ids for specified date and service or empty array if all units are not allowed.Eg.: [1, 2, 3]



getBookingCancellationsInfo

getBookingCancellationsInfo($dateStart, $dateEnd)

Parameters:

  • $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 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. "type" field can be either "create", "cancel" or "nopayment_cancel". If "user_id" not specified then bookings where created or cancelled by admin or employee. Data with type "nopayment_cancel" 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

getBookingComment($id)

Parameters:

  • $id Integer

Returns String.

Returns booking comment



getBookingDetails

getBookingDetails($id)

Parameters:

  • $id integer booking id

Returns Array.

Returns detailed bookings object by booking id. See response example.



getBookingLimitUnavailableTimeInterval

getBookingLimitUnavailableTimeInterval($startDateTime, $endDateTime, $eventId)

Parameters:

  • $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'
  • $eventId integer

Returns Array.

Returns time intervals not available for bookings because of configuration of Limit bookings Custom Feature for period of time. Returns empty array if Custom Feature not available.



getBookingRevenue

getBookingRevenue($dateStart, $dateEnd, $unitGroupId, $serviceId)

Parameters:

  • $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.

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 $dateStart and $dateEnd to null to get data for current week.Example:

 ['2015-11-12' : {
    3 : [
      11, // bookings count
      128.53 // revenue
 ]}



getBookingStats

getBookingStats($groupBy)

Parameters:

  • $groupBy String either 'day', 'week' or 'month'

Returns Array.

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



getBookings

getBookings($params)

Parameters:

  • $params

Returns Array.

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 Approve booking Custom Feature 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 Custom Feature status.
    If Custom Feature 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 Custom Feature 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

getBookingsZapier()

No arguments. Returns Array.

Returns list of bookings filtered by given params



getCategoriesList

getCategoriesList($isPublic)

Parameters:

  • $isPublic Boolean

Returns Array.

Returns company categories list if Service Categories Custom Feature is activated. Returns an error with code -32001 if Custom Feature is not activated. Use isPluginActivated('event_category') API method to check if Custom Feature activated.



getClient

getClient($clientId)

Parameters:

  • $clientId

Returns Array.

Returns client's data object. See addClient API method for list of available fields of client data object.



getClientComments

getClientComments($clientId, $shedulerId)

Parameters:

  • $clientId Integer
  • $shedulerId Integer

Returns Array.

Returns list of all comments for given client



getClientList

getClientList($searchString, $limit)

Parameters:

  • $searchString String
  • $limit Integer

Returns Array.

Returns list of clients associated with company. You can use either phone number, email address or name as value for $searchString. Pass an empty string for $searchString and null for $limit parameters to get all records. See addClient API method for list of available fields of client data object.



getCompanyCurrency

getCompanyCurrency()

No arguments. Returns String.

Returns company's currency as three chars code (ISO 4217).



getCompanyInfo

getCompanyInfo()

No arguments. Returns Object.

Returns an object with detailed information about company. See example of response.



getCompanyParam

getCompanyParam($key)

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 list of available keys.



getCompanyParams

getCompanyParams($keys)

Parameters:

  • $keys Array

Returns Array.

Returns company config values for keys. 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 list of available keys.For non-existent and not-allowed params it will return false as result



getCompanyTimezoneOffset

getCompanyTimezoneOffset()

No arguments. Returns array.

Returns company timezone offset and company timezone



getCountryList

getCountryList()

No arguments. Returns Array.

Get list of all countries



getCountryPhoneCodes

getCountryPhoneCodes()

No arguments. Returns Array.

Returns country phone code list



getCurrentTariffInfo

getCurrentTariffInfo()

No arguments. Returns Array.

Returns all information about current tariff (subscription). For example:{

   "name" : "gold",
   "expire_date" : "2016-02-11 12:32:00",
   "rest" : 41, // number of days until subscription expiration
   "color" : "#fcb322"
 }



getCurrentUserDetails

getCurrentUserDetails()

No arguments. Returns Object.

Returns an object with information about logged in user. Note: you are responsible for implementation of some access rights based on group property value. Most of API methods returns an error if user has low access rights but not all. There are 4 roles:

  • Administrator - have full access to the system
  • Senior Employee - have access to calendar, services and providers, and can modify bookings related with user
  • Junior Employee - can access caledar (but only to own bookings), services associated with user
  • Viewer - have only access to calendar and services in read only mode


group property can be one of the values:

  • shop_user - "Senior Employee" access role
  • station_user - "Junior Employee" access role
  • admin - "Administrator" access role
  • viewer - "Viewer" access role
  • reseller_company_admin - reserved


Example:

 {
   "id": 1,
   "login": admin,
   "email": "admin@mycoolcompany.com";
   "firstname": "Michail",
   "lastname": " ",
   "phone": "",
   "group": "admin",
   "is_blocked": 0,
   "last_access_time": "2016-06-06 17:55:51",
   "unit_group_id": null
 }



getEventList

getEventList($isVisibleOnly, $asArray)

Parameters:

  • $isVisibleOnly Boolean
  • $asArray Boolean

Returns Array.

Returns company's events list. If $asArray 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.



getFeedbacks

getFeedbacks($approvedOnly, $reviewsOnly, $lastOnly, $limit)

Parameters:

  • $approvedOnly Boolean
  • $reviewsOnly Boolean
  • $lastOnly Boolean
  • $limit Integer

Returns Array.

Get list of feedbacks



getFirstWorkingDay

getFirstWorkingDay($unitId)

Parameters:

  • $unitId Integer

Returns String.

Returns first working date for unit



getGoogleCalendarBusyTime

getGoogleCalendarBusyTime($startDateTime, $endDateTime, $unitId)

Parameters:

  • $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 from and to properties with datetime string as value. This method only actual if [Custom_Features#Calendar_Sync|Calendar Sync Custom Feature] enabled. If Custom Feature not enabled an empty list will be returned. You should call isPluginActivated('google_calendar_export') to check status of the Custom Feature. Each object of result contains from and to properties with datetime string as value. Please note that this method may return not actual data because data synchronization between server and Google/Outlook Calendar may take some time and synchronized data are cached for 15 minutes.Example:

 [
  {"from" : "2016-02-16 13:30:00",
   "to" : "2016-02-16 16:00:00"},
   ...
 ]



getGoogleCalendarBusyTimeAvailableUnits

getGoogleCalendarBusyTimeAvailableUnits()

No arguments. Returns Array.

Returns configured unit ids, allowed to sync busy time



getLastNotificationUpdate

getLastNotificationUpdate($type)

Parameters:

  • $type String

Returns String.

Returns last update datetime



getLocationsList

getLocationsList($isPublic, $asArray)

Parameters:

  • $isPublic Boolean Optional. Default value is false.
  • $asArray boolean Optional. Default value is false.

Returns Array.

Returns available locations for company if Custom Feature Multiple locations Custom Feature is activated. Return an error with code -32001 if Custom Feature is not activated. Use isPluginActivated('location') API method to check if Custom Feature activated.

This method accepts two boolean flags as parameters. If isPublic flag is true then method returns only public locations. If asArray flag is true method returns list of objects. Otherwise method returns map of objects with object id as key. You can omit both parameters.


getPluginList

getPluginList()

No arguments. Returns Array.

Returns a list of all Custom Features associated with company with status.




getPluginStatuses

getPluginStatuses($pluginNames)

Parameters:

  • $pluginNames Array

Returns Array.

Return Custom Feature status true if status active, else false. See list of available plugin's names.



getRecentActions

getRecentActions($lastOnly, $limit)

Parameters:

  • $lastOnly Boolean
  • $limit Integer

Returns Array.

Returns latest actions



getRecurringDatetimes

getRecurringDatetimes($eventId, $unitId, $date, $time, $recurringData, $endDateTime)

Parameters:

  • $eventId Integer
  • $unitId Integer
  • $date String
  • $time String
  • $recurringData Array
  • $endDateTime String (optional)

Returns Array.

Get list of dates for recurring booking



getRecurringSettings

getRecurringSettings($eventId)

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:


getRegistrations

getRegistrations($groupBy)

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

getReservedTime($from, $to, $eventId, $unitId, $count)

Parameters:

  • $from String
  • $to String
  • $eventId Integer
  • $unitId Integer
  • $count Integer

Returns Object.

Returns map of objects for each day in specified date range. The key of the result mps is a date string. The value is an array of two objects. Both objects contains list of time slots for type reserved_time and type not_worked_time. reserved_time type represents time slots working time but already booked by clients. Nobody knows what kind of data represented by not_worked_time type. Please don't use it.If Calendar Sync Custom Feature enabled then object with reserved_time type will contain not empty list of time slots marked as busy in Google calendar. Call isPluginActivated('google_calendar_export') API method to check if Calendar Sync Custom Feature activated.


Example:

  {
    "2016-02-05": [
      {
        "dd": [], // time slots from Google calendar
        "events": [ // reserved time slots
          { "from": "16:00", "to": "16:30" },
          { "from": "16:30", "to": "17:00" },
          ... ],
        "type": "reserved_time",
      },
      {
        "events": [
          { "from": "09:00", "to": "09:30" },
          { "from": "09:30", "to": "10:00" },
          ... ],
        "type": "not_worked_time"
     }],
     ...
  }



getReservedTimeIntervals

getReservedTimeIntervals($dateFrom, $dateTo, $eventId, $unitId, $count)

Parameters:

  • $dateFrom String
  • $dateTo String
  • $eventId Integer
  • $unitId Integer|Array
  • $count Integer

Returns Object.

Returns not available time Eg.: {'2014-05-14': [{'reserved_time': [{'from': '14:00', 'to': '16:30'}], 'type': "reserved_time"}, ...], ...}



getSocialCounterStats

getSocialCounterStats($provider)

Parameters:

  • $provider String

Returns Integer.

Returns social counters value for your domain



getStartTimeMatrix

getStartTimeMatrix($from, $to, $eventId, $unitId, $count)

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.: {'2014-05-14': ['09:00:00', ...], ...}

If locations Custom Feature activated for company you should pass a list as $unitID parameter for filter results with units available only for selected location. See Multiple locations Custom Feature description for more details.



getStatuses

getStatuses()

No arguments. Returns Array.

Returns list of available statuses or an empty list if Status Custom feature not enabled.



getTimeframe

getTimeframe()

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 here.



getTimelineType

getTimelineType()

No arguments. Returns String.

Returns company calendar layout type



getTopPerformers

getTopPerformers()

No arguments. Returns Array.

Returns a list with statistics for performers. This data contains number of bookings and revenues value for each performer.



getTopServices

getTopServices($dateStart, $dateEnd)

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

getUnitList($isVisibleOnly, $asArray)

Parameters:

  • $isVisibleOnly Boolean
  • $asArray Boolean

Returns Array.

Returns list of service performers. If $asArray 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

getUnitWorkdayInfo($dateStart, $dateEnd, $unitGroupId)

Parameters:

  • $dateStart string
  • $dateEnd string
  • $unitGroupId integer

Returns Array.

Return workday info (date_start and date_end)



getUnitWorkingDurations

getUnitWorkingDurations($dateStart, $dateEnd, $unitGroupId)

Parameters:

  • $dateStart string
  • $dateEnd string
  • $unitGroupId integer

Returns Array.

Return working durations



getVisitorStats

getVisitorStats($groupBy)

Parameters:

  • $groupBy String

Returns Array.

Returns statistics about page visits if Custom Feature Visitor Counter Custom Feature enabled. Returns an empty list if Custom Feature not enabled. Use isPluginActivated('counter') API method call to check if Custom Feature 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



getWarnings

getWarnings($lastOnly)

Parameters:

  • $lastOnly Boolean. Default value is false.

Returns Array.

Returns a list of objects represented system warnings. Each warning contains warning_type and warning_text properties. warning_text property contains localized message. warning_type can be one of the values:

  • sms_limit – warning indicates low amount of SMS credits
  • sheduler_limit – warning indicates low amount of available bookings

getWorkCalendar

getWorkCalendar($year, $month, $unitId)

Parameters:

  • $year Integer
  • $month Integer
  • $unitId Integer

Returns Object.

Returns company work schedule as array Eg.: {'2014-05-01': {'from': '09:00:00', 'to': '21:00:00', 'is_day_off': '0'}, '2014-05-02': ...}



getWorkDaysInfo

getWorkDaysInfo($from, $to, $unitId, $eventId, $count)

Parameters:

  • $from String
  • $to String
  • $unitId Integer (optional)
  • $eventId Integer (optional)
  • $count Integer (optional)

Returns Object.

Returns an information about working hours and break times for specified service and performer for a period between two dates. If only service specified then information about performer (or performers) will be taken from service configuration. Method returns a list of objects for each date in specified period. Count of objects in list depends on break times. For example if performer works from 9:00 till 19:00 with one hour break at 13:00 method

returns:

  {'2014-05-14' : [
    {'from': '09:00:00', 'to': '13:00:00'},
    {'from': '14:00:00', 'to': '19:00:00'}
  ] }

Warning! Method can return a time string '24:00:00' as right edge of time range. This happens in case if time range finishes on midnight.



getWorkDaysTimes

getWorkDaysTimes($startDateTime, $endDateTime, $type = 'unit_group')

Parameters:

  • $startDateTime string
  • $endDateTime string
  • $type string. Optional. Either 'unit_group' or 'event'.

Returns Array.

Return busy time by unit id by Calendar Sync Custom Feature if enabled. Please note that this method may return not actual data because data synchronization between server and Google/Outlook Calendar may take some time and synchronized data are cached for 15 minutes.


getWorkload

getWorkload($dateStart, $dateEnd, $unitGroupId)

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' : {
    5 : [
      10, // working hours
      10, // load hours (confirmed bookings hours)
      0   // cancelled bookings hours
 ] }]



isPluginActivated

isPluginActivated($pluginName)

Parameters:

  • $pluginName String

Returns Boolean.

Return Custom Feature status true if status active, else false. $pluginName parameter is a Custom Feature identifier.See Custom Features page for full Custom Features description. See list of available plugin's names.



pluginApproveBookingApprove

pluginApproveBookingApprove($id)

Parameters:

  • $id Integer

Returns Array.

Sets approve booking status to 'approved' if Approve booking Custom Feature enabled and returns list of approved booking IDs. Returns false if Custom Feature not enabled. Use isPluginActivated('approve_booking') API method call to check if Custom Feature enabled.



pluginApproveBookingCancel

pluginApproveBookingCancel($id)

Parameters:

  • $id Integer

Returns Boolean.

Sets approve booking status to 'canceled' if Approve bookings Custom Feature enabled and returns true. Returns false if Custom Feature not enabled. Use isPluginActivated('approve_booking') API method call to check if Custom Feature enabled.



pluginApproveGetPendingBookings

pluginApproveGetPendingBookings()

No arguments. Returns array.

Returns list of objects with information about bookings pending approval if Approve bookings Custom Feature enabled. Returns empty list if Custom Feature not enabled. Use isPluginActivated('approve_booking') API method call to check if Custom Feature enabled.



pluginApproveGetPendingBookingsCount

pluginApproveGetPendingBookingsCount()

No arguments. Returns Integer.

Returns count of bookings pending approval if Approve bookings Custom Feature enabled. Returns 0 if Custom Feature not enabled. Use isPluginActivated('approve_booking') API method call to check if Custom Feature enabled.



setBookingComment

setBookingComment($id, $comment)

Parameters:

  • $id Integer
  • $comment String

Returns Integer.

Set booking comment



getBookingStatus

getBookingStatus ($bookingId)

Parameters:

  • $bookingId Integer

Returns Array.

Returns an object of status of given booking (if status plugin is enabled) default status will be returned if bookingId does not exists


setStatus

setStatus($bookingId, $statusId)

Parameters:

  • $bookingId Integer
  • $statusId Integer

Returns Boolean.

Sets specified status for booking. Returns an error with code -32020 if logged in user don't have access to edit bookings. This method does nothing if Status Custom feature not enabled.



updateNotification

updateNotification($type)

Parameters:

  • $type String

Returns .

Mark notifications as readed



setWorkDayInfo

setWorkDayInfo($info)

Parameters:

  • $info Array

Returns true on success

Set work day schedule for company|service|provider for week_day|date

Example:

{
"start_time":"10:00",
"end_time":"18:00",
"is_day_off":0,
"breaktime":[{"start_time":"14:00","end_time":"15:00"}],
"index":"1",
"name":"Monday",
"date":"",
"unit_group_id":"",
"event_id":""
}

index is 1-7 for Monday - Sunday (used for weekly settings)
date is used to set worktime for special date
unit_group_id is provider id
event_id is service id
if unit_group_id and event_id not passed then it set data for company

deleteSpecialDay

deleteSpecialDay($date, $params = null)

Parameters:

  • $date String
  • $params Array

Returns true on success

Delete special date if set

Example:

'2017-08-21', 
{
    "unit_group_id":"",
    "event_id":""
}

addServiceProvider

addServiceProvider($data)

Parameters:

  • $data Array

Returns Array with result and id of new service provider (unit_group)

Create new service provider

Example:

{
"name" : "newtagg1 - 4",
"description" : "Description - 1",
"phone" : "1234567890",
"email" : "test@test.com",
"qty" : "2",
"is_visible" : 1,
"is_active" : 1,
"position" : 2,
"seo_url" : null,
"position_in_location" : null,
}

editServiceProvider

editServiceProvider($id, $data)

Parameters:

  • $id Integer
  • $data Array

Returns Array with result and id of new service provider (unit_group)

Edit service provider (there is no way to delete provider via API, in this case set is_active = 0)


Example:

1, 
{
"name" : "newtagg1 - 4",
"description" : "Description - 1",
"phone" : "1234567890",
"email" : "test@test.com",
"qty" : "2",
"is_visible" : 1,
"is_active" : 1,
"position" : 2,
"seo_url" : null,
"position_in_location" : null,
}

Constants

Error codes

See Errors handling for details.

  • -32001 Custom Feature is not activated
  • -32010 Some required params are missed
  • -32011 Params is not array
  • -32012 Sheduler id not found
  • -32015 Passed event id is not reccuren
  • -32020 Sorry, you have no permissions to perform this action
  • -32030 Invalid promotion code
  • -32031 Promotion has expired
  • -32032 Promotion is not active yet
  • -32033 This promocode is not valid for selected service
  • -32034 Exceed max usage limit
  • -32035 Exceed max usage per customer limit'const
  • -32036 This promocode is not available for datetime range
  • -32051 Selected event id is not available
  • -32052 Selected unit id is not available
  • -32053 Selected date start is not available
  • -32054 Selected time start is not available
  • -32055 One or more appointments couldn't be reserved
  • -32056 Booking is not allowed at this time
  • -32061 Client name value is wrong
  • -32062 Client email value is wrong
  • -32063 Client phone value is wrong
  • -32070 Intake form values are wrong
  • -32080 Appointemnt couldn't be found
  • -32081 Service can't be performed when company does not work
  • -32082 Service performer can't work when company does not work
  • -32085 Signature error
  • -32090 Confirmation with this key type is not available
  • -32095 Batch not found
  • -32097 Unsupported payment system
  • -32099 Payment failed
  • -32600
    An error with this code can be thrown with one of the following messages:
    • Access denied
    • Company does not exists
  • -32601 Method not found
  • -32602 Invalid params
  • -32603 Internal error
  • -3264 Client with given id not found

Company params

Use these values to get configuration params for company with getCompanyParam API method.

General params

Administration API inherits all keys allowed for public API and extends this list with keys:

  • attach_ical
  • auto_redirect
  • auto_redirect_text
  • blockchain_address
  • blockchain_secret
  • borgun_merchant_id
  • borgun_payment_gateway_id
  • borgun_secret_code
  • client_batch_cancel_template
  • client_batch_cancel_template_email
  • client_batch_cancel_template_email_subject
  • client_event_cancel_template
  • client_event_cancel_template_email
  • client_event_cancel_template_email_subject
  • client_event_change_template
  • client_event_change_template_email
  • client_event_change_template_email_subject
  • client_event_creation_template
  • client_event_creation_template_email
  • client_event_creation_template_email_subject
  • client_event_group_creation_template
  • client_event_group_creation_template_email
  • client_event_group_creation_template_email_subject
  • client_event_multiple_creation_template
  • client_event_multiple_creation_template_email
  • client_event_multiple_creation_template_email_subject
  • client_group_notification_template
  • client_group_notification_template_email
  • client_group_notification_template_email_subject
  • client_multiple_notification_template
  • client_multiple_notification_template_email
  • client_multiple_notification_template_email_subject
  • client_notification_template
  • client_notification_template_email
  • client_notification_template_email_subject
  • client_notification_time
  • client_recurring_event_creation_template
  • client_recurring_event_creation_template_email
  • client_recurring_event_creation_template_email_subject
  • common_limit_booking
  • company_ga_tracking_id
  • default_phone
  • disconnect_on_timeout
  • email_event_list
  • email_events_list_template
  • email_group_events_list_template
  • event_list_style
  • feed_back_interval
  • feedback_invite_template_email
  • feedback_invite_template_email_subject
  • google_conversion_color
  • google_conversion_currency
  • google_conversion_format
  • google_conversion_id
  • google_conversion_label
  • google_conversion_language
  • google_conversion_value
  • hide_working_hours_block
  • include_cancel_link
  • kortais_merchant
  • kortais_secret_code
  • kortais_terminal
  • layout_background
  • layout_background_repeat
  • mobile_site_link
  • mobile_site_link_title
  • no_show_period
  • on_success_button_link
  • on_success_button_text
  • recap_interval
  • recap_send_after_time
  • recap_send_canceled_bookings
  • recap_send_new_bookings
  • recap_send_upcomming_bookings
  • send_cancel_to_client
  • send_cancel_to_client_email
  • send_cancel_to_unit
  • send_cancel_to_unit_email
  • send_contact_widget_email_notification
  • send_contact_widget_sms_notification
  • send_notify_to_client
  • send_notify_to_client_email
  • send_notify_to_unit
  • send_notify_to_unit_email
  • send_onchange_to_client
  • send_onchange_to_client_email
  • send_onchange_to_unit
  • send_onchange_to_unit_email
  • send_oncreate_to_client
  • send_oncreate_to_client_email
  • send_oncreate_to_unit
  • send_oncreate_to_unit_email
  • send_sms_if_push_enabled
  • site_link
  • site_link_title
  • skip_limits_for_admin
  • skip_show_mobile_app_ads
  • skip_show_on_success_button
  • sms_event_list
  • sms_events_list_template
  • sms_group_events_list_template
  • unit_batch_cancel_template
  • unit_batch_cancel_template_email
  • unit_batch_cancel_template_email_subject
  • unit_event_cancel_template
  • unit_event_cancel_template_email
  • unit_event_cancel_template_email_subject
  • unit_event_change_template
  • unit_event_change_template_email
  • unit_event_change_template_email_subject
  • unit_event_creation_template
  • unit_event_creation_template_email
  • unit_event_creation_template_email_subject
  • unit_event_group_creation_template
  • unit_event_group_creation_template_email
  • unit_event_group_creation_template_email_subject
  • unit_group_notification_template
  • unit_group_notification_template_email
  • unit_group_notification_template_email_subject
  • unit_notification_template
  • unit_notification_template_email
  • unit_notification_template_email_subject
  • unit_notification_time
  • unit_recurring_event_creation_template
  • unit_recurring_event_creation_template_email
  • unit_recurring_event_creation_template_email_subject
  • use_common_client_db
  • user_confirmation
  • user_public_layout
  • user_public_theme
  • waiting_video
Accept payments Custom Feature params

Read more about Accept Payments Custom Feature configuration.

  • allow_delay_payment
    Allow delay payment option. Boolean.
  • company_currency
  • hide_sale_tax
    Hide sales tax option. Boolean.
  • payment_timeout
    Payment timeout option. String ("5 minutes", "1 hour", ...)
  • sale_tax
    Sales tax option. Integer. You should divide by 100 to get percent value.
  • paypal_account
    PayPal payment processor configuration. String.
  • skrill_account
    Skrill payment processor configuration parameter. String.
  • skrill_secret
    Skrill payment processor configuration parameter. String.
  • zooz_app_id
    ZooZ payment processor configuration parameter. String.
  • zooz_app_key
    ZooZ payment processor configuration parameter. String.
  • dwolla_application_key
    Dwolla payment processor configuration parameter. String.
  • dwolla_id
    Dwolla payment processor configuration parameter. String.
  • dwolla_secret_key
    Dwolla payment processor configuration parameter. String.
  • liqpay_merchant_id
  • liqpay_merchant_pass
Term & Conditions Custom Feature params

Read more about Terms and Conditions Custom Feature.

  • user_license_text
    Terms and conditions text. String.

Custom Features' identifiers

Custom Feature identifier is a string constant which represents a Custom Feature in system. These constants used in isPluginActivated and getPluginStatuses API methods.

  • advanced_notification
    Book Soon notification system
  • any_unit
    Any Employee selector
  • api
    API
  • approve_booking
    Approve booking
  • back_to_site
    Take me back home
  • contact_widget
    Contact widget
  • counter
    Visitor Counter
  • custom_css
    Custom CSS
  • data_security
    Clean history
  • description
    HTML description field for events
  • event_category
    Service categories
  • event_field
    Intake forms
  • facebookImage
    Facebook client info
  • financial_dashboard
    Insights
  • google_analytics
    Google Adwords and analytics
  • google_calendar_export
    Calendar sync
  • group_booking
    Group bookings
  • hipaa
    HIPAA
  • limit_bookings
    Limit bookings
  • location
    Multiple locations
  • mobile_app_backend
    Mobile application
  • multiple_booking
    Multiple bookings
  • news
    News
  • paid_events
    Accept payments
  • recap
    Daily report
  • secure
    SSL
  • status
    Status
  • unit_colors
    Providers color coding
  • user_license
    Terms and conditions
  • cancelation_policy
    Cancellation Policy

See Custom Features page for description for each Custom Feature.


Examples

getBookingDetails response

An example of data returned by 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
 }

Location field is present in response only if Multiple locations Custom Feature is enabled. Otherwise this field will be an empty array. If locations Custom Feature is enabled but booking doesn't have any locations this fields also will be an empty array.

Status field is present in response only if Status Custom Feature is enabled. Otherwise this field will be an empty array. If Custom Feature enabled but booking doesn't have any statues specified the default status returned.

Price field is present in response only if Accept payments Custom Feature is enabled. Otherwise this field will be an empty array. This field contains an empty array if Custom Feature is enabled but booking was created for a free service.

additional_fields field is present in response only if Intake Forms Custom Feature is enabled. Otherwise this field will be an empty array. This field contains an empty array if Custom Feature is enabled but booking was created for a service with no intake forms.


book response

book API method returns an object which contains list of objects with short description of newly create bookings. Method returns only one item in 'bookings' array for regular appointment and more than one item for recurring or batch bookings.

 {
   "require_confirm":false,
   "bookings":[
     {
       "id":"434",
       "event_id":"7",
       "unit_id":"3",
       "client_id":"34",
       "start_date_time":"2015-12-30 13:00:00",
       "end_date_time":"2015-12-30 13:30:00",
       "is_confirmed":"1",
       "code":"h8vc14ca",
       "hash":"785cb8cce316e64765b94c05a635f4be"
     },
     {
       "id":"435",
       "event_id":"7",
       "unit_id":"3",
       "client_id":"34",
       "start_date_time":"2015-12-31 13:00:00",
       "end_date_time":"2015-12-31 13:30:00",
       "is_confirmed":"1",
       "code":"h8vc2pge",
       "hash":"8b92d634541bfd93c0830967e56f4653"
     },
     {
       "id":"436",
       "event_id":"7",
       "unit_id":"3",
       "client_id":"34",
       "start_date_time":"2016-01-04 13:00:00",
       "end_date_time":"2016-01-04 13:30:00",
       "is_confirmed":"1",
       "code":"h8vc3urb",
       "hash":"cd22a0bf183f7350e595988dd2486e5b"
     },
     {
       "id":"437",
       "event_id":"7",
       "unit_id":"3",
       "client_id":"34",
       "start_date_time":"2016-01-05 13:00:00",
       "end_date_time":"2016-01-05 13:30:00",
       "is_confirmed":"1",
       "code":"h8vc44d9",
       "hash":"53f98ff4e4a0323aa907156c59c99362"
     }
   ],
   "batch_type":"batch_recurrent_booking",
   "recurrent_batch_id":"1",
   "batch_hash":"357178bce290381bb7235080941ec143"
 }

getCompanyInfo response

An example of data returned by getCompanyInfo API method.

 {
   "login": "pierrecoetzee",
   "name": "Pierre",
   "description": "Write a description about your company or about you as a service provider. You can add other service providers inside the system and each can have his own description.",
   "address1": "",
   "address2": "Storey's Gate, ",
   "city": "London",
   "country_id": "GB",
   "lat": "51.500435",
   "lng": "-0.129811",
   "email": "pierre.coe@gmail.com",
   "phone": "",
   "web": null,
   "skip_address": null,
   "logo": null,
   "address": "GB, London, Storey's Gate, ",
   "description_text": "Write a description about your company or about you as a service provider. You can add other service providers inside the system and each can have his own description.",
   "timezone": "Europe London",
   "show_in_client_timezone": false,
   "timeframe": "60",
   "timeline_type": "modern_week",
   "allow_event_day_break": "0",
   "allow_event_breaktime_break": "0"
 }

timeline_type field can be one the following values:

  • flexible
  • modern
  • flexible_week
  • modern_week
  • classic
  • classes


Please note that classic timeline type is deprecated and not supported anymore.

description field contains raw data of company's description which can include HTML tags. description_text field contains only text information without HTML tags.

For information about timeframe, timezone, allow_event_day_break and allow_event_breaktime_break see Company params section.