Changes

From SimplyBook.me
no edit summary
Line 64: Line 64:  
* '''$unitId''' Integer  
 
* '''$unitId''' Integer  
 
* '''$clientId''' Integer  
 
* '''$clientId''' Integer  
* '''$startDate'''
+
* '''$startDate''' string a date string in format 'Y-m-d'
* '''$startTime'''
+
* '''$startTime''' string a time string in format 'H:i:s'
* '''$endDate''' null
+
* '''$endDate''' string a date string in format 'Y-m-d'
* '''$endTime''' null
+
* '''$endTime''' string a time string in format 'H:i:s'
 
* '''$clientTimeOffset''' Integer  
 
* '''$clientTimeOffset''' Integer  
 
* '''$additional''' array|Object - additional params and fields.
 
* '''$additional''' array|Object - additional params and fields.
* '''$count''' Integer - bookings count, min. 1 (using for group bookings batch). (optional)
+
* '''$count''' Integer bookings count used to make group bookings batch. This parameter can't be less than 1. (optional)
* '''$batchId''' Integer - add booking to multiple bookings batch. (optional)
+
* '''$batchId''' Integer add booking to group bookings batch. You can't use $count and $batchId in one call. Please specify only one parameter. (optional)
 
* '''$recurringData''' Array - make booking recurrent. (optional)
 
