Company administration service methods: Difference between revisions

No edit summary
No edit summary
 
(11 intermediate revisions by 2 users not shown)
Line 1: Line 1:
==General Information==
<languages/>
<translate>


<!--T:1-->
{{#seo:
|title=Company administration service methods - SimplyBook.me
|description=Learn about service methods for internal company administration. Manage bookings tailored to your operations. Start here!
|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
}}
</translate>
<translate>
==General Information== <!--T:2-->
<!--T:3-->
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:
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:


</translate>
<translate>
<!--T:4-->
* <code>jsonrpc</code> - a version of JSON-RPC protocol. Always <code>"2.0"</code>
* <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>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>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.
* <code>id</code> - A value of any type, which is used to match the response with the request that it is replying to.
</translate>


<translate>
<!--T:5-->
The receiver of the request must reply with a valid response to all received requests. A response must contain the properties mentioned below.
The receiver of the request must reply with a valid response to all received requests. A response must contain the properties mentioned below.


<!--T:6-->
* <code>result</code> - The data returned by the invoked method. If an error occurred while invoking the method, this value must be null.
* <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>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.
* <code>id</code> - The id of the request it is responding to.
</translate>


<translate>
<!--T:7-->
Example
Example


<!--T:8-->
<pre>
<pre>
   Request
   Request
Line 30: Line 58:
         "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 50: Line 78:
   }
   }
</pre>
</pre>
</translate>


<translate>
<!--T:9-->
Example of request with error response:
Example of request with error response:


<!--T:10-->
<pre>
<pre>
   Request
   Request
Line 72: Line 104:
   }
   }
</pre>
</pre>
</translate>


<translate>
<!--T:11-->
All calls of public service methods should have additional HTTP header:
All calls of public service methods should have additional HTTP header:


