Company administration service methods: Difference between revisions
No edit summary |
|||
| Line 83: | Line 83: | ||
===Authentication=== | ===Authentication=== | ||
Using Simplybook API methods require an authentification. To authorize in Simplybook API you need to get an access key — access-token. In order to get this access-token you should call the JSON-RPC method <code>[[Authentication#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 ' | 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 == | ||
| Line 178: | Line 178: | ||
specify either <code>count</code> more then 1 or valid <code>batchId</code> (only one parameter can be | specify either <code>count</code> more then 1 or valid <code>batchId</code> (only one parameter can be | ||
specified). You should specify an <code>$additionalFields</code> parameter if service requires some additional | specified). You should specify an <code>$additionalFields</code> parameter if service requires some additional | ||
fields (see [[ | fields (see [[Custom_Features#Additional_Fields|Additional Fields Custom feature]]).To create a booking with promo code you should pass it as additional field. For example: <code>{"promocode": "some code"}</code> | ||
If [[ | If [[Custom_Features#Unit_Location|Unit location]] enabled you need to pass locations ID parameter as additional field | ||
<code>location_id</code>. For example: <code>{"location_id": "1"}</code>. Use <code>[[#isPluginActivated|isPluginActivated('location')]]</code> | <code>location_id</code>. For example: <code>{"location_id": "1"}</code>. Use <code>[[#isPluginActivated|isPluginActivated('location')]]</code> | ||
to check if | to check if Custom feature active and <code>[[#getLocationsList|getLocationsList()]]</code> method to get list of | ||
available locations. | available locations. | ||
| Line 326: | Line 326: | ||
Returns Array. | Returns Array. | ||
Returns list of available unit ids for specified date and service from provided $unitIds list.You can use this method with location | 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. | ||
Eg.: <code>[1, 2, 3]</code> | Eg.: <code>[1, 2, 3]</code> | ||
| Line 343: | Line 343: | ||
Returns Array. | Returns Array. | ||
Return additional fields for certain event if [[ | Return additional fields for certain event if [[Custom_Features#Additional_Fields|Additional Fields Custom Feature]] is | ||
activated. Returns empty array otherwise. Call <code>[[#isPluginActivated|isPluginActivated('event_field')]]</code> | activated. Returns empty array otherwise. Call <code>[[#isPluginActivated|isPluginActivated('event_field')]]</code> | ||
API method to check if 'event_field' | API method to check if 'event_field' Custom Feature activated. | ||
| Line 357: | Line 357: | ||
Returns Object|null. | Returns Object|null. | ||
Returns information about [[ | Returns information about [[Custom_Features#Any_Employee_Selector|Any Employee selector Custom Feature]] configuration. Returns | ||
null if | null if Custom Feature not enabled.Example: | ||
{ | { | ||
"description" : "Select this option, if you want to find an available time with any of the employees", | "description" : "Select this option, if you want to find an available time with any of the employees", | ||
| Line 486: | Line 486: | ||
Returns Array. | Returns Array. | ||
Returns time intervals not available for bookings because of configuration of [[ | 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. | |||
| Line 553: | Line 553: | ||
* '''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 [[ | * '''is_confirmed''' 1 or 0. If [[Custom_Features#Approve_Bookings|Approve booking]] Custom Feature enabled then method will return confirmed bookings with approve status 'new'. | ||
* '''client_id''' an integer. Use it to get bookings only for certain client. | * '''client_id''' an integer. Use it to get bookings only for certain client. | ||
* '''order''' string either 'record_date', 'date_start' or 'date_start_asc'. By default used 'date_start' value. | * '''order''' string either 'record_date', 'date_start' or 'date_start_asc'. By default used 'date_start' value. | ||
* '''booking_type''' a string. Value of this field depends on Approve booking | * '''booking_type''' a string. Value of this field depends on Approve booking Custom Feature status. | ||
*: If | *: If Custom Feature not active: | ||
** '''all''' for all bookings (default value) | ** '''all''' for all bookings (default value) | ||
** '''cancelled''' alias to 'is_confirmed' equal to 0 | ** '''cancelled''' alias to 'is_confirmed' equal to 0 | ||
** '''non_cancelled''' alias to 'is_confirmed' equal to 1 | ** '''non_cancelled''' alias to 'is_confirmed' equal to 1 | ||
*: If | *: If Custom Feature active: | ||
** '''all''' for all bookings (default value) | ** '''all''' for all bookings (default value) | ||
** '''cancelled''' returns bookings with 'is_confirmed' field equals to 0 and approve booking status equals to 'cancelled' (or booking does not have any approve status) | ** '''cancelled''' returns bookings with 'is_confirmed' field equals to 0 and approve booking status equals to 'cancelled' (or booking does not have any approve status) | ||
| Line 604: | Line 604: | ||
Returns Array. | Returns Array. | ||
Returns company categories list if [[ | Returns company categories list if [[Custom_Features#Service_Categories|Service Categories Custom Feature]] is activated. Returns | ||
an error with code -32001 if | an error with code -32001 if Custom Feature is not activated. Use <code>[[#isPluginActivated|isPluginActivated('event_category')]]</code> | ||
API method to check if | API method to check if Custom Feature activated. | ||
| Line 882: | Line 882: | ||
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#Google_Calendar_Sync|Google 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>[[#isPluginActivated|isPluginActivated('google_calendar_export')]]</code> to | ||
check status of the | 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 | ||
between server and Google Calendar may take some time and synchronized data are cached for 15 minutes.Example: | between server and Google Calendar may take some time and synchronized data are cached for 15 minutes.Example: | ||
| Line 936: | Line 936: | ||
Returns Array. | Returns Array. | ||
Returns available locations for company if | Returns available locations for company if Custom Feature [[Custom_Features#Unit_Location|Unit location Custom Feature]] is activated. Return | ||
an error with code -32001 if | an error with code -32001 if Custom Feature is not activated. Use <code>[[#isPluginActivated|isPluginActivated('location')]]</code> | ||
API method to check if | API method to check if Custom Feature activated. | ||
This method accepts two boolean flags as parameters. If '''isPublic''' flag is '''true''' then method returns only | This method accepts two boolean flags as parameters. If '''isPublic''' flag is '''true''' then method returns only | ||
| Line 953: | Line 953: | ||
Returns Array. | Returns Array. | ||
Returns a list of all | Returns a list of all Custom Features associated with company with status. | ||
| Line 970: | Line 970: | ||
Returns an object with detailed information about promotion by promotion code. You can get promotion code | Returns an object with detailed information about promotion by promotion code. You can get promotion code | ||
using <code>[[Catalogue#getPromotionList|getPromotionList]]</code> API method. If promotion record with specified | using <code>[[Catalogue#getPromotionList|getPromotionList]]</code> API method. If promotion record with specified | ||
code not found then method returns an empty array (an empty object). If [[ | code not found then method returns an empty array (an empty object). If [[Custom_Features#Simply_Smart_Promotions|Simply Smart Promotions Custom Feature]] | ||
not enabled then method returns an error with code -32001 ( | 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 | <code>[[#isPluginActivated|isPluginActivated('promo')]]</code> API method call to check if Custom Feature enabled.See [[#getPromotionList response|example]] of <code>getPromotionList</code> API method response. Please note that | ||
response contains a list of services for wich promotion discount can be applied (<code>service_ids</code> key). | response contains a list of services for wich promotion discount can be applied (<code>service_ids</code> key). | ||
| Line 988: | Line 988: | ||
Returns Array. | Returns Array. | ||
Return | Return Custom Feature status true if status active, else false. See [[#Plugin's identifiers|list of available plugin's names]]. | ||
| Line 1,083: | Line 1,083: | ||
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 [[ | by clients. Nobody knows what kind of data represented by <code>not_worked_time</code> type. Please don't use it.If [[Custom_Features#Google_Calendar_Sync|Google 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 Google | <code>[[#isPluginActivated|isPluginActivated('google_calendar_export')]]</code> API method to check if Google | ||
calendar sync | calendar sync Custom Feature activated. | ||
| Line 1,167: | Line 1,167: | ||
Eg.: <code>{'2014-05-14': ['09:00:00', ...], ...}</code> | Eg.: <code>{'2014-05-14': ['09:00:00', ...], ...}</code> | ||
If locations | 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 [[ | units available only for selected location. See [[Custom_Features#Unit_Location|Unit location]] Custom Feature description for | ||
more details. | more details. | ||
| Line 1,181: | Line 1,181: | ||
Returns Array. | Returns Array. | ||
Returns list of available statuses or an empty list if [[ | Returns list of available statuses or an empty list if [[/Custom_Features#Status|Status Custom feature]] not enabled. | ||
| Line 1,301: | Line 1,301: | ||
Returns Array. | Returns Array. | ||
Returns statistics about page visits if | Returns statistics about page visits if Custom Feature [[Custom_Features#Visitor_Counter|Visitor Counter Custom Feature]] enabled. Returns | ||
an empty list if | an empty list if Custom Feature not enabled. Use <code>[[#isPluginActivated|isPluginActivated('counter')]]</code> API method | ||
call to check if | 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 | ||
* for 'week' methods returns data last 10 weeks period | * for 'week' methods returns data last 10 weeks period | ||
| Line 1,390: | Line 1,390: | ||
Returns Array. | Returns Array. | ||
Return busy time by unit id by GoogleCalendar | Return busy time by unit id by GoogleCalendar Custom Feature if enabled. Please note that this method may return not actual data because data synchronization between server and Google Calendar may take some time and synchronized data are cached for 15 minutes. | ||
---- | ---- | ||
| Line 1,428: | Line 1,428: | ||
Returns Boolean. | Returns Boolean. | ||
Return | 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 [[#Plugin's identifiers|list of available plugin's names]]. | ||
| Line 1,443: | Line 1,443: | ||
Returns Array. | Returns Array. | ||
Sets approve booking status to 'approved' if [[ | 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 | list of approved booking IDs. Returns false if Custom Feature not enabled. Use <code>[[#isPluginActivated|isPluginActivated('approve_booking')]]</code> | ||
API method call to check if | API method call to check if Custom Feature enabled. | ||
| Line 1,460: | Line 1,460: | ||
Returns Boolean. | Returns Boolean. | ||
Sets approve booking status to 'canceled' if [[ | Sets approve booking status to 'canceled' if [[Custom_Features#Approve_Bookings|Approve bookings]] Custom Feature enabled and returns | ||
true. Returns false if | true. Returns false if Custom Feature not enabled. Use <code>[[#isPluginActivated|isPluginActivated('approve_booking')]]</code> | ||
API method call to check if | API method call to check if Custom Feature enabled. | ||
| Line 1,474: | Line 1,474: | ||
Returns array. | Returns array. | ||
Returns list of objects with information about bookings pending approval if [[ | Returns list of objects with information about bookings pending approval if [[Custom_Features#Approve_Bookings|Approve bookings]] | ||
Custom Feature enabled. Returns empty list if Custom Feature not enabled. Use <code>[[#isPluginActivated|isPluginActivated('approve_booking')]]</code> | |||
API method call to check if | API method call to check if Custom Feature enabled. | ||
| Line 1,488: | Line 1,488: | ||
Returns Integer. | Returns Integer. | ||
Returns count of bookings pending approval if [[ | Returns count of bookings pending approval if [[Custom_Features#Approve_Bookings|Approve bookings]] Custom Feature enabled. Returns | ||
0 if | 0 if Custom Feature not enabled. Use <code>[[#isPluginActivated|isPluginActivated('approve_booking')]]</code> API method | ||
call to check if | call to check if Custom Feature enabled. | ||
| Line 1,523: | Line 1,523: | ||
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 [[ | bookings. This method does nothing if [[Custom_Features#Status|Status Custom feature]] not enabled. | ||
| Line 1,549: | Line 1,549: | ||
See [[Errors handling]] for details. | See [[Errors handling]] for details. | ||
* -32001 | * -32001 Custom Feature is not activated | ||
* -32010 Some required params are missed | * -32010 Some required params are missed | ||
* -32011 Params is not array | * -32011 Params is not array | ||
| Line 1,729: | Line 1,729: | ||
* waiting_video | * waiting_video | ||
=====Accept payments | =====Accept payments Custom Feature params===== | ||
Read more about [[ | Read more about [[Custom_Features#Accept_Payments|Accept Payments Custom Feature configuration]]. | ||
* allow_delay_payment | * allow_delay_payment | ||
| Line 1,762: | Line 1,762: | ||
* liqpay_merchant_pass | * liqpay_merchant_pass | ||
=====Term & Conditions | =====Term & Conditions Custom Feature params===== | ||
Read more about [[ | Read more about [[Custom_Features#Terms_and_Conditions|Terms and Conditions Custom Feature]]. | ||
* user_license_text | * user_license_text | ||
| Line 1,771: | Line 1,771: | ||
---- | ---- | ||
=== | ===Custom Features' identifiers=== | ||
Custom Feature identifier is a string constant which represents a Custom Feature in system. These constants used in <code>[[#isPluginActivated|isPluginActivated]]</code> and <code>[[#getPluginStatuses|getPluginStatuses]]</code> API methods. | |||
* advanced_notification | * advanced_notification | ||
*:Book Soon notification system | *:Book Soon notification system | ||
* any_unit | * any_unit | ||
*:Any Employee selector | *:Any Employee selector | ||
* api | * api | ||
*:API | *:API | ||
* approve_booking | * approve_booking | ||
*:Approve booking | *:Approve booking | ||
* back_to_site | * back_to_site | ||
*:Take me back home | *:Take me back home | ||
* contact_widget | * contact_widget | ||
*:Contact widget | *:Contact widget | ||
* counter | * counter | ||
*:Visitor Counter | *:Visitor Counter | ||
* custom_css | * custom_css | ||
*:Custom CSS | *:Custom CSS | ||
* data_security | * data_security | ||
*:Clean history | *:Clean history | ||
* description | * description | ||
*:HTML description field for events | *:HTML description field for events | ||
* event_category | * event_category | ||
*:Service categories | *:Service categories | ||
* event_field | * event_field | ||
*:Additional fields | *:Additional fields | ||
* facebookImage | * facebookImage | ||
*:Facebook client info | *:Facebook client info | ||
* financial_dashboard | * financial_dashboard | ||
*:Insights | *:Insights | ||
* google_analytics | * google_analytics | ||
*:Google Adwords and analytics | *:Google Adwords and analytics | ||
* google_calendar_export | * google_calendar_export | ||
*:Google calendar sync | *:Google calendar sync | ||
* group_booking | * group_booking | ||
*:Group bookings | *:Group bookings | ||
* hipaa | * hipaa | ||
*:HIPAA | *:HIPAA | ||
* limit_bookings | * limit_bookings | ||
*:Limit bookings | *:Limit bookings | ||
* location | * location | ||
*:Unit location | *:Unit location | ||
* mobile_app_backend | * mobile_app_backend | ||
*:Mobile application | *:Mobile application | ||
* multiple_booking | * multiple_booking | ||
*:Multiple bookings | *:Multiple bookings | ||
* news | * news | ||
*:News | *:News | ||
* paid_events | * paid_events | ||
*:Accept payments | *:Accept payments | ||
* promo | * promo | ||
*:Simply Smart Promotions | *:Simply Smart Promotions | ||
* recap | * recap | ||
*:Daily report | *:Daily report | ||
* secure | * secure | ||
*:SSL | *:SSL | ||
* status | * status | ||
*:Status | *:Status | ||
* unit_colors | * unit_colors | ||
*:Providers color coding | *:Providers color coding | ||
* user_license | * user_license | ||
*:Terms and conditions | *:Terms and conditions | ||
* cancelation_policy | * cancelation_policy | ||
*:Cancellation Policy | *:Cancellation Policy | ||
See [[ | See [[Custom_Features|Custom Features]] page for description for each Custom Feature. | ||
---- | ---- | ||
| Line 1,915: | Line 1,915: | ||
} | } | ||
Location field is present in response only if [[ | Location field is present in response only if [[Custom_Features#Unit_Location|Unit location Custom Feature]] is enabled. Otherwise this field will be an empty array. If locations Custom Feature is enabled but booking doesn't have any locations this fields also will be an empty array. | ||
Status field is present in response only if [[ | Status 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 [[ | Price field is present in response only if [[Custom_Features#Accept_Payments|Accept payments Custom Feature]] is enabled. Otherwise this field will be an empty array. This field contains an empty array if Custom Feature is enabled but booking was created for a free service. | ||
Promo field is present in response only if [[ | Promo field is present in response only if [[Custom_Features#Simply_Smart_Promotions|Simply Smart Promotions 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 [[ | <code>additional_fields</code> field is present in response only if [[Custom_Features#Additional_Fields|Additional fields 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 additional fields. | ||
---- | ---- | ||