* '''$recurringData''' Array - make booking recurrent. (optional)
   Line 78: Line 78:  
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>. To create batch booking you can specify either <code>count</code> more then
+
<code>require_confirm = true</code>. <code>$startDate</code> and <code>$startTime</code> specifies a date of
1 or valid <code>batchId</code> (only one parameter can be specified). You should specify an <code>$additionalFields</code>
+
booking and time slot. Time value should be multiple to 'timeframe' configuration of company (see
parameter if service requires some additional fields (see [[Plugins#Additional fields|Additional fields plugin]]). To
+
[[#getTimeframe|<code>getTimeframe</code>]] API method). <code>$endDate</code> and <code>$endTime</code> parameters
create a booking with promo code you should pass it as additional field. For
+
should be calculated according to service duration. However you can specify different values to make appointment
example: <code>{"name": "promocode", "value": "some code", "type": "text"}</code>
+
longer or shorter then service configuration. Note that <code>$endDate</code> and <code>$endTime</code> should be
 +
later in time than <code>$startDate</code> and <code>$startTime</code>. If your clients located in different time
 +
zone you should specify <code>$clientTimeOffset</code> parameter as difference between company's time zone and
 +
client's time zone in seconds. For example if company located in city with time zone GMT+2 and customer located
 +
in city with GMT+3 then <code>$clientTimeOffset</code> will be -3600 seconds. You can get information about company's
 +
time zone using [[#getCompanyInfo|<code>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
 +
specified). You should specify an <code>$additionalFields</code> parameter if service requires some additional
 +
fields (see [[Plugins#Additional fields|Additional fields plugin]]). To create a booking with promo code you
 +
should pass it as additional field. For example: <code>{"name": "promocode", "value": "some code", "type": "text"}</code>See [[#book response|example]] of <code>book</code> API method response.
      Line 169: Line 178:  
Parameters:
 
Parameters:
   −
* '''$shedulerId''' Integer  
+
* '''$shedulerId''' Integer an id of booking to edit. See [[#book|&lt;code&gt;book&lt;/code&gt;]] or [[#getBookings|&lt;code&gt;getBookings&lt;/code&gt;]] API methods.
 
* '''$eventId''' Integer  
 
* '''$eventId''' Integer  
 
* '''$unitId''' Integer  
 
* '''$unitId''' Integer  
Line 182: Line 191:  
Returns Object.
 
Returns Object.
   −
Edit existing booking record. See [[#book|book]] API method description for more details about additional fields.
+
Edit existing booking record. See [[#book|book]] API method description for more details about date/time parameters,
 +
time zone handling and additional fields.
      Line 253: Line 263:  
Returns Array.
 
Returns Array.
   −
Returns list of available unit ids for present data 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>
      Line 348: Line 358:  
Parameters:
 
Parameters:
   −
* '''$dateStart''' String a date string in format 'Y-m-d'
+
* '''$dateStart''' string a date string in format &#039;Y-m-d&#039;.
* '''$dateEnd''' String a date string in format 'Y-m-d'
+
* '''$dateEnd''' string a date string in format &#039;Y-m-d&#039;
 
* '''$unitGroupId''' integer  
 
* '''$unitGroupId''' integer  
 
* '''$serviceId''' integer  
 
* '''$serviceId''' integer  
Line 357: Line 367:  
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
by unit or by service.Example:
+
by unit or by service. Set <code>$dateStart</code> and <code>$dateEnd</code> to null to get data for current week.Example:
 
   ['2015-11-12' : {
 
   ['2015-11-12' : {
 
     3 : [
 
     3 : [
Line 405: Line 415:  
* '''client_id''' an integer. Use it to get bookings only for certain client.
 
* '''client_id''' an integer. Use it to get bookings only for certain client.
 
* '''order''' string either 'record_date', 'date_start' or 'date_start_asc'. By default used 'date_start' value.
 
* '''order''' string either 'record_date', 'date_start' or 'date_start_asc'. By default used 'date_start' value.
* '''booking_type''' a string. Value of this fiend depends on Approve booking plugin.
+
* '''booking_type''' a string. Value of this field depends on Approve booking plugin status.
If plugin not active:
+
*: If plugin not active:
 
** '''all''' for all bookings (default value)
 
** '''all''' for all bookings (default value)
 
** '''cancelled''' alias to 'is_confirmed' equal to 0
 
** '''cancelled''' alias to 'is_confirmed' equal to 0
 
** '''non_cancelled''' alias to 'is_confirmed' equal to 1
 
** '''non_cancelled''' alias to 'is_confirmed' equal to 1
If plugin active:
+
*: If plugin active:
 
** '''all''' for all bookings (default value)
 
** '''all''' for all bookings (default value)
 
** '''cancelled''' returns bookings with 'is_confirmed' field equals to 0 and approve booking status equals to 'cancelled' (or booking does not have any approve status)
 
** '''cancelled''' returns bookings with 'is_confirmed' field equals to 0 and approve booking status equals to 'cancelled' (or booking does not have any approve status)
Line 583: Line 593:  
Returns Array.
 
Returns Array.
   −
Returns all information about current tariff (subscription). For example:{
+
Returns all information about current tariff (subscription). For example:
 +
  {
 
     "name" : "gold",
 
     "name" : "gold",
 
     "expire_date" : "2016-02-11 12:32:00",
 
     "expire_date" : "2016-02-11 12:32:00",
Line 1,223: Line 1,234:  
* -32603 Internal error
 
* -32603 Internal error
 
* -3264 Client with given id not found
 
* -3264 Client with given id not found
 +
 +
----
    
===Company params===
 
===Company params===
Line 1,526: Line 1,539:     
<code>additional_fields</code> field is present in response only if [[Plugins#Additional fields|Additional fields plugin]] is enabled. Otherwise this field will be an empty array. This field contains an empty array if plugin is enabled but booking was created for a service with no additional fields.
 
<code>additional_fields</code> field is present in response only if [[Plugins#Additional fields|Additional fields plugin]] is enabled. Otherwise this field will be an empty array. This field contains an empty array if plugin is enabled but booking was created for a service with no additional fields.
 +
 +
====book response====
 +
 +
[[#book|<code>book</code>]] API method returns an object which contains list of objects with short description of newly create bookings. Method returns only one item in 'bookings' array for regular bookings and more than one item for recurring or batch bookings.
 +
 +
  {
 +
    "require_confirm":false,
 +
    "bookings":[
 +
      {
 +
        "id":"434",
 +
        "event_id":"7",
 +
        "unit_id":"3",
 +
        "client_id":"34",
 +
        "start_date_time":"2015-12-30 13:00:00",
 +
        "end_date_time":"2015-12-30 13:30:00",
 +
        "is_confirmed":"1",
 +
        "code":"h8vc14ca",
 +
        "hash":"785cb8cce316e64765b94c05a635f4be"
 +
      },
 +
      {
 +
        "id":"435",
 +
        "event_id":"7",
 +
        "unit_id":"3",
 +
        "client_id":"34",
 +
        "start_date_time":"2015-12-31 13:00:00",
 +
        "end_date_time":"2015-12-31 13:30:00",
 +
        "is_confirmed":"1",
 +
        "code":"h8vc2pge",
 +
        "hash":"8b92d634541bfd93c0830967e56f4653"
 +
      },
 +
      {
 +
        "id":"436",
 +
        "event_id":"7",
 +
        "unit_id":"3",
 +
        "client_id":"34",
 +
        "start_date_time":"2016-01-04 13:00:00",
 +
        "end_date_time":"2016-01-04 13:30:00",
 +
        "is_confirmed":"1",
 +
        "code":"h8vc3urb",
 +
        "hash":"cd22a0bf183f7350e595988dd2486e5b"
 +
      },
 +
      {
 +
        "id":"437",
 +
        "event_id":"7",
 +
        "unit_id":"3",
 +
        "client_id":"34",
 +
        "start_date_time":"2016-01-05 13:00:00",
 +
        "end_date_time":"2016-01-05 13:30:00",
 +
        "is_confirmed":"1",
 +
        "code":"h8vc44d9",
 +
        "hash":"53f98ff4e4a0323aa907156c59c99362"
 +
      }
 +
    ],
 +
    "batch_type":"batch_recurrent_booking",
 +
    "recurrent_batch_id":"1",
 +
    "batch_hash":"357178bce290381bb7235080941ec143"
 +
  }