Company public service methods: Difference between revisions

No edit summary
No edit summary
 
(2 intermediate revisions by one other user not shown)
Line 1: Line 1:
{{#seo:
|title=Company public service methods - SimplyBook.me
|description=Explore public-facing service methods to improve client access. Manage service visibility with ease. Learn more now!
|titlemode=append
|keywords=faq, frequently asked questions, booking software, appointment system questions, appointments online, calendar software, booking system, booking calendar, scheduling software, online appointment scheduling, online scheduling, setup, setup help, support, help content
}}
==General Information==
==General Information==


Line 30: Line 37:
         "1": {
         "1": {
             "id": "1",
             "id": "1",
             "name": "Часовая фотосесcия",
             "name": "Hourly photoshoot",
             "duration": "60",
             "duration": "60",
             "hide_duration": "0",
             "hide_duration": "0",
             "description": "<p>Если Вы хотите попробовать себя в роли модели, но не определились с образом. <br /> 5-7 отретушированных и готовых к печати фотографий + отснятый материал на диске</p>",
             "description": "<p>If you want to try yourself as a model but haven't decided on an image. <br /> 5-7 retouched and print-ready photos + the raw footage on a disc </p>",
             "picture": "a200edab10b669225e22d2b3803a38b5.jpg",
             "picture": "a200edab10b669225e22d2b3803a38b5.jpg",
             "is_public": "1",
             "is_public": "1",
Line 76: Line 83:


* <code>X-Company-Login</code>  
* <code>X-Company-Login</code>  
* <code>X-Token</code> an authentication token. See [[#Authentication|authentication]] section.
* <code>X-Token</code> an authentication token. See [[Company public service methods#Authentication|authentication]] section.


===Endpoint===
===Endpoint===
Line 84: Line 91:
===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 'Custom Features' link and select [[Custom_Features#API|API Custom Feature]] '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 110: Line 117:
<code>require_confirm = true</code>. <code>$startDate</code> and <code>$startTime</code> specifies a date of
<code>require_confirm = true</code>. <code>$startDate</code> and <code>$startTime</code> specifies a date of
booking and time slot. Time value should be multiple to 'timeframe' configuration of company (see
booking and time slot. Time value should be multiple to 'timeframe' configuration of company (see
<code>[[#getTimeframe|getTimeframe]]</code> API method). <code>$endDate</code> and <code>$endTime</code> parameters
<code>[[Company public service methods#getTimeframe|getTimeframe]]</code> API method). <code>$endDate</code> and <code>$endTime</code> parameters
should be calculated according to service duration. However you can specify different values to make appointment
should be calculated according to service duration. However you can specify different values to make appointment
longer or shorter then service configuration. Note that <code>$endDate</code> and <code>$endTime</code> should be
longer or shorter then service configuration. Note that <code>$endDate</code> and <code>$endTime</code> should be
Line 117: Line 124:
between client's time zone and company's time zone in minutes. 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 60 minutes. 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>[[Company public service methods#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 intake forms (see [[Custom_Features#Intake_Forms|Intake Forms Custom feature]]). 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 [[Company public service methods#book response|example]] of <code>book</code> API method response.


See also:
See also:
Line 158: Line 165:


Cancels a booking. <code>$sign</code> parameter must be a string created with formula: <code>md5($bookingId . $bookingHash . $secretKey)
Cancels a booking. <code>$sign</code> parameter must be a string created with formula: <code>md5($bookingId . $bookingHash . $secretKey)
</code>. You can get <code>$bookingHash</code> value as result of <code>[[#book|book]]</code> API method call. Method
</code>. You can get <code>$bookingHash</code> value as result of <code>[[Company public service methods#book|book]]</code> API method call. Method
return an error with code -32080 (Appointment couldn't be found) if record with specified id not exists. Methods returns
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 <code>$sign</code> parameter is wrong.
an error with code -32085 (Signature error) if <code>$sign</code> parameter is wrong.
Line 261: Line 268:
Returns Integer.
Returns Integer.


Creates new booking batch record. Returns newly created batch id. You can use this id in <code>[[#book|book]]</code>
Creates new booking batch record. Returns newly created batch id. You can use this id in <code>[[Company public service methods#book|book]]</code>
API method.
API method.


Line 297: Line 304:
Returns Array.
Returns Array.


Return intake forms for certain event if [[Custom_Features#Intake_Forms|Intake Forms Custom feature]] 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>[[Company public service methods#isPluginActivated|isPluginActivated('event_field')]]</code>
API method to check if 'event_field' Custom Feature activated.
API method to check if 'event_field' Custom Feature activated.


Line 311: Line 318:
Returns Object|null.
Returns Object|null.


Returns information about [[Custom_Features#Any_Employee_Selector|Any Employee Selector Custom Feature]] configuration. Returns
Returns information about [[Custom Features#Any Employee Selector|Any Employee Selector Custom Feature]] configuration. Returns
null if Custom Feature not enabled.Example:
null if Custom Feature not enabled.Example:
   {
   {
Line 375: Line 382:
Returns an object with details information about booking. <code>$sign</code> parameter must be a string created
Returns an object with details information about booking. <code>$sign</code> parameter must be a string created
with formula: <code>md5($bookingId . $bookingHash . $secretKey)</code>. You can get <code>$bookingHash</code>
with formula: <code>md5($bookingId . $bookingHash . $secretKey)</code>. You can get <code>$bookingHash</code>
value as result of <code>[[#book|book]]</code> API method call. Method return an error with code -32080
value as result of <code>[[Company public service methods#book|book]]</code> 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
(Appointment couldn't be found) if record with specified id not exists. Methods returns an error with code -32085
(Signature error) if <code>$sign</code> parameter is wrong.
(Signature error) if <code>$sign</code> parameter is wrong.
Line 420: Line 427:
Returns an object with details information about booking. <code>$sign</code> parameter must be a string created
Returns an object with details information about booking. <code>$sign</code> parameter must be a string created
with formula: <code>md5($bookingId . $bookingHash . $secretKey)</code>. You can get <code>$bookingHash</code>
with formula: <code>md5($bookingId . $bookingHash . $secretKey)</code>. You can get <code>$bookingHash</code>
value as result of <code>[[#book|book]]</code> API method call. Method return an error with code -32080
value as result of <code>[[Company public service methods#book|book]]</code> 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
(Appointment couldn't be found) if record with specified id not exists. Methods returns an error with code -32085
(Signature error) if <code>$sign</code> parameter is wrong.
(Signature error) if <code>$sign</code> parameter is wrong.
Line 437: Line 444:
Returns Array.
Returns Array.


Returns company categories list if [[Custom_Features#Service_Categories|Service Categories Custom Feature]] 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 Custom Feature is not activated. Use <code>[[#isPluginActivated|isPluginActivated('event_category')]]</code>
an error with code -32001 if Custom Feature is not activated. Use <code>[[Company public service methods#isPluginActivated|isPluginActivated('event_category')]]</code>
API method to check if Custom Feature activated.
API method to check if Custom Feature activated.


Line 451: Line 458:
Returns Object.
Returns Object.


Returns an object with detailed information about company. See [[#getCompanyInfo response|example of response]].
Returns an object with detailed information about company. See [[Company public service methods#getCompanyInfo response|example of response]].




Line 468: Line 475:
Returns company config value for key. A different set of keys available for public API and for company
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
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]].
allowed. See [[Company public service methods#Company params|list of available keys]].




Line 485: Line 492:
Returns company's config values for specified keys as key-value map. For non-existent and not-allowed param keys
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
it will return '''false''' as result. A different set of keys available for public API and for company
administration API. See [[#Company_params|list of available keys]].
administration API. See [[Company public service methods#Company params|list of available keys]].


----
----
Line 557: Line 564:
Returns Array.
Returns Array.


Returns available locations for company if Custom Feature [[Custom_Features#Multiple_Locations|Multiple locations Custom Feature]] 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 Custom Feature is not activated. Use <code>[[#isPluginActivated|isPluginActivated('location')]]</code>
an error with code -32001 if Custom Feature is not activated. Use <code>[[Company public service methods#isPluginActivated|isPluginActivated('location')]]</code>
API method to check if Custom Feature activated.
API method to check if Custom Feature activated.


Line 582: Line 589:
----
----


=== getPluginPromoInfoByCode ===
<!----=== getPluginPromoInfoByCode ===


<code>getPluginPromoInfoByCode($code)</code>
<code>getPluginPromoInfoByCode($code)</code>
Line 597: Line 604:
not enabled then method returns an error with code -32001 (Custom Feature 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 Custom Feature 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 612: Line 619:
Returns Array.
Returns Array.


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]].
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 633: Line 640:
----
----


=== getPromotionRewardInfo ===
<!---=== getPromotionRewardInfo ===


<code>getPromotionRewardInfo($commonPromotionId, $clientId, $hash)</code>
<code>getPromotionRewardInfo($commonPromotionId, $clientId, $hash)</code>
Line 647: Line 654:
Returns promotion reward by common promotion id, client id and hash.
Returns promotion reward by common promotion id, client id and hash.


 
-->
----
----


Line 686: Line 693:
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 [[Custom_Features#Calendar_Sync|Calendar Sync Custom Feature]] is 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  Calendar Sync Custom Feature activated.
<code>[[Company public service methods#isPluginActivated|isPluginActivated('google_calendar_export')]]</code> API method to check if  Calendar Sync Custom Feature activated.




Line 755: Line 762:


If locations Custom Feature 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 [[Custom_Features#Multiple_Locations|Multiple Locations]] Custom Feature description for
units available only for selected location. See [[Custom Features#Multiple Locations|Multiple Locations]] Custom Feature description for
more details.
more details.


Line 768: Line 775:
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 [[Need_to_change_interval_(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 889: Line 896:
Returns Boolean.
Returns Boolean.


Returns true if [[Custom_Features#Accept_Payments|Accept Payments]] Custom Feature activated and event with specified id has
Returns true if [[Custom Features#Accept Payments|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
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.
one event has configured price. Otherwise returns false.
Line 905: Line 912:
Returns Boolean.
Returns Boolean.


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]].
Return Custom Feature status true if status active, else false. <var>$pluginName</var> parameter is a Custom Feature identifier.See [[Custom Features]] page for full Custom Features description. See [[Company public service methods#Custom Features.27 identifiers|list of available Custom Features' names]].




Line 993: Line 1,000:
===Company params===
===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>[[Company public service methods#getCompanyParam|getCompanyParam]]</code> API method.


=====General params=====
=====General params=====
Line 1,006: Line 1,013:
* fixed_country_prefix
* fixed_country_prefix
* max_group_bookings
* max_group_bookings
*: [[Custom_Features#Group_Bookings|Group Bookings Custom Feature]] 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,020: Line 1,027:
* 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 [[Need_to_change_interval_(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,033: Line 1,040:
=====Accept Payments Custom Feature params=====
=====Accept Payments Custom Feature params=====


Read more about [[Custom_Features#Accept_Payments|Accept Payments Custom Feature configuration]].
Read more about [[Custom Features#Accept Payments|Accept Payments Custom Feature configuration]].


* allow_delay_payment
* allow_delay_payment
Line 1,046: Line 1,053:
=====Cancellation Policy Custom Feature params=====
=====Cancellation Policy Custom Feature params=====


Read more about [[Custom_Features#Cancellation_Policy|Cancellation Policy Custom Feature configuration]].
Read more about [[Custom Features#Cancellation Policy|Cancellation Policy Custom Feature configuration]].


* cancelation_policy_text
* cancelation_policy_text
Line 1,059: Line 1,066:
====Custom Features' identifiers====
====Custom Features' identifiers====


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.
Custom Feature identifier is a string constant which represents a Custom Feature in system. These constants used in <code>[[Company public service methods#isPluginActivated|isPluginActivated]]</code> and <code>[[Company public service methods#getPluginStatuses|getPluginStatuses]]</code> API methods.


* advanced_notification
* advanced_notification
Line 1,109: Line 1,116:
* paid_events
* paid_events
*:Accept payments  
*:Accept payments  
* promo
<!--* promo
*:Rewards and Referrals
*:Rewards and Referrals-->
* recap
* recap
*:Daily report  
*:Daily report  
Line 1,124: Line 1,131:
*:Cancellation Policy
*:Cancellation Policy


See [[Custom_Features|Custom Features]] page for description for each .
See [[Custom Features]] page for description for each .


----
----
Line 1,133: Line 1,140:
====book response====
====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.
[[Company public service methods#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.


   {
   {
Line 1,192: Line 1,199:
====getCompanyInfo response====
====getCompanyInfo response====


An example of data returned by [[#getCompanyInfo|getCompanyInfo]] API method.
An example of data returned by [[Company public service methods#getCompanyInfo|getCompanyInfo]] API method.


   {
   {
Line 1,233: Line 1,240:
<code>description</code> field contains raw data of company's description which can include HTML tags. <code>description_text</code> field contains only text information without HTML tags.
<code>description</code> field contains raw data of company's description which can include HTML tags. <code>description_text</code> field contains only text information without HTML tags.


For information about <code>timeframe</code>, <code>timezone</code>, <code>allow_event_day_break</code> and <code>allow_event_breaktime_break</code> see [[#Company params|Company params section]].
For information about <code>timeframe</code>, <code>timezone</code>, <code>allow_event_day_break</code> and <code>allow_event_breaktime_break</code> see [[Company public service methods#Company params|Company params section]].
----
----


====getPluginPromoInfoByCode response====
<!----====getPluginPromoInfoByCode response====


   {
   {
Line 1,263: Line 1,270:
   }
   }


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