Difference between revisions of "Company public service methods"

From SimplyBook.me
 
(20 intermediate revisions by the same user not shown)
Line 84: Line 84:
 
===Authentication===
 
===Authentication===
  
Using Simplybook API methods require an authentification. To authorize in Simplybook API you need to get an access key — access-token. In order to get this access-token you should call the JSON-RPC method <code>[[Authentication#getToken|getToken]]</code> API method on https://user-api.simplybook.me/login service passing your personal API-key. You can copy your API-key at admin interface: go to the 'Plugins' link and select [[Plugins#API|API plugin]] 'Settings'.  
+
Using Simplybook API methods require an authentification. To authorize in Simplybook API you need to get an access key — access-token. In order to get this access-token you should call the JSON-RPC method <code>[[Authentication#getToken|getToken]]</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 ==
Line 115: Line 115:
 
later in time than <code>$startDate</code> and <code>$startTime</code>. If your clients located in different time
 
later in time than <code>$startDate</code> and <code>$startTime</code>. If your clients located in different time
 
zone you should specify <code>'client_time_offset'</code> value in <code>$clientData</code> object as difference
 
zone you should specify <code>'client_time_offset'</code> value in <code>$clientData</code> object as difference
between company's time zone and client's time zone in seconds. For example if company located in city with time
+
between client's time zone and company's time zone in minutes. For example if company located in city with time
zone GMT+2 and customer located in city with GMT+3 then <code>$clientTimeOffset</code> will be -3600 seconds. You
+
zone GMT+2 and customer located in city with GMT+3 then <code>$clientTimeOffset</code> will be 60 minutes. You
 
can get information about company's time zone using <code>[[#getCompanyInfo|getCompanyInfo]]</code> API method. To
 
can get information about company's 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
 
create batch booking you can 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
 
parameter can be specified). You should specify an <code>$additionalFields</code> parameter if service requires
some additional fields (see [[Plugins#Additional fields|Additional fields plugin]]). To create a booking with promo code you
+
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>{"name": "promocode", "value": "some code", "type": "text"}</code>See [[#book response|example]] of <code>book</code> API method response.
 
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.
  
 
See also:
 
See also:
  
* [http://wiki.simplybook.me/index.php/Settings#Timeframe Timeframe information]
+
* [https://help.simplybook.me/index.php/Need_to_change_interval_(timeframe) Timeframe information]
  
 
----
 
----
Line 236: Line 236:
 
----
 
----
  
=== confirmBookingPayment ===
+
=== confirmBookingPayment !Deprecated!===
  
 
<code>confirmBookingPayment($id, $paymentProcessor, $sign)</code>
 
<code>confirmBookingPayment($id, $paymentProcessor, $sign)</code>
Line 280: Line 280:
 
Returns Array.
 
Returns Array.
  
Returns list of available unit ids for specified date and service from provided $unitIds list.You can use this method with location plugin.
+
Returns list of available unit ids for specified date and service from provided $unitIds list.You can use this method with locations Custom feature.
 
Returns empty array if all units are not allowed.
 
Returns empty array if all units are not allowed.
 
Eg.: <code>[1, 2, 3]</code>
 
Eg.: <code>[1, 2, 3]</code>
Line 297: Line 297:
 
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 311: Line 311:
 
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 437: Line 437:
 
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 483: Line 483:
 
Returns Array.
 
Returns Array.
  
Returns company config values for keys. A different set of keys available for public API and for company
+
Returns company's config values for specified keys as key-value map. For non-existent and not-allowed param keys
administration API. Method return 'invalid params' error (code -32602) in case if access to specified key not
+
it will return '''false''' as result. A different set of keys available for public API and for company
allowed. See [[#Company_params|list of available keys]].For non-existent and not-allowed params it will return false as result
+
administration API. See [[#Company_params|list of available keys]].
 
 
  
 
----
 
----
Line 558: Line 557:
 
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
 
This method accepts two boolean flags as parameters. If '''isPublic''' flag is '''true''' then method returns only
Line 583: Line 582:
 
----
 
----
  
=== getPluginPromoInfoByCode ===
+
<!----=== getPluginPromoInfoByCode ===
  
 
<code>getPluginPromoInfoByCode($code)</code>
 
<code>getPluginPromoInfoByCode($code)</code>
Line 593: Line 592:
 
Returns Array.
 
Returns Array.
  
Returns an object with detailed information about promotion by promotion code. You can get promotion code
+
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
 
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 [[Plugins#Simply Smart Promotions|Simply Smart Promotions plugin]]
+
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 (Plugin is not activated). Use
+
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 plugin enabled.See [[#getPromotionList response|example]] of <code>getPromotionList</code> API method response. Please note that
+
<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).
+
response contains a list of services for wich promotion discount can be applied (<code>service_ids</code> key).-->
  
  
Line 613: Line 612:
 
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_public_service_methods#Custom_Features.27_identifiers|list of available Custom Feature's names]].
  
  
Line 634: Line 633:
 
----
 
----
  
=== getPromotionRewardInfo ===
+
<!---=== getPromotionRewardInfo ===
  
 
<code>getPromotionRewardInfo($commonPromotionId, $clientId, $hash)</code>
 
<code>getPromotionRewardInfo($commonPromotionId, $clientId, $hash)</code>
Line 648: Line 647:
 
Returns promotion reward by common promotion id, client id and hash.
 
Returns promotion reward by common promotion id, client id and hash.
  
 
+
-->
 
----
 
----
  
Line 687: Line 686:
 
is an array of two objects. Both objects contains list of time slots for type <code>reserved_time</code> and type
 
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
 
<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 [[Plugins#Google calendar sync plugin|Google calendar sync plugin]] enabled then object with
+
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]] is 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>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 Google
+
<code>[[#isPluginActivated|isPluginActivated('google_calendar_export')]]</code> API method to check if Calendar Sync Custom Feature activated.
calendar sync plugin activated.
 
  
  
Line 756: Line 754:
 
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 770: Line 768:
 
Returns Integer.
 
Returns Integer.
  
Returns company's timeframe configuration (in minutes). Timeframe can be either 5, 10, 15, 20, 30 or 60 minutes.You can find more details about timeframe [[Settings#Timeframe|here]].
+
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]].
  
  
Line 782: Line 780:
 
Returns String.
 
Returns String.
  
Returns company timeline type
+
Returns company calendar layout type
  
  
Line 812: Line 810:
 
Returns String.
 
Returns String.
  
Returns user license text if user license plugin is turned on,
+
Returns user license text if user license Custom Feature is turned on,
 
otherwise throws exception
 
otherwise throws exception
  
Line 891: Line 889:
 
Returns Boolean.
 
Returns Boolean.
  
Return true if event payments plugin is turned on and prices were set,
+
Returns true if [[Custom_Features#Accept_Payments|Accept Payments]] Custom Feature activated and event with specified id has
else return false.
+
configured price. If no parameters specified then method returns true if payments Custom Feature activated and at least
 
+
one event has configured price. Otherwise returns false.
  
 
----
 
----
Line 907: Line 905:
 
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_public_service_methods#Custom_Features.27_identifiers|list of available Custom Features' names]].
  
  
Line 953: Line 951:
 
See [[Errors handling]] for details.
 
See [[Errors handling]] for details.
  
* -32001 Plugin is not activated
+
* -32001 Custom Feature is not activated
 
* -32010 Some required params are missed
 
* -32010 Some required params are missed
 
* -32011 Params is not array
 
* -32011 Params is not array
Line 975: Line 973:
 
* -32062 Client email value is wrong
 
* -32062 Client email value is wrong
 
* -32063 Client phone value is wrong
 
* -32063 Client phone value is wrong
* -32070 Additional field values are wrong
+
* -32070 Intake forms values are wrong
 
* -32080 Appointemnt couldn't be found
 
* -32080 Appointemnt couldn't be found
 
* -32085 Signature error
 
* -32085 Signature error
Line 992: Line 990:
  
 
----
 
----
 +
 +
===Company params===
  
 
Use these values to get configuration params for company with <code>[[#getCompanyParam|getCompanyParam]]</code> API method.
 
Use these values to get configuration params for company with <code>[[#getCompanyParam|getCompanyParam]]</code> API method.
 +
 +
=====General params=====
  
 
* allow_event_breaktime_break
 
* allow_event_breaktime_break
Line 1,004: Line 1,006:
 
* fixed_country_prefix
 
* fixed_country_prefix
 
* max_group_bookings
 
* max_group_bookings
*: [[Plugins#Group bookings|Group Booking plugin]] configuration. Integer.  
+
*: [[Custom_Features#Group_Bookings|Group Bookings Custom Feature]] configuration. Integer.  
 
* max_time_till_event
 
* max_time_till_event
 
* min_time_till_event
 
* min_time_till_event
Line 1,018: Line 1,020:
 
* time_format
 
* time_format
 
* timeframe
 
* 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 [[Settings#Timeframe|here]]
+
*: 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]]
 
* user_public_timeline_type
 
* user_public_timeline_type
 
*: String. Can be one of the following values:
 
*: String. Can be one of the following values:
Line 1,029: Line 1,031:
 
*: Please note that <code>classic</code> timeline type is deprecated and not supported anymore.
 
*: Please note that <code>classic</code> timeline type is deprecated and not supported anymore.
  
=====Accept payments plugin params=====
+
=====Accept Payments Custom Feature params=====
  
Read more about [[Plugins#Accept payments|Accept payments plugin configuration]].
+
Read more about [[Custom_Features#Accept_Payments|Accept Payments Custom Feature configuration]].
  
 
* allow_delay_payment
 
* allow_delay_payment
Line 1,042: Line 1,044:
 
*: Sales tax option. Integer. You should divide by 100 to get percent value.
 
*: Sales tax option. Integer. You should divide by 100 to get percent value.
  
=====Cancellation Policy plugin params=====
+
=====Cancellation Policy Custom Feature params=====
  
Read more about [[Plugins#Cancellation Policy|Cancellation policy plugin configuration]].
+
Read more about [[Custom_Features#Cancellation_Policy|Cancellation Policy Custom Feature configuration]].
  
 
* cancelation_policy_text
 
* cancelation_policy_text
Line 1,055: Line 1,057:
 
----
 
----
  
====Plugin's identifiers====
+
====Custom Features' identifiers====
  
Plugin identifier is a string constant which represents a plugin in system. These constants used in <code>[[#isPluginActivated|isPluginActivated]]</code> and <code>[[#getPluginStatuses|getPluginStatuses]]</code> API methods.
+
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.
  
 
* advanced_notification
 
* advanced_notification
*:Book Soon notification system plugin
+
*:Book Soon notification system
 
* any_unit
 
* any_unit
*:Any Employee selector plugin
+
*:Any Employee selector
 
* api
 
* api
*:API plugin
+
*:API  
 
* approve_booking
 
* approve_booking
*:Approve booking plugin
+
*:Approve booking
 
* back_to_site
 
* back_to_site
*:Take me back home plugin
+
*:Take me back home
 
* contact_widget
 
* contact_widget
*:Contact widget plugin
+
*:Contact widget
 
* counter
 
* counter
*:Visitor Counter plugin
+
*:Visitor Counter
 
* custom_css
 
* custom_css
*:Custom CSS plugin
+
*:Custom CSS
 
* data_security
 
* data_security
*:Clean history plugin
+
*:Clean history
 
* description
 
* description
 
*:HTML description field for events
 
*:HTML description field for events
 
* event_category
 
* event_category
*:Service categories plugin
+
*:Service categories
 
* event_field
 
* event_field
*:Additional fields plugin
+
*:Intake forms
 
* facebookImage
 
* facebookImage
*:Facebook client info plugin
+
*:Facebook client info
 
* financial_dashboard
 
* financial_dashboard
*:Insights plugin
+
*:Insights
 
* google_analytics
 
* google_analytics
*:Google Adwords and analytics plugin
+
*:Google Adwords and analytics
 
* google_calendar_export
 
* google_calendar_export
*:Google calendar sync plugin
+
*:Calendar sync
 
* group_booking
 
* group_booking
*:Group bookings plugin
+
*:Group bookings
 
* hipaa
 
* hipaa
*:HIPAA plugin
+
*:HIPAA  
 
* limit_bookings
 
* limit_bookings
*:Limit bookings plugin
+
*:Limit bookings
 
* location
 
* location
*:Unit location plugin
+
*:Multiple locations
 
* mobile_app_backend
 
* mobile_app_backend
*:Mobile application plugin
+
*:Mobile application  
 
* multiple_booking
 
* multiple_booking
*:Multiple bookings plugin
+
*:Multiple bookings  
 
* news
 
* news
*:News plugin
+
*:News  
 
* paid_events
 
* paid_events
*:Accept payments plugin
+
*:Accept payments  
* promo
+
<!--* promo
*:Simply Smart Promotions plugin
+
*:Rewards and Referrals-->
 
* recap
 
* recap
*:Daily report plugin
+
*:Daily report  
 
* secure
 
* secure
*:SSL plugin
+
*:SSL  
 
* status
 
* status
*:Status plugin
+
*:Status  
 
* unit_colors
 
* unit_colors
*:Providers color coding plugin
+
*:Providers color coding  
 
* user_license
 
* user_license
*:Terms and conditions plugin
+
*:Terms and conditions  
 
* cancelation_policy
 
* cancelation_policy
 
*:Cancellation Policy
 
*:Cancellation Policy
  
See [[Plugins]] page for description for each plugin.
+
See [[Custom_Features|Custom Features]] page for description for each .
  
 
----
 
----
Line 1,234: Line 1,236:
 
----
 
----
  
====getPluginPromoInfoByCode response====
+
<!----====getPluginPromoInfoByCode response====
  
 
   {
 
   {
Line 1,261: Line 1,263:
 
   }
 
   }
  
<code>service_ids</code> contains a list of services for wich promotion discount can be applied.
+
<code>service_ids</code> contains a list of services for wich promotion discount can be applied.-->
 
----
 
----
  

Latest revision as of 08:48, 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 two additional HTTP headers:

  • X-Company-Login
  • X-Token an authentication token. See authentication section.

Endpoint

Use URL https://user-api.simplybook.me/ for all public 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 getToken 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

book

book($eventId, $unitId, $date, $time, $clientData, $additional, $count, $batchId, $recurringData)

Parameters:

  • $eventId Integer
  • $unitId Integer
  • $date String - in Y-m-d format
  • $time String - in H:i:s format
  • $clientData Object - eg. {name: 'Name', email: 'test@gmail.com', phone: '+38099999999'}
  • $additional array|Object - additional params and fields.
  • $count Integer - bookings count, min. 1 (using for group bookings batch). (optional)
  • $batchId Integer - add booking to multiple bookings batch. (optional)
  • $recurringData Array - make booking recurrent. (optional)

Returns Object.

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 'client_time_offset' value in $clientData object as difference between client's time zone and company's time zone in minutes. For example if company located in city with time zone GMT+2 and customer located in city with GMT+3 then $clientTimeOffset will be 60 minutes. 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: {"name": "promocode", "value": "some code", "type": "text"}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



cancelBooking

cancelBooking($id, $sign)

Parameters:

  • $id Integer
  • $sign String

Returns Boolean.

Cancels a booking. $sign parameter must be a string created with formula: md5($bookingId . $bookingHash . $secretKey) . You can get $bookingHash value as result of book API method call. Method return an error with code -32080 (Appointment couldn't be found) if record with specified id not exists. Methods returns an error with code -32085 (Signature error) if $sign parameter is wrong.



confirmBooking

confirmBooking($id, $sign)

Parameters:

  • $id Integer
  • $sign String

Returns Boolean.

Confirm booking. Signature is required.$sign = md5($bookingId . $bookingHash . $secretKey); Call this method from server side only



confirmBookingBatch

confirmBookingBatch($batchId, $batchType, $sign)

Parameters:

  • $batchId Integer
  • $batchType String
  • $sign String

Returns Boolean.

Confirms booking batch. Signature is required.$sign = md5($batchId . $batchHash . $secret) Call this method from server side only



confirmBookingBatchPayment

confirmBookingBatchPayment($batchId, $batchType, $paymentProcessor, $sign)

Parameters:

  • $batchId Integer
  • $batchType String
  • $paymentProcessor
  • $sign String

Returns Boolean.

Confirms booking batch payment. Signature is required.$sign = md5($batchId . $batchHash . $secret) Call this method from server side only



confirmBookingCart

confirmBookingCart($cartId, $paymentProcessor, $sign)

Parameters:

  • $cartId Integer - cart id
  • $paymentProcessor String - payment processor name
  • $sign String - signature. (md5($cartId . $cartHash . $secretKey))

Returns Boolean.

Confirm booking cart. Use it to confirm payment. Signature is required.



confirmBookingPayment !Deprecated!

confirmBookingPayment($id, $paymentProcessor, $sign)

Parameters:

  • $id Integer
  • $paymentProcessor String
  • $sign String

Returns Boolean.

Confirm booking payment. Signature is required.$sign = md5($bookingId . $bookingHash . $secretKey); Call this method from server side only



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.



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 locations 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]



getBooking

getBooking($id, $sign)

Parameters:

  • $id Integer
  • $sign String

Returns Object.

Returns an object with details information about booking. $sign parameter must be a string created with formula: md5($bookingId . $bookingHash . $secretKey). You can get $bookingHash value as result of book API method call. Method return an error with code -32080 (Appointment couldn't be found) if record with specified id not exists. Methods returns an error with code -32085 (Signature error) if $sign parameter is wrong.



getBookingCart

getBookingCart($bookingIds)

Parameters:

  • $bookingIds Array

Returns Object.

Returns cart information by bookings ids.

  • cart_id and cart_hash is used to create secure signature to confirm cart payment.
  • amount - is total amount to payment
  • currency - cart currency
  • cart - contains cart items. You can use them to provide information for payment system. Each item is object with following fields:
  • id - booking id
  • event_id - service id
  • name - event name + start date time (use it to provide cart information for payment system)
  • price - booking price
  • qty - qty of bookings



getBookingDetails

getBookingDetails($id, $sign)

Parameters:

  • $id Integer
  • $sign String

Returns Object.

Returns an object with details information about booking. $sign parameter must be a string created with formula: md5($bookingId . $bookingHash . $secretKey). You can get $bookingHash value as result of book API method call. Method return an error with code -32080 (Appointment couldn't be found) if record with specified id not exists. Methods returns an error with code -32085 (Signature error) if $sign parameter is wrong.



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.



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's config values for specified keys as key-value map. For non-existent and not-allowed param keys it will return false as result. A different set of keys available for public API and for company administration API. See list of available keys.


getCompanyTimezoneOffset

getCompanyTimezoneOffset()

No arguments. Returns array.

Returns company timezone offset and company timezone



getCountryPhoneCodes

getCountryPhoneCodes()

No arguments. Returns Array.

Returns country phone code list



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.



getFirstWorkingDay

getFirstWorkingDay($unitId)

Parameters:

  • $unitId Integer

Returns String.

Returns first working date for unit



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.


getPaymentProcessorConfig

getPaymentProcessorConfig($paymentProcessor)

Parameters:

  • $paymentProcessor String

Returns Array.

Returns payment processor config





getPluginStatuses

getPluginStatuses($pluginNames)

Parameters:

  • $pluginNames Array

Returns Array.

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



getPromocodeInfo

getPromocodeInfo($code)

Parameters:

  • $code String

Returns Array|null.

Returns an object with detailed information about promotion by promotion code. Returns null if no promotions with specified code were not found.




getRecurringDatetimes

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

Parameters:

  • $eventId Integer
  • $unitId Integer
  • $date String
  • $time String
  • $recurringData Array

Returns Array.

Get list of dates for recurring booking



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 is 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"}, ...], ...}



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.



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



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.



getUserLicenseText

getUserLicenseText()

No arguments. Returns String.

Returns user license text if user license Custom Feature is turned on, otherwise throws exception



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.



hasUpcommingPromotions

hasUpcommingPromotions()

No arguments. Returns Boolean.

Returns availability of active promotions



isPaymentRequired

isPaymentRequired($eventId)

Parameters:

  • $eventId Integer

Returns Boolean.

Returns true if Accept Payments Custom Feature activated and event with specified id has configured price. If no parameters specified then method returns true if payments Custom Feature activated and at least one event has configured price. Otherwise returns false.


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 Custom Features' names.



validatePayment

validatePayment($paymentInfo, $cartId)

Parameters:

  • $paymentInfo mixed
  • $cartId Integer

Returns Boolean.

Validate application payment.



validatePromoCode

validatePromoCode($code, $startDateTime, $eventId, $count, $clientData)

Parameters:

  • $code String
  • $startDateTime String
  • $eventId Integer
  • $count Integer
  • $clientData array|Object

Returns Boolean.

Validate promotion code.Returns true in case promocode is valid otherwise throws exception with error.



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 forms values are wrong
  • -32080 Appointemnt couldn't be found
  • -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
  • allow_event_breaktime_break
    true if service can extend over breaktime
  • allow_event_day_break
    true if service can extend over closing hours
  • changable_prefix_by_client
  • company_timezone
  • date_format
  • fixed_country_prefix
  • max_group_bookings
    Group Bookings Custom Feature configuration. Integer.
  • max_time_till_event
  • min_time_till_event
  • monday_is_first_day
    true if monday specified as first day of the week in company's settings
  • require_fields
    Client's data fields required for booking. String. Possible values:
    • phone - phone number is required
    • email - email address is required
    • email_phone - phone number and email address are required
  • send_notifications_in_client_timezone
  • show_booking_page_in_client_timezone
  • time_format
  • 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 here
  • user_public_timeline_type
    String. Can be one of the following values:
    • flexible
    • modern
    • flexible_week
    • modern_week
    • classes
    • classic
    Please note that classic timeline type is deprecated and not supported anymore.
Accept Payments Custom Feature params

Read more about Accept Payments Custom Feature configuration.

  • allow_delay_payment
    Allow delay payment option. Boolean.
  • 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.
Cancellation Policy Custom Feature params

Read more about Cancellation Policy Custom Feature configuration.

  • cancelation_policy_text
    Full policy text. String.
  • cancelation_policy_label
    Short label for confirmation control. String.
  • cancelation_policy_period
    Time period value. String ("5 minutes", "1 hour", ...)

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 .


Examples

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.



getLocationsList response

 {
   "1": {
       "id": "1",
       "title": "location 1",
       "description": null,
       "picture": "e1e9409fe9682c78b2f8f294dc151af0.jpg",
       "address1": null,
       "address2": "Saint Margaret Street",
       "city": "London",
       "zip": null,
       "country_id": "GB",
       "lat": "51.50013000000000000000",
       "lng": "-0.12630500000000000000",
       "phone": "",
       "position": "1",
       "is_default": "1",
       "file_id": "4",
       "picture_sub_path": "\/image_files",
       "picture_path": "\/uploads\/mycompany\/image_files\/small\/e1e9409fe9682c78b2f8f294dc151af0.jpg",
       "units": ["1", "3", "4", "5"] 
   },
   ...
 }

position property of location object used for order list. units array contains list of performers ids associated with location.