* <code>X-Token</code> an authentication token. See [[#Authentication|authentication]] section.
<!--T:12-->
* <code>X-Token</code> an authentication token. See [[Company administration service methods#Authentication|authentication]] section.


===Endpoint===
===Endpoint=== <!--T:13-->


<!--T:14-->
Use URL <code>https://user-api.simplybook.me/admin</code> for all administration service API calls.
Use URL <code>https://user-api.simplybook.me/admin</code> for all administration service API calls.


===Authentication===
===Authentication=== <!--T:15-->
 
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 ==
<!--T:16-->
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 == <!--T:17-->


=== addClient ===
=== addClient === <!--T:18-->


<!--T:19-->
<code>addClient($clientData)</code>
<code>addClient($clientData)</code>


<!--T:20-->
Parameters:
Parameters:


<!--T:21-->
* '''$clientData''' Object  
* '''$clientData''' Object  


<!--T:22-->
Returns Integer.
Returns Integer.


</translate>
<translate>
<!--T:23-->
Adds new client with specified data. You can specify name, email, phone, address1, address2, city, zip,
Adds new client with specified data. You can specify name, email, phone, address1, address2, city, zip,
country_id. If client record with specified data exists  method will return an id of this record. Otherwise data
country_id. If client record with specified data exists  method will return an id of this record. Otherwise data
Line 104: Line 149:
<code>getCompanyParam('require_fields')</code> method to check which fields are required.
<code>getCompanyParam('require_fields')</code> method to check which fields are required.


<!--T:24-->
Method returns an error:
Method returns an error:


<!--T:25-->
* -32061 Client name value is wrong
* -32061 Client name value is wrong
* -32062 Client email value is wrong
* -32062 Client email value is wrong
Line 111: Line 158:




<!--T:26-->
Example:
Example:


   {
   <!--T:27-->
{
     name: "Frances T. Perez",
     name: "Frances T. Perez",
     phone: "+1502-810-4521",
     phone: "+1502-810-4521",
Line 123: Line 172:
   }
   }


</translate>


<translate>
<!--T:28-->
----
----


=== addDeviceToken ===
=== addDeviceToken === <!--T:29-->


<!--T:30-->
<code>addDeviceToken($token, $device)</code>
<code>addDeviceToken($token, $device)</code>


<!--T:31-->
Parameters:
Parameters:


<!--T:32-->
* '''$token''' String a device token string
* '''$token''' String a device token string
* '''$device''' String a device type ('android' or 'apple')
* '''$device''' String a device type ('android' or 'apple')


<!--T:33-->
Returns boolean.
Returns boolean.


<!--T:34-->
Subscribe a mobile device to push notifications service. Device will recieve notifications about new bookings or
Subscribe a mobile device to push notifications service. Device will recieve notifications about new bookings or
changes in already created bookings. Use either <code>'apple'</code> or <code>'android'</code> for <code>device</code>
changes in already created bookings. Use either <code>'apple'</code> or <code>'android'</code> for <code>device</code>
parameter.
parameter.


<!--T:35-->
----
----
</translate>
<translate>


=== book ===
=== book === <!--T:36-->


<!--T:37-->
<code>book($eventId, $unitId, $clientId, $startDate, $startTime, $endDate, $endTime, $clientTimeOffset, $additional, $count, $batchId, $recurringData)</code>
<code>book($eventId, $unitId, $clientId, $startDate, $startTime, $endDate, $endTime, $clientTimeOffset, $additional, $count, $batchId, $recurringData)</code>


<!--T:38-->
Parameters:
Parameters:


<!--T:39-->
* '''$eventId''' Integer  
* '''$eventId''' Integer  
* '''$unitId''' Integer  
* '''$unitId''' Integer  
Line 162: Line 226:
* '''$recurringData''' Array - make booking recurrent. (optional)
* '''$recurringData''' Array - make booking recurrent. (optional)


<!--T:40-->
Returns Object.
Returns Object.


</translate>
<translate>
<!--T:41-->
Creates new booking record. Returns an object with appointment information or throw exception if booking time not
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
available or any of required parameters missed. If appointment requires confirmation, in result object will be
<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 administration 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 175: Line 245:
client's time zone in seconds. For example if company located in city with time zone GMT+2 and customer located
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 <code>$clientTimeOffset</code> will be -3600 seconds. You can get information about company's
in city with GMT+3 then <code>$clientTimeOffset</code> will be -3600 seconds. You can get information about company's
time zone using <code>[[#getCompanyInfo|getCompanyInfo]]</code> API method. To create batch booking you can
time zone using <code>[[Company administration 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 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 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>
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>
 
</translate>
 
<translate>


If [[Custom_Features#Multiple_Locations| Multiple locations]] enabled you need to pass locations ID parameter as additional field
<!--T:42-->
<code>location_id</code>. For example: <code>{"location_id": "1"}</code>. Use <code>[[#isPluginActivated|isPluginActivated('location')]]</code>
If [[Custom Features#Multiple Locations| Multiple locations]] enabled you need to pass locations ID parameter as additional field
to check if Custom feature active and <code>[[#getLocationsList|getLocationsList()]]</code> method to get list of
<code>location_id</code>. For example: <code>{"location_id": "1"}</code>. Use <code>[[Company administration service methods#isPluginActivated|isPluginActivated('location')]]</code>
to check if Custom feature active and <code>[[Company administration service methods#getLocationsList|getLocationsList()]]</code> method to get list of
available locations.
available locations.


See [[#book response|example]] of <code>book</code> API method response.
<!--T:43-->
See [[Company administration service methods#book response|example]] of <code>book</code> API method response.


<!--T:44-->
See also:
See also:


<!--T:45-->
* [https://help.simplybook.me/index.php/Need_to_change_interval_(timeframe) Timeframe information]
* [https://help.simplybook.me/index.php/Need_to_change_interval_(timeframe) Timeframe information]
</translate>


----
----
<translate>


=== calculateEndTime ===
=== calculateEndTime === <!--T:46-->


<!--T:47-->
<code>calculateEndTime($startDateTime, $eventId, $unitId)</code>
<code>calculateEndTime($startDateTime, $eventId, $unitId)</code>


<!--T:48-->
Parameters:
Parameters:


<!--T:49-->
* '''$startDateTime''' String a date and time string in format 'Y-m-d H:i:s', eg. '2001-10-02 13:30:00'.
* '''$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  


<!--T:50-->
Returns String|Boolean.
Returns String|Boolean.


<!--T:51-->
Returns end datetime if booking is available, else return false
Returns end datetime if booking is available, else return false




<!--T:52-->
----
----
</translate>
<translate>


=== cancelBatch ===
=== cancelBatch === <!--T:53-->


<!--T:54-->
<code>cancelBatch($id, $bookingIds)</code>
<code>cancelBatch($id, $bookingIds)</code>


<!--T:55-->
Parameters:
Parameters:


* '''$id''' Integer identifier of batch. See <code>[[#createBatch|createBatch]]</code> API method.
<!--T:56-->
* '''$id''' Integer identifier of batch. See <code>[[Company administration service methods#createBatch|createBatch]]</code> API method.
* '''$bookingIds''' Array ids of bookings included to batch.
* '''$bookingIds''' Array ids of bookings included to batch.


<!--T:57-->
Returns boolean.
Returns boolean.


<!--T:58-->
Cancel batch of bookings. Returns true on success. Returns an error with code -32080 (Appointment couldn't be found)
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
if no booking with specified id were found. A booking with first id in <code>$bookingIds</code> list is used for
Line 225: Line 322:




<!--T:59-->
----
----
</translate>
<translate>


=== cancelBooking ===
=== cancelBooking === <!--T:60-->


<!--T:61-->
<code>cancelBooking($id)</code>
<code>cancelBooking($id)</code>


<!--T:62-->
Parameters:
Parameters:


<!--T:63-->
* '''$id''' Integer  
* '''$id''' Integer  


<!--T:64-->
Returns Boolean.
Returns Boolean.


<!--T:65-->
Cancels booking. Returns true on success. Returns an error with code -32080 (Appointment couldn't be found) if
Cancels booking. Returns true on success. Returns an error with code -32080 (Appointment couldn't be found) if
no booking with specified id were found.
no booking with specified id were found.




<!--T:66-->
----
----
</translate>
<translate>


=== createBatch ===
=== createBatch === <!--T:67-->


<!--T:68-->
<code>createBatch()</code>
<code>createBatch()</code>


<!--T:69-->
No arguments.
No arguments.
Returns Integer.
Returns Integer.


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




<!--T:71-->
----
----
</translate>


=== deleteDeviceToken ===
<translate>


=== deleteDeviceToken === <!--T:72-->
<!--T:73-->
<code>deleteDeviceToken($token)</code>
<code>deleteDeviceToken($token)</code>


<!--T:74-->
Parameters:
Parameters:


<!--T:75-->
* '''$token''' String - device token
* '''$token''' String - device token


<!--T:76-->
Returns boolean.
Returns boolean.


<!--T:77-->
Unsubscribe from push notifications service.
Unsubscribe from push notifications service.




<!--T:78-->
----
----
</translate>
<translate>


=== editBook ===
=== editBook === <!--T:79-->


<!--T:80-->
<code>editBook($shedulerId, $eventId, $unitId, $clientId, $startDate, $startTime, $endDate, $endTime, $clientTimeOffset, $additional)</code>
<code>editBook($shedulerId, $eventId, $unitId, $clientId, $startDate, $startTime, $endDate, $endTime, $clientTimeOffset, $additional)</code>


<!--T:81-->
Parameters:
Parameters:


* '''$shedulerId''' Integer an id of booking to edit. See <code>[[#book|book]]</code> or <code>[[#getBookings|getBookings]]</code> API methods.
<!--T:82-->
* '''$shedulerId''' Integer an id of booking to edit. See <code>[[Company administration service methods#book|book]]</code> or <code>[[Company administration service methods#getBookings|getBookings]]</code> API methods.
* '''$eventId''' Integer  
* '''$eventId''' Integer  
* '''$unitId''' Integer  
* '''$unitId''' Integer  
Line 288: Line 420:
* '''$additional''' array|Object - additional params and fields.
* '''$additional''' array|Object - additional params and fields.


<!--T:83-->
Returns Object.
Returns Object.


Edit existing booking record. See [[#book|book]] API method description for more details about date/time parameters,
<!--T:84-->
Edit existing booking record. See [[Company administration service methods#book|book]] API method description for more details about date/time parameters,
time zone handling and additional fields. Returns null if parameters not valid.
time zone handling and additional fields. Returns null if parameters not valid.




<!--T:85-->
----
----
</translate>
<translate>


=== editClient ===


=== editClient === <!--T:86-->
<!--T:87-->
<code>editClient($clientId, $clientData)</code>
<code>editClient($clientId, $clientData)</code>


<!--T:88-->
Parameters:
Parameters:


<!--T:89-->
* '''$clientId''' Integer  
* '''$clientId''' Integer  
* '''$clientData''' Object  
* '''$clientData''' Object  


<!--T:90-->
Returns Integer.
Returns Integer.


Edits client's record. See <code>[[#addClient|addClient]]</code> method description for list of available fields.Method returns an id of client's record.
<!--T:91-->
Edits client's record. See <code>[[Company administration service methods#addClient|addClient]]</code> method description for list of available fields.Method returns an id of client's record.




<!--T:92-->
----
----
</translate>


=== filterAvailableUnits ===
<translate>


=== filterAvailableUnits === <!--T:93-->
<!--T:94-->
<code>filterAvailableUnits($eventId, $dateTime, $unitIds, $count)</code>
<code>filterAvailableUnits($eventId, $dateTime, $unitIds, $count)</code>


<!--T:95-->
Parameters:
Parameters:


<!--T:96-->
* '''$eventId''' Integer  
* '''$eventId''' Integer  
* '''$dateTime''' String a date and time string in format 'Y-m-d H:i:s'
* '''$dateTime''' String a date and time string in format 'Y-m-d H:i:s'
Line 323: Line 475:
* '''$count''' Integer  
* '''$count''' Integer  


<!--T:97-->
Returns Array.
Returns Array.


<!--T:98-->
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 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.
Returns empty array if all units are not allowed.
Line 330: Line 484:




<!--T:99-->
----
----
</translate>


=== getAdditionalFields ===
<translate>


<code>getAdditionalFields($eventId)</code>


=== getAdditionalFields === <!--T:100-->
<!--T:101-->
<code>getAdditionalFields($eventId)</code>
<!--T:102-->
Parameters:
Parameters:


<!--T:103-->
* '''$eventId''' Integer  
* '''$eventId''' Integer  


<!--T:104-->
Returns Array.
Returns Array.


Return intake forms for certain event if [[Custom_Features#Intake_Forms|Intake Forms Custom Feature]] is
<!--T:105-->
activated. Returns empty array otherwise. Call <code>[[#isPluginActivated|isPluginActivated('event_field')]]</code>
Return intake forms for certain event if [[Custom Features#Intake Forms|Intake Forms Custom Feature]] is
activated. Returns empty array otherwise. Call <code>[[Company administration 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.




<!--T:106-->
----
----
</translate>
<translate>


=== getAnyUnitData ===
=== getAnyUnitData === <!--T:107-->


<!--T:108-->
<code>getAnyUnitData()</code>
<code>getAnyUnitData()</code>


<!--T:109-->
No arguments.
No arguments.
Returns Object|null.
Returns Object|null.


Returns information about [[Custom_Features#Any_Employee_Selector|Any Employee selector Custom Feature]] configuration. Returns
<!--T:110-->
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 368: Line 540:




<!--T:111-->
----
----
</translate>
<translate>


=== getAvailableTimeIntervals ===
=== getAvailableTimeIntervals === <!--T:112-->


<!--T:113-->
<code>getAvailableTimeIntervals($dateFrom, $dateTo, $eventId, $unitId, $count)</code>
<code>getAvailableTimeIntervals($dateFrom, $dateTo, $eventId, $unitId, $count)</code>


<!--T:114-->
Parameters:
Parameters:


<!--T:115-->
* '''$dateFrom''' String  
* '''$dateFrom''' String  
* '''$dateTo''' String  
* '''$dateTo''' String  
Line 382: Line 562:
* '''$count''' Integer  
* '''$count''' Integer  


<!--T:116-->
Returns Object.
Returns Object.


<!--T:117-->
Returns available time intervals for all service providers for given period, taking into account breaktimes, start and end working time
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>
Eg.: <code>{['2016-03-04': ['1': [['09:00:00','09:30:00'], ['11:15:00','14:45:00']] , ...], ...]}</code>




<!--T:118-->
----
----
</translate>
<translate>


=== getAvailableUnits ===
=== getAvailableUnits === <!--T:119-->


<!--T:120-->
<code>getAvailableUnits($eventId, $dateTime, $count)</code>
<code>getAvailableUnits($eventId, $dateTime, $count)</code>


<!--T:121-->
Parameters:
Parameters:


<!--T:122-->
* '''$eventId''' Integer  
* '''$eventId''' Integer  
* '''$dateTime''' String a date and time string in format 'Y-m-d H:i:s'
* '''$dateTime''' String a date and time string in format 'Y-m-d H:i:s'
* '''$count''' Integer  
* '''$count''' Integer  


<!--T:123-->
Returns Array.
Returns Array.


<!--T:124-->
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 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>




<!--T:125-->
----
----


=== getBookingCancellationsInfo ===
</translate>
 
<translate>
 
=== getBookingCancellationsInfo === <!--T:126-->


<!--T:127-->
<code>getBookingCancellationsInfo($dateStart, $dateEnd)</code>
<code>getBookingCancellationsInfo($dateStart, $dateEnd)</code>


<!--T:128-->
Parameters:
Parameters:


<!--T:129-->
* '''$dateStart''' String a date string in format 'Y-m-d'. Pass null to get data from first day of current week.
* '''$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.
* '''$dateEnd''' String a date string in format 'Y-m-d'. Pass null to get data filtered to last day of current week.


<!--T:130-->
Returns Array.
Returns Array.


<!--T:131-->
Returns statistics about created bookings and cancellations for a time period. Data presented as array of hashes for
Returns statistics about created bookings and cancellations for a time period. Data presented as array of hashes for
each type of operation (created or cancelled booking) groped by clients. <code>"type"</code> field can be either
each type of operation (created or cancelled booking) groped by clients. <code>"type"</code> field can be either
Line 441: Line 643:




<!--T:132-->
----
----


=== getBookingComment ===
</translate>
 
<translate>
 
=== getBookingComment === <!--T:133-->


<!--T:134-->
<code>getBookingComment($id)</code>
<code>getBookingComment($id)</code>


<!--T:135-->
Parameters:
Parameters:


<!--T:136-->
* '''$id''' Integer  
* '''$id''' Integer  


<!--T:137-->
Returns String.
Returns String.


<!--T:138-->
Returns booking comment
Returns booking comment




<!--T:139-->
----
----
</translate>
<translate>


=== getBookingDetails ===
=== getBookingDetails === <!--T:140-->


<!--T:141-->
<code>getBookingDetails($id)</code>
<code>getBookingDetails($id)</code>


<!--T:142-->
Parameters:
Parameters:


<!--T:143-->
* '''$id''' integer booking id
* '''$id''' integer booking id


<!--T:144-->
Returns Array.
Returns Array.


Returns detailed bookings object by booking id. See [[#getBookingDetails_response|response example]].
<!--T:145-->
Returns detailed bookings object by booking id. See [[Company administration service methods#getBookingDetails response|response example]].




<!--T:146-->
----
----
</translate>


=== getBookingLimitUnavailableTimeInterval ===
<translate>


=== getBookingLimitUnavailableTimeInterval === <!--T:147-->
<!--T:148-->
<code>getBookingLimitUnavailableTimeInterval($startDateTime, $endDateTime, $eventId)</code>
<code>getBookingLimitUnavailableTimeInterval($startDateTime, $endDateTime, $eventId)</code>


<!--T:149-->
Parameters:
Parameters:


<!--T:150-->
* '''$startDateTime''' string a date and time string in format 'Y-m-d H:i:s'
* '''$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'
* '''$endDateTime''' string a date and time string in format 'Y-m-d H:i:s'
* '''$eventId''' integer  
* '''$eventId''' integer  


<!--T:151-->
Returns Array.
Returns Array.


Returns time intervals not available for bookings because of configuration of [[Custom_Features#Limit_Bookings|Limit bookings]]
<!--T:152-->
Returns time intervals not available for bookings because of configuration of [[Custom Features#Limit Bookings|Limit bookings]]
Custom Feature for period of time. Returns empty array if Custom Feature not available.
Custom Feature for period of time. Returns empty array if Custom Feature not available.




<!--T:153-->
----
----
</translate>
<translate>


=== getBookingRevenue ===
=== getBookingRevenue === <!--T:154-->


<!--T:155-->
<code>getBookingRevenue($dateStart, $dateEnd, $unitGroupId, $serviceId)</code>
<code>getBookingRevenue($dateStart, $dateEnd, $unitGroupId, $serviceId)</code>


<!--T:156-->
Parameters:
Parameters:


<!--T:157-->
* '''$dateStart''' string a date string in format 'Y-m-d'.
* '''$dateStart''' string a date string in format 'Y-m-d'.
* '''$dateEnd''' string a date string in format 'Y-m-d'
* '''$dateEnd''' string a date string in format 'Y-m-d'
Line 502: Line 742:
* '''$serviceId''' integer  
* '''$serviceId''' integer  


<!--T:158-->
Returns Array.
Returns Array.


<!--T:159-->
Return bookings count and revenue value for each date in specified period. Data grouped by unit id and
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
represented as array with bookings count at index 0 and revenue amount at index 1. You can filter data either
Line 514: Line 756:




<!--T:160-->
----
----
</translate>
<translate>


=== getBookingStats ===
=== getBookingStats === <!--T:161-->


<!--T:162-->
<code>getBookingStats($groupBy)</code>
<code>getBookingStats($groupBy)</code>


<!--T:163-->
Parameters:
Parameters:


<!--T:164-->
* '''$groupBy''' String either 'day', 'week' or 'month'
* '''$groupBy''' String either 'day', 'week' or 'month'


<!--T:165-->
Returns Array.
Returns Array.


<!--T:166-->
Returns statistic about bookings count grouped by 'day', 'week' or 'month'. A time period depends on selected
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
grouping parameter:* for 'day' methods returns statistics for last 31 days
Line 532: Line 784:




<!--T:167-->
----
----
</translate>
<translate>


=== getBookings ===
=== getBookings === <!--T:168-->


<!--T:169-->
<code>getBookings($params)</code>
<code>getBookings($params)</code>


<!--T:170-->
Parameters:
Parameters:


<!--T:171-->
* '''$params'''   
* '''$params'''   


<!--T:172-->
Returns Array.
Returns Array.


<!--T:173-->
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'
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'
* '''time_from''' a time string in format 'H:i:s'
Line 552: Line 814:
* '''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 [[Custom_Features#Approve_Bookings|Approve booking]] Custom Feature 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.
Line 569: Line 831:
** '''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)
** '''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)


<!--T:174-->
Example:
Example:
   {
   {
Line 579: Line 842:




<!--T:175-->
----
----
</translate>


=== getBookingsZapier ===
<translate>


=== getBookingsZapier === <!--T:176-->
<!--T:177-->
<code>getBookingsZapier()</code>
<code>getBookingsZapier()</code>


<!--T:178-->
No arguments.
No arguments.
Returns Array.
Returns Array.


<!--T:179-->
Returns list of bookings filtered by given params
Returns list of bookings filtered by given params




<!--T:180-->
----
----
</translate>
<translate>


=== getCategoriesList ===
=== getCategoriesList === <!--T:181-->


<!--T:182-->
<code>getCategoriesList($isPublic)</code>
<code>getCategoriesList($isPublic)</code>


<!--T:183-->
Parameters:
Parameters:


<!--T:184-->
* '''$isPublic''' Boolean  
* '''$isPublic''' Boolean  


<!--T:185-->
Returns Array.
Returns Array.


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




<!--T:187-->
----
----


=== getClient ===
</translate>


<translate>
=== getClient === <!--T:188-->
<!--T:189-->
<code>getClient($clientId)</code>
<code>getClient($clientId)</code>


<!--T:190-->
Parameters:
Parameters:


<!--T:191-->
* '''$clientId'''   
* '''$clientId'''   


<!--T:192-->
Returns Array.
Returns Array.


Returns client's data object. See <code>[[#addClient|addClient]]</code> API method for list of available fields
<!--T:193-->
Returns client's data object. See <code>[[Company administration service methods#addClient|addClient]]</code> API method for list of available fields
of client data object.
of client data object.




<!--T:194-->
----
----


=== getClientComments ===
</translate>


<translate>
=== getClientComments === <!--T:195-->
<!--T:196-->
<code>getClientComments($clientId, $shedulerId)</code>
<code>getClientComments($clientId, $shedulerId)</code>


<!--T:197-->
Parameters:
Parameters:


<!--T:198-->
* '''$clientId''' Integer  
* '''$clientId''' Integer  
* '''$shedulerId''' Integer  
* '''$shedulerId''' Integer  


<!--T:199-->
Returns Array.
Returns Array.


<!--T:200-->
Returns list of all comments for given client
Returns list of all comments for given client




<!--T:201-->
----
----


=== getClientList ===
</translate>


<translate>
=== getClientList === <!--T:202-->
<!--T:203-->
<code>getClientList($searchString, $limit)</code>
<code>getClientList($searchString, $limit)</code>


<!--T:204-->
Parameters:
Parameters:


<!--T:205-->
* '''$searchString''' String  
* '''$searchString''' String  
* '''$limit''' Integer  
* '''$limit''' Integer  


<!--T:206-->
Returns Array.
Returns Array.


<!--T:207-->
Returns list of clients associated with company. You can use either phone number, email address or name as value
Returns list of clients associated with company. You can use either phone number, email address or name as value
for <code>$searchString</code>. Pass an empty string for <code>$searchString</code> and null for <code>$limit</code>
for <code>$searchString</code>. Pass an empty string for <code>$searchString</code> and null for <code>$limit</code>
parameters to get all records. See <code>[[#addClient|addClient]]</code> API method for list of available fields
parameters to get all records. See <code>[[Company administration service methods#addClient|addClient]]</code> API method for list of available fields
of client data object.
of client data object.




<!--T:208-->
----
----


=== getCompanyCurrency ===
</translate>
 
<translate>
 
=== getCompanyCurrency === <!--T:209-->


<!--T:210-->
<code>getCompanyCurrency()</code>
<code>getCompanyCurrency()</code>


<!--T:211-->
No arguments.
No arguments.
Returns String.
Returns String.


<!--T:212-->
Returns company's currency as three chars code (ISO 4217).
Returns company's currency as three chars code (ISO 4217).




<!--T:213-->
----
----
</translate>
<translate>


=== getCompanyInfo ===
=== getCompanyInfo === <!--T:214-->


<!--T:215-->
<code>getCompanyInfo()</code>
<code>getCompanyInfo()</code>


<!--T:216-->
No arguments.
No arguments.
Returns Object.
Returns Object.


Returns an object with detailed information about company. See [[#getCompanyInfo response|example of response]].
<!--T:217-->
Returns an object with detailed information about company. See [[Company administration service methods#getCompanyInfo response|example of response]].




<!--T:218-->
----
----


=== getCompanyParam ===
</translate>
 
<translate>
 
=== getCompanyParam === <!--T:219-->


<!--T:220-->
<code>getCompanyParam($key)</code>
<code>getCompanyParam($key)</code>


<!--T:221-->
Parameters:
Parameters:


<!--T:222-->
* '''$key''' String  
* '''$key''' String  


<!--T:223-->
Returns mixed.
Returns mixed.


<!--T:224-->
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 administration service methods#Company params|list of available keys]].




<!--T:225-->
----
----


=== getCompanyParams ===
</translate>
 
<translate>
 
=== getCompanyParams === <!--T:226-->


<!--T:227-->
<code>getCompanyParams($keys)</code>
<code>getCompanyParams($keys)</code>


<!--T:228-->
Parameters:
Parameters:


<!--T:229-->
* '''$keys''' Array  
* '''$keys''' Array  


<!--T:230-->
Returns Array.
Returns Array.


<!--T:231-->
Returns company config values for keys. A different set of keys available for public API and for company
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
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
allowed. See [[Company administration service methods#Company params|list of available keys]].For non-existent and not-allowed params it will return false as result




<!--T:232-->
----
----


=== getCompanyTimezoneOffset ===
</translate>
 
<translate>
 
=== getCompanyTimezoneOffset === <!--T:233-->


<!--T:234-->
<code>getCompanyTimezoneOffset()</code>
<code>getCompanyTimezoneOffset()</code>


<!--T:235-->
No arguments.
No arguments.
Returns array.
Returns array.


<!--T:236-->
Returns company timezone offset and company timezone
Returns company timezone offset and company timezone




<!--T:237-->
----
----


=== getCountryList ===
</translate>
 
<translate>
 
=== getCountryList === <!--T:238-->


<!--T:239-->
<code>getCountryList()</code>
<code>getCountryList()</code>


<!--T:240-->
No arguments.
No arguments.
Returns Array.
Returns Array.


<!--T:241-->
Get list of all countries
Get list of all countries




<!--T:242-->
----
----


=== getCountryPhoneCodes ===
</translate>
 
<translate>


=== getCountryPhoneCodes === <!--T:243-->
<!--T:244-->
<code>getCountryPhoneCodes()</code>
<code>getCountryPhoneCodes()</code>


<!--T:245-->
No arguments.
No arguments.
Returns Array.
Returns Array.


<!--T:246-->
Returns country phone code list
Returns country phone code list




<!--T:247-->
----
----


=== getCurrentTariffInfo ===
</translate>


<translate>
=== getCurrentTariffInfo === <!--T:248-->
<!--T:249-->
<code>getCurrentTariffInfo()</code>
<code>getCurrentTariffInfo()</code>


<!--T:250-->
No arguments.
No arguments.
Returns Array.
Returns Array.


<!--T:251-->
Returns all information about current tariff (subscription). For example:{
Returns all information about current tariff (subscription). For example:{
     "name" : "gold",
     "name" : "gold",
Line 770: Line 1,149:




<!--T:252-->
----
----


=== getCurrentUserDetails ===
</translate>
 
<translate>
 
=== getCurrentUserDetails === <!--T:253-->


<!--T:254-->
<code>getCurrentUserDetails()</code>
<code>getCurrentUserDetails()</code>


<!--T:255-->
No arguments. Returns Object.
No arguments. Returns Object.


<!--T:256-->
Returns an object with information about logged in user. Note: you are responsible for implementation of some
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
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:
rights but not all. There are 4 roles:


<!--T:257-->
* '''Administrator''' - have full access to the system
* '''Administrator''' - have full access to the system
* '''Senior Employee''' - have access to calendar, services and providers, and can modify bookings related with user
* '''Senior Employee''' - have access to calendar, services and providers, and can modify bookings related with user
Line 788: Line 1,176:




<!--T:258-->
<code>group</code> property can be one of the values:
<code>group</code> property can be one of the values:


<!--T:259-->
* <code>shop_user</code> - "Senior Employee" access role
* <code>shop_user</code> - "Senior Employee" access role
* <code>station_user</code> - "Junior Employee" access role
* <code>station_user</code> - "Junior Employee" access role
Line 797: Line 1,187:




<!--T:260-->
Example:
Example:


   {
   <!--T:261-->
{
     "id": 1,
     "id": 1,
     "login": admin,
     "login": admin,
Line 813: Line 1,205:




<!--T:262-->
----
----


=== getEventList ===
</translate>
 
<translate>


=== getEventList === <!--T:263-->
<!--T:264-->
<code>getEventList($isVisibleOnly, $asArray)</code>
<code>getEventList($isVisibleOnly, $asArray)</code>


<!--T:265-->
Parameters:
Parameters:


<!--T:266-->
* '''$isVisibleOnly''' Boolean  
* '''$isVisibleOnly''' Boolean  
* '''$asArray''' Boolean  
* '''$asArray''' Boolean  


<!--T:267-->
Returns Array.
Returns Array.


<!--T:268-->
Returns company's events list. If <code>$asArray</code> is false then method returns a map with event id as key
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
and details object as value. If parameter set to true then method returns a list sorted by 'position' property of
Line 831: Line 1,233:




<!--T:269-->
----
----


=== getFeedbacks ===
</translate>


<translate>
=== getFeedbacks === <!--T:270-->
<!--T:271-->
<code>getFeedbacks($approvedOnly, $reviewsOnly, $lastOnly, $limit)</code>
<code>getFeedbacks($approvedOnly, $reviewsOnly, $lastOnly, $limit)</code>


<!--T:272-->
Parameters:
Parameters:


<!--T:273-->
* '''$approvedOnly''' Boolean  
* '''$approvedOnly''' Boolean  
* '''$reviewsOnly''' Boolean  
* '''$reviewsOnly''' Boolean  
Line 844: Line 1,254:
* '''$limit''' Integer  
* '''$limit''' Integer  


<!--T:274-->
Returns Array.
Returns Array.


<!--T:275-->
Get list of feedbacks
Get list of feedbacks




<!--T:276-->
----
----


=== getFirstWorkingDay ===
</translate>
 
<translate>


=== getFirstWorkingDay === <!--T:277-->
<!--T:278-->
<code>getFirstWorkingDay($unitId)</code>
<code>getFirstWorkingDay($unitId)</code>


<!--T:279-->
Parameters:
Parameters:


<!--T:280-->
* '''$unitId''' Integer  
* '''$unitId''' Integer  


<!--T:281-->
Returns String.
Returns String.


<!--T:282-->
Returns first working date for unit
Returns first working date for unit




<!--T:283-->
----
----


=== getGoogleCalendarBusyTime ===
</translate>


<translate>
=== getGoogleCalendarBusyTime === <!--T:284-->
<!--T:285-->
<code>getGoogleCalendarBusyTime($startDateTime, $endDateTime, $unitId)</code>
<code>getGoogleCalendarBusyTime($startDateTime, $endDateTime, $unitId)</code>


<!--T:286-->
Parameters:
Parameters:


<!--T:287-->
* '''$startDateTime''' string a date and time string in format 'Y-m-d H:i:s'
* '''$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
* '''$endDateTime''' string a date and time string in format 'Y-m-d H:i:s'. You can date string avoiding time in
Line 877: Line 1,307:
* '''$unitId''' integer  
* '''$unitId''' integer  


<!--T:288-->
Returns Array.
Returns Array.


<!--T:289-->
Returns a list of objects represented a time intervals marked as busy in Google Calendar. Each object of result
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
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
[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
be returned. You should call <code>[[Company administration service methods#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
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
datetime string as value. Please note that this method may return not actual data because data synchronization
Line 895: Line 1,327:




<!--T:290-->
----
----


=== getGoogleCalendarBusyTimeAvailableUnits ===
</translate>


<code>getGoogleCalendarBusyTimeAvailableUnits()</code>
<translate>


=== getGoogleCalendarBusyTimeAvailableUnits === <!--T:291-->
<!--T:292-->
<code>getGoogleCalendarBusyTimeAvailableUnits()</code>
<!--T:293-->
No arguments.
No arguments.
Returns Array.
Returns Array.


<!--T:294-->
Returns configured unit ids, allowed to sync busy time
Returns configured unit ids, allowed to sync busy time




<!--T:295-->
----
----
</translate>
<translate>


=== getLastNotificationUpdate ===
=== getLastNotificationUpdate === <!--T:296-->


<!--T:297-->
<code>getLastNotificationUpdate($type)</code>
<code>getLastNotificationUpdate($type)</code>


<!--T:298-->
Parameters:
Parameters:


<!--T:299-->
* '''$type''' String  
* '''$type''' String  


<!--T:300-->
Returns String.
Returns String.


<!--T:301-->
Returns last update datetime
Returns last update datetime




<!--T:302-->
----
----


=== getLocationsList ===
</translate>
 
<translate>
 
=== getLocationsList === <!--T:303-->


<!--T:304-->
<code>getLocationsList($isPublic, $asArray)</code>
<code>getLocationsList($isPublic, $asArray)</code>


<!--T:305-->
Parameters:
Parameters:


<!--T:306-->
* '''$isPublic''' Boolean Optional. Default value is '''false'''.
* '''$isPublic''' Boolean Optional. Default value is '''false'''.
* '''$asArray''' boolean Optional. Default value is '''false'''.
* '''$asArray''' boolean Optional. Default value is '''false'''.


<!--T:307-->
Returns Array.
Returns Array.


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


<!--T:309-->
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
public locations. If '''asArray''' flag is '''true''' method returns list of objects. Otherwise method returns
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.
map of objects with object id as key. You can omit both parameters.


<!--T:310-->
----
----
</translate>
<translate>


=== getPluginList ===
=== getPluginList === <!--T:311-->


<!--T:312-->
<code>getPluginList()</code>
<code>getPluginList()</code>


<!--T:313-->
No arguments.
No arguments.
Returns Array.
Returns Array.


<!--T:314-->
Returns a list of all Custom Features associated with company with status.
Returns a list of all Custom Features associated with company with status.




<!--T:315-->
----
----


</translate>
<translate>
<!--T:316-->
<!---=== getPluginPromoInfoByCode ===
<!---=== getPluginPromoInfoByCode ===


<!--T:317-->
<code>getPluginPromoInfoByCode($code)</code>
<code>getPluginPromoInfoByCode($code)</code>


<!--T:318-->
Parameters:
Parameters:


<!--T:319-->
* '''$code'''   
* '''$code'''   


<!--T:320-->
Returns Array.
Returns Array.


<!--T:321-->
Returns an object with detailed information about Rewards and referrals 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 code not found then method returns an empty array (an empty object). If [[Rewards_and_Referrals_custom_feature|Rewards and Referrals Custom Feature]]
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
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>[[Company administration service methods#isPluginActivated|isPluginActivated('promo')]]</code> API method call to check if Custom Feature enabled. See [[Company administration service methods#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).
--->
--->
</translate>
----
----


=== getPluginStatuses ===
<translate>
 
=== getPluginStatuses === <!--T:322-->


<!--T:323-->
<code>getPluginStatuses($pluginNames)</code>
<code>getPluginStatuses($pluginNames)</code>


<!--T:324-->
Parameters:
Parameters:


<!--T:325-->
* '''$pluginNames''' Array  
* '''$pluginNames''' Array  


<!--T:326-->
Returns Array.
Returns Array.


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]].
<!--T:327-->
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]].
 


</translate>


----
----


=== getRecentActions ===
<translate>


=== getRecentActions === <!--T:328-->
<!--T:329-->
<code>getRecentActions($lastOnly, $limit)</code>
<code>getRecentActions($lastOnly, $limit)</code>


<!--T:330-->
Parameters:
Parameters:


<!--T:331-->
* '''$lastOnly''' Boolean  
* '''$lastOnly''' Boolean  
* '''$limit''' Integer  
* '''$limit''' Integer  


<!--T:332-->
Returns Array.
Returns Array.


<!--T:333-->
Returns latest actions
Returns latest actions


</translate>


----
----


=== getRecurringDatetimes ===
<translate>
 
 
=== getRecurringDatetimes === <!--T:334-->


<!--T:335-->
<code>getRecurringDatetimes($eventId, $unitId, $date, $time, $recurringData, $endDateTime)</code>
<code>getRecurringDatetimes($eventId, $unitId, $date, $time, $recurringData, $endDateTime)</code>


<!--T:336-->
Parameters:
Parameters:


<!--T:337-->
* '''$eventId''' Integer  
* '''$eventId''' Integer  
* '''$unitId''' Integer  
* '''$unitId''' Integer  
Line 1,019: Line 1,526:
* '''$endDateTime''' String (optional)
* '''$endDateTime''' String (optional)


<!--T:338-->
Returns Array.
Returns Array.


<!--T:339-->
Get list of dates for recurring booking
Get list of dates for recurring booking


</translate>


----
----


=== getRecurringSettings ===
<translate>
 
=== getRecurringSettings === <!--T:340-->


<!--T:341-->
<code>getRecurringSettings($eventId)</code>
<code>getRecurringSettings($eventId)</code>


<!--T:342-->
Parameters:
Parameters:


<!--T:343-->
* '''$eventId''' Integer  
* '''$eventId''' Integer  


<!--T:344-->
Returns Array.
Returns Array.


<!--T:345-->
Returns an object with recurring settings for an event. Returns false if specified event does not configured as
Returns an object with recurring settings for an event. Returns false if specified event does not configured as
recurring.
recurring.


<!--T:346-->
See also:
See also:


<!--T:347-->
* [http://blog.simplybook.me/recurring-and-periodic-bookings/ Recurring services desription]
* [http://blog.simplybook.me/recurring-and-periodic-bookings/ Recurring services desription]
</translate>


----
----


=== getRegistrations ===
<translate>


=== getRegistrations === <!--T:348-->
<!--T:349-->
<code>getRegistrations($groupBy)</code>
<code>getRegistrations($groupBy)</code>


<!--T:350-->
Parameters:
Parameters:


<!--T:351-->
* '''$groupBy''' String either 'day', 'week' or 'month'
* '''$groupBy''' String either 'day', 'week' or 'month'


<!--T:352-->
Returns Array.
Returns Array.


<!--T:353-->
Returns number of clients registrations  by 'day', 'week' or 'month'. A time period depends on selected
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
grouping parameter:* for 'day' methods returns statistics for last 31 days
Line 1,060: Line 1,591:
* for 'month' time period is last 12 months
* for 'month' time period is last 12 months


</translate>


----
----


=== getReservedTime ===
<translate>


=== getReservedTime === <!--T:354-->
<!--T:355-->
<code>getReservedTime($from, $to, $eventId, $unitId, $count)</code>
<code>getReservedTime($from, $to, $eventId, $unitId, $count)</code>


<!--T:356-->
Parameters:
Parameters:


<!--T:357-->
* '''$from''' String  
* '''$from''' String  
* '''$to''' String  
* '''$to''' String  
Line 1,075: Line 1,615:
* '''$count''' Integer  
* '''$count''' Integer  


<!--T:358-->
Returns Object.
Returns Object.


<!--T:359-->
Returns map of objects for each day in specified date range. The key of the result mps is a date string. The value
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
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]] 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]] 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 administration service methods#isPluginActivated|isPluginActivated('google_calendar_export')]]</code> API method to check if Calendar Sync Custom Feature activated.




<!--T:360-->
Example:
Example:
<pre>
<pre>
Line 1,108: Line 1,651:
</pre>
</pre>


</translate>


----
----


=== getReservedTimeIntervals ===
<translate>


=== getReservedTimeIntervals === <!--T:361-->
<!--T:362-->
<code>getReservedTimeIntervals($dateFrom, $dateTo, $eventId, $unitId, $count)</code>
<code>getReservedTimeIntervals($dateFrom, $dateTo, $eventId, $unitId, $count)</code>


<!--T:363-->
Parameters:
Parameters:


<!--T:364-->
* '''$dateFrom''' String  
* '''$dateFrom''' String  
* '''$dateTo''' String  
* '''$dateTo''' String  
Line 1,123: Line 1,675:
* '''$count''' Integer  
* '''$count''' Integer  


<!--T:365-->
Returns Object.
Returns Object.


<!--T:366-->
Returns not available time
Returns not available time
Eg.: <code>{'2014-05-14': [{'reserved_time': [{'from': '14:00', 'to': '16:30'}], 'type': "reserved_time"}, ...], ...}</code>
Eg.: <code>{'2014-05-14': [{'reserved_time': [{'from': '14:00', 'to': '16:30'}], 'type': "reserved_time"}, ...], ...}</code>


</translate>


----
----


=== getSocialCounterStats ===
<translate>
 
 
=== getSocialCounterStats === <!--T:367-->


<!--T:368-->
<code>getSocialCounterStats($provider)</code>
<code>getSocialCounterStats($provider)</code>


<!--T:369-->
Parameters:
Parameters:


<!--T:370-->
* '''$provider''' String  
* '''$provider''' String  


<!--T:371-->
Returns Integer.
Returns Integer.


<!--T:372-->
Returns social counters value for your domain
Returns social counters value for your domain


</translate>


----
----


=== getStartTimeMatrix ===
<translate>
 
 
=== getStartTimeMatrix === <!--T:373-->


<!--T:374-->
<code>getStartTimeMatrix($from, $to, $eventId, $unitId, $count)</code>
<code>getStartTimeMatrix($from, $to, $eventId, $unitId, $count)</code>


<!--T:375-->
Parameters:
Parameters:


<!--T:376-->
* '''$from''' String  
* '''$from''' String  
* '''$to''' String  
* '''$to''' String  
Line 1,158: Line 1,732:
* '''$count''' Integer  
* '''$count''' Integer  


<!--T:377-->
Returns Object.
Returns Object.


<!--T:378-->
Returns available start time, taking into account breaktimes, start and end working time
Returns available start time, taking into account breaktimes, start and end working time
Eg.: <code>{'2014-05-14': ['09:00:00', ...], ...}</code>
Eg.: <code>{'2014-05-14': ['09:00:00', ...], ...}</code>


<!--T:379-->
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.


</translate>


----
----


=== getStatuses ===
<translate>
 
 
=== getStatuses === <!--T:380-->


<!--T:381-->
<code>getStatuses()</code>
<code>getStatuses()</code>


<!--T:382-->
No arguments.
No arguments.
Returns Array.
Returns Array.


Returns list of available statuses or an empty list if [[Custom_Features#Status|Status Custom feature]] not enabled.
<!--T:383-->
Returns list of available statuses or an empty list if [[Custom Features#Status|Status Custom feature]] not enabled.
 


</translate>


----
----


=== getTimeframe ===
<translate>


=== getTimeframe === <!--T:384-->
<!--T:385-->
<code>getTimeframe()</code>
<code>getTimeframe()</code>


<!--T:386-->
No arguments.
No arguments.
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]].
<!--T:387-->
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]].
 
 


</translate>


----
----


=== getTimelineType ===
<translate>
 
 
=== getTimelineType === <!--T:388-->


<!--T:389-->
<code>getTimelineType()</code>
<code>getTimelineType()</code>


<!--T:390-->
No arguments.
No arguments.
Returns String.
Returns String.


<!--T:391-->
Returns company calendar layout type
Returns company calendar layout type


</translate>


----
----


=== getTopPerformers ===
<translate>


=== getTopPerformers === <!--T:392-->
<!--T:393-->
<code>getTopPerformers()</code>
<code>getTopPerformers()</code>


<!--T:394-->
No arguments.
No arguments.
Returns Array.
Returns Array.


<!--T:395-->
Returns a list with statistics for performers. This data contains number of bookings and revenues value for each performer.
Returns a list with statistics for performers. This data contains number of bookings and revenues value for each performer.


</translate>


----
----


=== getTopServices ===
<translate>


=== getTopServices === <!--T:396-->
<!--T:397-->
<code>getTopServices($dateStart, $dateEnd)</code>
<code>getTopServices($dateStart, $dateEnd)</code>


<!--T:398-->
Parameters:
Parameters:


<!--T:399-->
* '''$dateStart''' String  
* '''$dateStart''' String  
* '''$dateEnd''' String  
* '''$dateEnd''' String  


<!--T:400-->
Returns Array.
Returns Array.


<!--T:401-->
Returns a list with statistics for services for a period of time. This data contains number of bookings and
Returns a list with statistics for services for a period of time. This data contains number of bookings and
revenues value for each service.
revenues value for each service.




----


=== getUnitList ===
</translate>


----
<translate>
=== getUnitList === <!--T:402-->
<!--T:403-->
<code>getUnitList($isVisibleOnly, $asArray)</code>
<code>getUnitList($isVisibleOnly, $asArray)</code>


<!--T:404-->
Parameters:
Parameters:


<!--T:405-->
* '''$isVisibleOnly''' Boolean  
* '''$isVisibleOnly''' Boolean  
* '''$asArray''' Boolean  
* '''$asArray''' Boolean  


<!--T:406-->
Returns Array.
Returns Array.


<!--T:407-->
Returns list of service performers. If <code>$asArray</code> is false then method returns a map with event id as
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
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.
of event's details object.


</translate>


----
----


=== getUnitWorkdayInfo ===
<translate>
 
 
=== getUnitWorkdayInfo === <!--T:408-->


<!--T:409-->
<code>getUnitWorkdayInfo($dateStart, $dateEnd, $unitGroupId)</code>
<code>getUnitWorkdayInfo($dateStart, $dateEnd, $unitGroupId)</code>


<!--T:410-->
Parameters:
Parameters:


<!--T:411-->
* '''$dateStart''' string  
* '''$dateStart''' string  
* '''$dateEnd''' string  
* '''$dateEnd''' string  
* '''$unitGroupId''' integer  
* '''$unitGroupId''' integer  


<!--T:412-->
Returns Array.
Returns Array.


<!--T:413-->
Return workday info (date_start and date_end)
Return workday info (date_start and date_end)


</translate>


----
----


=== getUnitWorkingDurations ===
<translate>
 
 
=== getUnitWorkingDurations === <!--T:414-->


<!--T:415-->
<code>getUnitWorkingDurations($dateStart, $dateEnd, $unitGroupId)</code>
<code>getUnitWorkingDurations($dateStart, $dateEnd, $unitGroupId)</code>


<!--T:416-->
Parameters:
Parameters:


<!--T:417-->
* '''$dateStart''' string  
* '''$dateStart''' string  
* '''$dateEnd''' string  
* '''$dateEnd''' string  
* '''$unitGroupId''' integer  
* '''$unitGroupId''' integer  


<!--T:418-->
Returns Array.
Returns Array.


<!--T:419-->
Return working durations
Return working durations


</translate>


----
----


=== getVisitorStats ===
<translate>


=== getVisitorStats === <!--T:420-->
<!--T:421-->
<code>getVisitorStats($groupBy)</code>
<code>getVisitorStats($groupBy)</code>


<!--T:422-->
Parameters:
Parameters:


<!--T:423-->
* '''$groupBy''' String  
* '''$groupBy''' String  


<!--T:424-->
Returns Array.
Returns Array.


Returns statistics about page visits if Custom Feature [[Custom_Features#Visitor_Counter|Visitor Counter Custom Feature]] enabled. Returns
<!--T:425-->
an empty list if Custom Feature not enabled. Use <code>[[#isPluginActivated|isPluginActivated('counter')]]</code> API method
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>[[Company administration service methods#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
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
selected grouping parameter:* for 'day' methods returns statistics for last 31 days
Line 1,304: Line 1,972:
* for 'month' time period is last 12 months
* for 'month' time period is last 12 months


</translate>


----
----


=== getWarnings ===
<translate>
 
 
=== getWarnings === <!--T:426-->


<!--T:427-->
<code>getWarnings($lastOnly)</code>
<code>getWarnings($lastOnly)</code>


<!--T:428-->
Parameters:
Parameters:


<!--T:429-->
* '''$lastOnly'''  Boolean. Default value is '''false'''.
* '''$lastOnly'''  Boolean. Default value is '''false'''.


<!--T:430-->
Returns Array.
Returns Array.


<!--T:431-->
Returns a list of objects represented system warnings. Each warning contains <code>warning_type</code> and <code>warning_text</code>
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:
properties. <code>warning_text</code> property contains localized message. <code>warning_type</code> can be one of the values:


<!--T:432-->
* '''sms_limit''' – warning indicates low amount of SMS credits
* '''sms_limit''' – warning indicates low amount of SMS credits
* '''sheduler_limit''' – warning indicates low amount of available bookings
* '''sheduler_limit''' – warning indicates low amount of available bookings
</translate>


----
----


=== getWorkCalendar ===
<translate>


=== getWorkCalendar === <!--T:433-->
<!--T:434-->
<code>getWorkCalendar($year, $month, $unitId)</code>
<code>getWorkCalendar($year, $month, $unitId)</code>


<!--T:435-->
Parameters:
Parameters:


<!--T:436-->
* '''$year''' Integer  
* '''$year''' Integer  
* '''$month''' Integer  
* '''$month''' Integer  
* '''$unitId''' Integer  
* '''$unitId''' Integer  


<!--T:437-->
Returns Object.
Returns Object.


<!--T:438-->
Returns company work schedule as array
Returns company work schedule as array
Eg.: <code>{'2014-05-01': {'from': '09:00:00', 'to': '21:00:00', 'is_day_off': '0'}, '2014-05-02': ...}</code>
Eg.: <code>{'2014-05-01': {'from': '09:00:00', 'to': '21:00:00', 'is_day_off': '0'}, '2014-05-02': ...}</code>


</translate>


----
----


=== getWorkDaysInfo ===
<translate>


=== getWorkDaysInfo === <!--T:439-->
<!--T:440-->
<code>getWorkDaysInfo($from, $to, $unitId, $eventId, $count)</code>
<code>getWorkDaysInfo($from, $to, $unitId, $eventId, $count)</code>


<!--T:441-->
Parameters:
Parameters:


<!--T:442-->
* '''$from''' String  
* '''$from''' String  
* '''$to''' String  
* '''$to''' String  
Line 1,355: Line 2,055:
* '''$count''' Integer (optional)
* '''$count''' Integer (optional)


<!--T:443-->
Returns Object.
Returns Object.


<!--T:444-->
Returns an information about working hours and break times for specified service and performer for a period
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
between two dates. If only service specified then information about performer (or performers) will be taken from
Line 1,368: Line 2,070:
</pre>
</pre>


<!--T:445-->
Warning! Method can return a time string '24:00:00' as right edge of time range. This happens in case if time
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.
range finishes on midnight.


</translate>


----
----


=== getWorkDaysTimes ===
<translate>


<code>getWorkDaysTimes($startDateTime, $endDateTime, $type = 'unit_group')</code>


=== getWorkDaysTimes === <!--T:446-->
<!--T:447-->
<code>getWorkDaysTimes($startDateTime, $endDateTime, $type = 'unit_group')</code>
<!--T:448-->
Parameters:
Parameters:


<!--T:449-->
* '''$startDateTime''' string  
* '''$startDateTime''' string  
* '''$endDateTime''' string  
* '''$endDateTime''' string  
* '''$type''' string. Optional. Either 'unit_group' or 'event'.
* '''$type''' string. Optional. Either 'unit_group' or 'event'.


<!--T:450-->
Returns Array.
Returns Array.


<!--T:451-->
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.
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.
</translate>


----
----


=== getWorkload ===
<translate>
 
 
=== getWorkload === <!--T:452-->


<!--T:453-->
<code>getWorkload($dateStart, $dateEnd, $unitGroupId)</code>
<code>getWorkload($dateStart, $dateEnd, $unitGroupId)</code>


<!--T:454-->
Parameters:
Parameters:


<!--T:455-->
* '''$dateStart''' string  
* '''$dateStart''' string  
* '''$dateEnd''' string  
* '''$dateEnd''' string  
* '''$unitGroupId''' integer  
* '''$unitGroupId''' integer  


<!--T:456-->
Returns Array.
Returns Array.


<!--T:457-->
Return workload data for units in period of time. Workload for each unit represented as array with work hours
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:
at index 0, confirmed booking hours as load at index 1 and cancelled bookings hours at index 2.Example:
Line 1,411: Line 2,135:
   ] }]
   ] }]


</translate>


----
----


=== isPluginActivated ===
<translate>
 
 
=== isPluginActivated === <!--T:458-->


<!--T:459-->
<code>isPluginActivated($pluginName)</code>
<code>isPluginActivated($pluginName)</code>


<!--T:460-->
Parameters:
Parameters:


<!--T:461-->
* '''$pluginName''' String  
* '''$pluginName''' String  


<!--T:462-->
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_administration_service_methods#Custom_Features.27_identifiers|list of available plugin's names]].
<!--T:463-->
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 administration service methods#Custom Features.27 identifiers|list of available plugin's names]].
 
 


</translate>


----
----


=== pluginApproveBookingApprove ===
<translate>
 
 
=== pluginApproveBookingApprove === <!--T:464-->


<!--T:465-->
<code>pluginApproveBookingApprove($id)</code>
<code>pluginApproveBookingApprove($id)</code>


<!--T:466-->
Parameters:
Parameters:


<!--T:467-->
* '''$id''' Integer  
* '''$id''' Integer  


<!--T:468-->
Returns Array.
Returns Array.


Sets approve booking status to 'approved' if [[Custom_Features#Approve_Bookings|Approve booking]] Custom Feature enabled and returns
<!--T:469-->
list of approved booking IDs. Returns false if Custom Feature not enabled. Use <code>[[#isPluginActivated|isPluginActivated('approve_booking')]]</code>
Sets approve booking status to 'approved' if [[Custom Features#Approve Bookings|Approve booking]] Custom Feature enabled and returns
list of approved booking IDs. Returns false if Custom Feature not enabled. Use <code>[[Company administration service methods#isPluginActivated|isPluginActivated('approve_booking')]]</code>
API method call to check if Custom Feature enabled.
API method call to check if Custom Feature enabled.


</translate>


----
----


=== pluginApproveBookingCancel ===
<translate>
 
 
=== pluginApproveBookingCancel === <!--T:470-->


<!--T:471-->
<code>pluginApproveBookingCancel($id)</code>
<code>pluginApproveBookingCancel($id)</code>


<!--T:472-->
Parameters:
Parameters:


<!--T:473-->
* '''$id''' Integer  
* '''$id''' Integer  


<!--T:474-->
Returns Boolean.
Returns Boolean.


Sets approve booking status to 'canceled' if [[Custom_Features#Approve_Bookings|Approve bookings]] Custom Feature enabled and returns
<!--T:475-->
true. Returns false if Custom Feature not enabled. Use <code>[[#isPluginActivated|isPluginActivated('approve_booking')]]</code>
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>[[Company administration service methods#isPluginActivated|isPluginActivated('approve_booking')]]</code>
API method call to check if Custom Feature enabled.
API method call to check if Custom Feature enabled.


</translate>


----
----


=== pluginApproveGetPendingBookings ===
<translate>
 
 
=== pluginApproveGetPendingBookings === <!--T:476-->


<!--T:477-->
<code>pluginApproveGetPendingBookings()</code>
<code>pluginApproveGetPendingBookings()</code>


<!--T:478-->
No arguments.
No arguments.
Returns array.
Returns array.


Returns list of objects with information about bookings pending approval if [[Custom_Features#Approve_Bookings|Approve bookings]]
<!--T:479-->
Custom Feature enabled. Returns empty list if Custom Feature not enabled. Use <code>[[#isPluginActivated|isPluginActivated('approve_booking')]]</code>
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>[[Company administration service methods#isPluginActivated|isPluginActivated('approve_booking')]]</code>
API method call to check if Custom Feature enabled.
API method call to check if Custom Feature enabled.


</translate>


----
----


=== pluginApproveGetPendingBookingsCount ===
<translate>
 
 
=== pluginApproveGetPendingBookingsCount === <!--T:480-->


<!--T:481-->
<code>pluginApproveGetPendingBookingsCount()</code>
<code>pluginApproveGetPendingBookingsCount()</code>


<!--T:482-->
No arguments.
No arguments.
Returns Integer.
Returns Integer.


Returns count of bookings pending approval if [[Custom_Features#Approve_Bookings|Approve bookings]] Custom Feature enabled. Returns
<!--T:483-->
0 if Custom Feature not enabled. Use <code>[[#isPluginActivated|isPluginActivated('approve_booking')]]</code> API method
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>[[Company administration service methods#isPluginActivated|isPluginActivated('approve_booking')]]</code> API method
call to check if Custom Feature enabled.
call to check if Custom Feature enabled.


</translate>


----
----


=== setBookingComment ===
<translate>


=== setBookingComment === <!--T:484-->
<!--T:485-->
<code>setBookingComment($id, $comment)</code>
<code>setBookingComment($id, $comment)</code>


<!--T:486-->
Parameters:
Parameters:


<!--T:487-->
* '''$id''' Integer  
* '''$id''' Integer  
* '''$comment''' String  
* '''$comment''' String  


<!--T:488-->
Returns Integer.
Returns Integer.


<!--T:489-->
Set booking comment
Set booking comment


</translate>


----
----
=== getBookingStatus ===


<translate>
=== getBookingStatus === <!--T:490-->
<!--T:491-->
<code>getBookingStatus ($bookingId)</code>
<code>getBookingStatus ($bookingId)</code>


<!--T:492-->
Parameters:
Parameters:


<!--T:493-->
* '''$bookingId''' Integer  
* '''$bookingId''' Integer  


<!--T:494-->
Returns Array.
Returns Array.


<!--T:495-->
Returns an object of status of given booking (if status plugin is enabled)
Returns an object of status of given booking (if status plugin is enabled)
default status will be returned if bookingId does not exists
default status will be returned if bookingId does not exists
</translate>


----
----


=== setStatus ===
<translate>
 
 
=== setStatus === <!--T:496-->


<!--T:497-->
<code>setStatus($bookingId, $statusId)</code>
<code>setStatus($bookingId, $statusId)</code>


<!--T:498-->
Parameters:
Parameters:


<!--T:499-->
* '''$bookingId''' Integer  
* '''$bookingId''' Integer  
* '''$statusId''' Integer  
* '''$statusId''' Integer  


<!--T:500-->
Returns Boolean.
Returns Boolean.


<!--T:501-->
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 [[Custom_Features#Status|Status Custom feature]] not enabled.
bookings. This method does nothing if [[Custom Features#Status|Status Custom feature]] not enabled.
 
 


</translate>


----
----


=== updateNotification ===
<translate>
 
 
=== updateNotification === <!--T:502-->


<!--T:503-->
<code>updateNotification($type)</code>
<code>updateNotification($type)</code>


<!--T:504-->
Parameters:
Parameters:


<!--T:505-->
* '''$type''' String  
* '''$type''' String  


<!--T:506-->
Returns .
Returns .


<!--T:507-->
Mark notifications as readed
Mark notifications as readed


</translate>


----
----


=== setWorkDayInfo===
<translate>
 


=== setWorkDayInfo=== <!--T:508-->
<!--T:509-->
<code>setWorkDayInfo($info)</code>
<code>setWorkDayInfo($info)</code>


<!--T:510-->
Parameters:
Parameters:


<!--T:511-->
* '''$info''' Array
* '''$info''' Array


<!--T:512-->
Returns true on success
Returns true on success


<!--T:513-->
Set work day schedule for company|service|provider for week_day|date
Set work day schedule for company|service|provider for week_day|date


<!--T:514-->
Example:
Example:
<pre>
<pre>
Line 1,579: Line 2,410:
}
}


<!--T:515-->
index is 1-7 for Monday - Sunday (used for weekly settings)
index is 1-7 for Monday - Sunday (used for weekly settings)
date is used to set worktime for special date
date is used to set worktime for special date
Line 1,585: Line 2,417:
if unit_group_id and event_id not passed then it set data for company
if unit_group_id and event_id not passed then it set data for company
</pre>
</pre>
</translate>


----
----


=== deleteSpecialDay===
<translate>
 
 
=== deleteSpecialDay=== <!--T:516-->


<!--T:517-->
<code>deleteSpecialDay($date, $params = null)</code>
<code>deleteSpecialDay($date, $params = null)</code>


<!--T:518-->
Parameters:
Parameters:


<!--T:519-->
* '''$date''' String
* '''$date''' String
* '''$params''' Array
* '''$params''' Array


<!--T:520-->
Returns true on success
Returns true on success


<!--T:521-->
Delete special date if set
Delete special date if set


<!--T:522-->
Example:
Example:
<pre>
<pre>
Line 1,609: Line 2,453:
}
}
</pre>
</pre>
</translate>


----
----
=== addServiceProvider===


<translate>
=== addServiceProvider=== <!--T:523-->
<!--T:524-->
<code>addServiceProvider($data)</code>
<code>addServiceProvider($data)</code>


<!--T:525-->
Parameters:
Parameters:


<!--T:526-->
* '''$data''' Array
* '''$data''' Array


<!--T:527-->
Returns Array with result and id of new service provider (unit_group)
Returns Array with result and id of new service provider (unit_group)


<!--T:528-->
Create new service provider
Create new service provider


<!--T:529-->
Example:
Example:
<pre>
<pre>
Line 1,638: Line 2,494:
}
}
</pre>
</pre>
</translate>


----
----


=== editServiceProvider===
<translate>
 


=== editServiceProvider=== <!--T:530-->
<!--T:531-->
<code>editServiceProvider($id, $data)</code>
<code>editServiceProvider($id, $data)</code>


<!--T:532-->
Parameters:
Parameters:


<!--T:533-->
* '''$id''' Integer
* '''$id''' Integer
* '''$data''' Array
* '''$data''' Array


<!--T:534-->
Returns Array with result and id of new service provider (unit_group)
Returns Array with result and id of new service provider (unit_group)


<!--T:535-->
Edit service provider
Edit service provider
(there is no way to delete provider via API, in this case set is_active = 0)
(there is no way to delete provider via API, in this case set is_active = 0)




<!--T:536-->
Example:
Example:
<pre>
<pre>
Line 1,672: Line 2,540:
}
}
</pre>
</pre>
<!--T:537-->
-
</translate>


----
----


== Constants ==
<translate>


=== Error codes ===


== Constants == <!--T:538-->
=== Error codes === <!--T:539-->
<!--T:540-->
See [[Errors handling]] for details.
See [[Errors handling]] for details.


<!--T:541-->
* -32001 Custom Feature is not activated
* -32001 Custom Feature is not activated
* -32010 Some required params are missed
* -32010 Some required params are missed
Line 1,720: Line 2,597:
* -32603 Internal error
* -32603 Internal error
* -3264 Client with given id not found
* -3264 Client with given id not found
</translate>


----
----


===Company params===
<translate>


Use these values to get configuration params for company with <code>[[#getCompanyParam|getCompanyParam]]</code> API method.


=====General params=====
===Company params=== <!--T:542-->


Administration API inherits all [[Company public service methods#Company_params|keys]] allowed for public API and extends this list with keys:
<!--T:543-->
Use these values to get configuration params for company with <code>[[Company administration service methods#getCompanyParam|getCompanyParam]]</code> API method.


=====General params===== <!--T:544-->
<!--T:545-->
Administration API inherits all [[Company public service methods#Company params|keys]] allowed for public API and extends this list with keys:
<!--T:546-->
* attach_ical
* attach_ical
* auto_redirect
* auto_redirect
Line 1,863: Line 2,749:
* waiting_video
* waiting_video


=====Accept payments Custom Feature params=====
</translate>
 
----
 
<translate>


Read more about [[Custom_Features#Accept_Payments|Accept Payments Custom Feature configuration]].
=====Accept payments Custom Feature params===== <!--T:547-->


<!--T:548-->
Read more about [[Custom Features#Accept Payments|Accept Payments Custom Feature configuration]].
<!--T:549-->
* allow_delay_payment
* allow_delay_payment
*: Allow delay payment option. Boolean.
*: Allow delay payment option. Boolean.
Line 1,896: Line 2,790:
* liqpay_merchant_pass
* liqpay_merchant_pass


=====Term & Conditions Custom Feature params=====
</translate>
 
----
 
<translate>


Read more about [[Custom_Features#Terms_and_Conditions|Terms and Conditions Custom Feature]].
=====Term & Conditions Custom Feature params===== <!--T:550-->


<!--T:551-->
Read more about [[Custom Features#Terms and Conditions|Terms and Conditions Custom Feature]].
<!--T:552-->
* user_license_text
* user_license_text
*: Terms and conditions text. String.
*: Terms and conditions text. String.
</translate>


----
----


===Custom Features' identifiers===
<translate>
 
 
===Custom Features' identifiers=== <!--T:553-->


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


<!--T:555-->
* advanced_notification
* advanced_notification
*:Book Soon notification system
*:Book Soon notification system
Line 1,972: Line 2,882:
*:Cancellation Policy
*:Cancellation Policy


See [[Custom_Features|Custom Features]] page for description for each Custom Feature.
<!--T:556-->
See [[Custom Features]] page for description for each Custom Feature.


----
</translate>


== Examples ==
<translate>
== Examples == <!--T:557-->


====getBookingDetails response====
====getBookingDetails response==== <!--T:558-->


An example of data returned by [[#getBookingDetails|getBookingDetails]] API method.
<!--T:559-->
An example of data returned by [[Company administration service methods#getBookingDetails|getBookingDetails]] API method.


   {
   <!--T:560-->
{
     "id": "321",
     "id": "321",
     "event_id": "5",
     "event_id": "5",
Line 2,049: Line 2,963:
   }
   }


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


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


<!--T:561-->
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.
<!--T:562-->
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.
<!--T:563-->
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.
<!--T:564-->
<!--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.
<!--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.
<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.
 
 
</translate>


----
----


====book response====
<translate>
 
 
====book response==== <!--T:565-->


[[#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.
<!--T:566-->
[[Company administration 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.


   {
   <!--T:567-->
{
     "require_confirm":false,
     "require_confirm":false,
     "bookings":[
     "bookings":[
Line 2,118: Line 3,049:
   }
   }


====getCompanyInfo response====
</translate>


An example of data returned by [[#getCompanyInfo|getCompanyInfo]] API method.
----


   {
<translate>
 
====getCompanyInfo response==== <!--T:568-->
 
<!--T:569-->
An example of data returned by [[Company administration service methods#getCompanyInfo|getCompanyInfo]] API method.
 
   <!--T:570-->
{
     "login": "pierrecoetzee",
     "login": "pierrecoetzee",
     "name": "Pierre",
     "name": "Pierre",
Line 2,147: Line 3,086:
   }
   }


<!--T:571-->
<code>timeline_type</code> field can be one the following values:
<code>timeline_type</code> field can be one the following values:


<!--T:572-->
* flexible
* flexible
* modern
* modern
Line 2,156: Line 3,097:
* classes
* classes


</translate>


<translate>
<!--T:573-->
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.


<!--T:574-->
<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]].
<!--T:575-->
For information about <code> timeframe</code>, <code>timezone</code>, <code>allow_event_day_break</code> and <code>allow_event_breaktime_break</code> see [[Company administration service methods#Company params|Company params section]].
 
</translate>
----
----


<translate>
<!--T:576-->
<!--====getPluginPromoInfoByCode response====
<!--====getPluginPromoInfoByCode response====


   {
   <!--T:577-->
{
     "id": "1",
     "id": "1",
     "title": "[service\/services] with [discount]% discount!",
     "title": "[service\/services] with [discount]% discount!",
Line 2,191: Line 3,143:
   }
   }


<!--T:578-->
<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.
-->
</translate>