Company public service methods: Difference between revisions
No edit summary |
No edit summary |
||
| Line 37: | Line 37: | ||
"1": { | "1": { | ||
"id": "1", | "id": "1", | ||
"name": " | "name": "Hourly photoshoot", | ||
"duration": "60", | "duration": "60", | ||
"hide_duration": "0", | "hide_duration": "0", | ||
"description": "<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 83: | Line 83: | ||
* <code>X-Company-Login</code> | * <code>X-Company-Login</code> | ||
* <code>X-Token</code> an authentication token. See [[#Authentication|authentication]] section. | * <code>X-Token</code> an authentication token. See [[Company public service methods#Authentication|authentication]] section. | ||
===Endpoint=== | ===Endpoint=== | ||
| Line 91: | Line 91: | ||
===Authentication=== | ===Authentication=== | ||
Using Simplybook API methods require an authentification. To authorize in Simplybook API you need to get an access key — access-token. In order to get this access-token you should call the JSON-RPC method <code>[[Authentication#getToken|getToken]]</code> API method on https://user-api.simplybook.me/login service passing your personal API-key. You can copy your API-key at admin interface: go to the 'Custom Features' link and select [[ | Using Simplybook API methods require an authentification. To authorize in Simplybook API you need to get an access key — access-token. In order to get this access-token you should call the JSON-RPC method <code>[[Authentication#getToken|getToken]]</code> API method on https://user-api.simplybook.me/login service passing your personal API-key. You can copy your API-key at admin interface: go to the 'Custom Features' link and select [[Custom Features#API|API Custom Feature]] 'Settings'. | ||
== Methods == | == Methods == | ||
| Line 117: | Line 117: | ||
<code>require_confirm = true</code>. <code>$startDate</code> and <code>$startTime</code> specifies a date of | <code>require_confirm = true</code>. <code>$startDate</code> and <code>$startTime</code> specifies a date of | ||
booking and time slot. Time value should be multiple to 'timeframe' configuration of company (see | booking and time slot. Time value should be multiple to 'timeframe' configuration of company (see | ||
<code>[[#getTimeframe|getTimeframe]]</code> API method). <code>$endDate</code> and <code>$endTime</code> parameters | <code>[[Company public service methods#getTimeframe|getTimeframe]]</code> API method). <code>$endDate</code> and <code>$endTime</code> parameters | ||
should be calculated according to service duration. However you can specify different values to make appointment | should be calculated according to service duration. However you can specify different values to make appointment | ||
longer or shorter then service configuration. Note that <code>$endDate</code> and <code>$endTime</code> should be | longer or shorter then service configuration. Note that <code>$endDate</code> and <code>$endTime</code> should be | ||
| Line 124: | Line 124: | ||
between client's time zone and company's time zone in minutes. For example if company located in city with time | between client's time zone and company's time zone in minutes. For example if company located in city with time | ||
zone GMT+2 and customer located in city with GMT+3 then <code>$clientTimeOffset</code> will be 60 minutes. You | zone GMT+2 and customer located in city with GMT+3 then <code>$clientTimeOffset</code> will be 60 minutes. You | ||
can get information about company's time zone using <code>[[#getCompanyInfo|getCompanyInfo]]</code> API method. To | can get information about company's time zone using <code>[[Company public service methods#getCompanyInfo|getCompanyInfo]]</code> API method. To | ||
create batch booking you can specify either <code>count</code> more then 1 or valid <code>batchId</code> (only one | create batch booking you can specify either <code>count</code> more then 1 or valid <code>batchId</code> (only one | ||
parameter can be specified). You should specify an <code>$additionalFields</code> parameter if service requires | parameter can be specified). You should specify an <code>$additionalFields</code> parameter if service requires | ||
some intake forms (see [[ | some intake forms (see [[Custom Features#Intake Forms|Intake Forms Custom feature]]). To create a booking with promo code you | ||
should pass it as additional field. For example: <code>{"name": "promocode", "value": "some code", "type": "text"}</code>See [[#book response|example]] of <code>book</code> API method response. | should pass it as additional field. For example: <code>{"name": "promocode", "value": "some code", "type": "text"}</code>See [[Company public service methods#book response|example]] of <code>book</code> API method response. | ||
See also: | See also: | ||
| Line 165: | Line 165: | ||
Cancels a booking. <code>$sign</code> parameter must be a string created with formula: <code>md5($bookingId . $bookingHash . $secretKey) | Cancels a booking. <code>$sign</code> parameter must be a string created with formula: <code>md5($bookingId . $bookingHash . $secretKey) | ||
</code>. You can get <code>$bookingHash</code> value as result of <code>[[#book|book]]</code> API method call. Method | </code>. You can get <code>$bookingHash</code> value as result of <code>[[Company public service methods#book|book]]</code> API method call. Method | ||
return an error with code -32080 (Appointment couldn't be found) if record with specified id not exists. Methods returns | return an error with code -32080 (Appointment couldn't be found) if record with specified id not exists. Methods returns | ||
an error with code -32085 (Signature error) if <code>$sign</code> parameter is wrong. | an error with code -32085 (Signature error) if <code>$sign</code> parameter is wrong. | ||
| Line 268: | Line 268: | ||
Returns Integer. | Returns Integer. | ||
Creates new booking batch record. Returns newly created batch id. You can use this id in <code>[[#book|book]]</code> | Creates new booking batch record. Returns newly created batch id. You can use this id in <code>[[Company public service methods#book|book]]</code> | ||
API method. | API method. | ||
| Line 304: | Line 304: | ||
Returns Array. | Returns Array. | ||
Return intake forms for certain event if [[ | Return intake forms for certain event if [[Custom Features#Intake Forms|Intake Forms Custom feature]] is | ||
activated. Returns empty array otherwise. Call <code>[[#isPluginActivated|isPluginActivated('event_field')]]</code> | activated. Returns empty array otherwise. Call <code>[[Company public service methods#isPluginActivated|isPluginActivated('event_field')]]</code> | ||
API method to check if 'event_field' Custom Feature activated. | API method to check if 'event_field' Custom Feature activated. | ||
| Line 318: | Line 318: | ||
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 Custom Feature not enabled.Example: | null if Custom Feature not enabled.Example: | ||
{ | { | ||
| Line 382: | Line 382: | ||
Returns an object with details information about booking. <code>$sign</code> parameter must be a string created | Returns an object with details information about booking. <code>$sign</code> parameter must be a string created | ||
with formula: <code>md5($bookingId . $bookingHash . $secretKey)</code>. You can get <code>$bookingHash</code> | with formula: <code>md5($bookingId . $bookingHash . $secretKey)</code>. You can get <code>$bookingHash</code> | ||
value as result of <code>[[#book|book]]</code> API method call. Method return an error with code -32080 | value as result of <code>[[Company public service methods#book|book]]</code> API method call. Method return an error with code -32080 | ||
(Appointment couldn't be found) if record with specified id not exists. Methods returns an error with code -32085 | (Appointment couldn't be found) if record with specified id not exists. Methods returns an error with code -32085 | ||
(Signature error) if <code>$sign</code> parameter is wrong. | (Signature error) if <code>$sign</code> parameter is wrong. | ||
| Line 427: | Line 427: | ||
Returns an object with details information about booking. <code>$sign</code> parameter must be a string created | Returns an object with details information about booking. <code>$sign</code> parameter must be a string created | ||
with formula: <code>md5($bookingId . $bookingHash . $secretKey)</code>. You can get <code>$bookingHash</code> | with formula: <code>md5($bookingId . $bookingHash . $secretKey)</code>. You can get <code>$bookingHash</code> | ||
value as result of <code>[[#book|book]]</code> API method call. Method return an error with code -32080 | value as result of <code>[[Company public service methods#book|book]]</code> API method call. Method return an error with code -32080 | ||
(Appointment couldn't be found) if record with specified id not exists. Methods returns an error with code -32085 | (Appointment couldn't be found) if record with specified id not exists. Methods returns an error with code -32085 | ||
(Signature error) if <code>$sign</code> parameter is wrong. | (Signature error) if <code>$sign</code> parameter is wrong. | ||
| Line 444: | Line 444: | ||
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 Custom Feature is not activated. Use <code>[[#isPluginActivated|isPluginActivated('event_category')]]</code> | an error with code -32001 if Custom Feature is not activated. Use <code>[[Company public service methods#isPluginActivated|isPluginActivated('event_category')]]</code> | ||
API method to check if Custom Feature activated. | API method to check if Custom Feature activated. | ||
| Line 458: | Line 458: | ||
Returns Object. | Returns Object. | ||
Returns an object with detailed information about company. See [[#getCompanyInfo response|example of response]]. | Returns an object with detailed information about company. See [[Company public service methods#getCompanyInfo response|example of response]]. | ||
| Line 475: | Line 475: | ||
Returns company config value for key. A different set of keys available for public API and for company | Returns company config value for key. A different set of keys available for public API and for company | ||
administration API. Method return 'invalid params' error (code -32602) in case if access to specified key not | administration API. Method return 'invalid params' error (code -32602) in case if access to specified key not | ||
allowed. See [[# | allowed. See [[Company public service methods#Company params|list of available keys]]. | ||
| Line 492: | Line 492: | ||
Returns company's config values for specified keys as key-value map. For non-existent and not-allowed param keys | Returns company's config values for specified keys as key-value map. For non-existent and not-allowed param keys | ||
it will return '''false''' as result. A different set of keys available for public API and for company | it will return '''false''' as result. A different set of keys available for public API and for company | ||
administration API. See [[# | administration API. See [[Company public service methods#Company params|list of available keys]]. | ||
---- | ---- | ||
| Line 564: | Line 564: | ||
Returns Array. | Returns Array. | ||
Returns available locations for company if Custom Feature [[ | Returns available locations for company if Custom Feature [[Custom Features#Multiple Locations|Multiple locations Custom Feature]] is activated. Return | ||
an error with code -32001 if Custom Feature is not activated. Use <code>[[#isPluginActivated|isPluginActivated('location')]]</code> | an error with code -32001 if Custom Feature is not activated. Use <code>[[Company public service methods#isPluginActivated|isPluginActivated('location')]]</code> | ||
API method to check if Custom Feature activated. | API method to check if Custom Feature activated. | ||
| Line 619: | Line 619: | ||
Returns Array. | Returns Array. | ||
Return Custom Feature status true if status active, else false. See [[ | Return Custom Feature status true if status active, else false. See [[Company public service methods#Custom Features.27 identifiers|list of available Custom Feature's names]]. | ||
| Line 693: | Line 693: | ||
is an array of two objects. Both objects contains list of time slots for type <code>reserved_time</code> and type | is an array of two objects. Both objects contains list of time slots for type <code>reserved_time</code> and type | ||
<code>not_worked_time</code>. <code>reserved_time</code> type represents time slots working time but already booked | <code>not_worked_time</code>. <code>reserved_time</code> type represents time slots working time but already booked | ||
by clients. Nobody knows what kind of data represented by <code>not_worked_time</code> type. Please don't use it.If [[ | by clients. Nobody knows what kind of data represented by <code>not_worked_time</code> type. Please don't use it.If [[Custom Features#Calendar Sync|Calendar Sync Custom Feature]] is enabled then object with | ||
<code>reserved_time</code> type will contain not empty list of time slots marked as busy in Google calendar. Call | <code>reserved_time</code> type will contain not empty list of time slots marked as busy in Google calendar. Call | ||
<code>[[#isPluginActivated|isPluginActivated('google_calendar_export')]]</code> API method to check if Calendar Sync Custom Feature activated. | <code>[[Company public service methods#isPluginActivated|isPluginActivated('google_calendar_export')]]</code> API method to check if Calendar Sync Custom Feature activated. | ||
| Line 762: | Line 762: | ||
If locations Custom Feature activated for company you should pass a list as $unitID parameter for filter results with | If locations Custom Feature activated for company you should pass a list as $unitID parameter for filter results with | ||
units available only for selected location. See [[ | units available only for selected location. See [[Custom Features#Multiple Locations|Multiple Locations]] Custom Feature description for | ||
more details. | more details. | ||
| Line 775: | Line 775: | ||
Returns Integer. | Returns Integer. | ||
Returns company's timeframe configuration (in minutes). Timeframe can be either 5, 10, 15, 20, 30 or 60 minutes.You can find more details about timeframe [[ | Returns company's timeframe configuration (in minutes). Timeframe can be either 5, 10, 15, 20, 30 or 60 minutes.You can find more details about timeframe [[Need to change interval (timeframe)|here]]. | ||
| Line 896: | Line 896: | ||
Returns Boolean. | Returns Boolean. | ||
Returns true if [[ | Returns true if [[Custom Features#Accept Payments|Accept Payments]] Custom Feature activated and event with specified id has | ||
configured price. If no parameters specified then method returns true if payments Custom Feature activated and at least | configured price. If no parameters specified then method returns true if payments Custom Feature activated and at least | ||
one event has configured price. Otherwise returns false. | one event has configured price. Otherwise returns false. | ||
| Line 912: | Line 912: | ||
Returns Boolean. | Returns Boolean. | ||
Return Custom Feature status true if status active, else false. <var>$pluginName</var> parameter is a Custom Feature identifier.See [[ | Return Custom Feature status true if status active, else false. <var>$pluginName</var> parameter is a Custom Feature identifier.See [[Custom Features]] page for full Custom Features description. See [[Company public service methods#Custom Features.27 identifiers|list of available Custom Features' names]]. | ||
| Line 1,000: | Line 1,000: | ||
===Company params=== | ===Company params=== | ||
Use these values to get configuration params for company with <code>[[#getCompanyParam|getCompanyParam]]</code> API method. | Use these values to get configuration params for company with <code>[[Company public service methods#getCompanyParam|getCompanyParam]]</code> API method. | ||
=====General params===== | =====General params===== | ||
| Line 1,013: | Line 1,013: | ||
* fixed_country_prefix | * fixed_country_prefix | ||
* max_group_bookings | * max_group_bookings | ||
*: [[ | *: [[Custom Features#Group Bookings|Group Bookings Custom Feature]] configuration. Integer. | ||
* max_time_till_event | * max_time_till_event | ||
* min_time_till_event | * min_time_till_event | ||
| Line 1,027: | Line 1,027: | ||
* time_format | * time_format | ||
* timeframe | * timeframe | ||
*: Returns company's timeframe configuration (in minutes). Timeframe can be either 5, 10, 15, 20, 30 or 60 minutes. You can find more details about timeframe [[ | *: Returns company's timeframe configuration (in minutes). Timeframe can be either 5, 10, 15, 20, 30 or 60 minutes. You can find more details about timeframe [[Need to change interval (timeframe)|here]] | ||
* user_public_timeline_type | * user_public_timeline_type | ||
*: String. Can be one of the following values: | *: String. Can be one of the following values: | ||
| Line 1,040: | Line 1,040: | ||
=====Accept Payments Custom Feature params===== | =====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,053: | Line 1,053: | ||
=====Cancellation Policy Custom Feature params===== | =====Cancellation Policy Custom Feature params===== | ||
Read more about [[ | Read more about [[Custom Features#Cancellation Policy|Cancellation Policy Custom Feature configuration]]. | ||
* cancelation_policy_text | * cancelation_policy_text | ||
| Line 1,066: | Line 1,066: | ||
====Custom Features' identifiers==== | ====Custom Features' identifiers==== | ||
Custom Feature identifier is a string constant which represents a Custom Feature in system. These constants used in <code>[[#isPluginActivated|isPluginActivated]]</code> and <code>[[#getPluginStatuses|getPluginStatuses]]</code> API methods. | Custom Feature identifier is a string constant which represents a Custom Feature in system. These constants used in <code>[[Company public service methods#isPluginActivated|isPluginActivated]]</code> and <code>[[Company public service methods#getPluginStatuses|getPluginStatuses]]</code> API methods. | ||
* advanced_notification | * advanced_notification | ||
| Line 1,131: | Line 1,131: | ||
*:Cancellation Policy | *:Cancellation Policy | ||
See [[ | See [[Custom Features]] page for description for each . | ||
---- | ---- | ||
| Line 1,140: | Line 1,140: | ||
====book response==== | ====book response==== | ||
[[#book|<code>book</code>]] API method returns an object which contains list of objects with short description of newly create bookings. Method returns only one item in 'bookings' array for regular appointment and more than one item for recurring or batch bookings. | [[Company public service methods#book|<code>book</code>]] API method returns an object which contains list of objects with short description of newly create bookings. Method returns only one item in 'bookings' array for regular appointment and more than one item for recurring or batch bookings. | ||
{ | { | ||
| Line 1,199: | Line 1,199: | ||
====getCompanyInfo response==== | ====getCompanyInfo response==== | ||
An example of data returned by [[#getCompanyInfo|getCompanyInfo]] API method. | An example of data returned by [[Company public service methods#getCompanyInfo|getCompanyInfo]] API method. | ||
{ | { | ||
| Line 1,240: | Line 1,240: | ||
<code>description</code> field contains raw data of company's description which can include HTML tags. <code>description_text</code> field contains only text information without HTML tags. | <code>description</code> field contains raw data of company's description which can include HTML tags. <code>description_text</code> field contains only text information without HTML tags. | ||
For information about <code>timeframe</code>, <code>timezone</code>, <code>allow_event_day_break</code> and <code>allow_event_breaktime_break</code> see [[#Company params|Company params section]]. | For information about <code>timeframe</code>, <code>timezone</code>, <code>allow_event_day_break</code> and <code>allow_event_breaktime_break</code> see [[Company public service methods#Company params|Company params section]]. | ||
---- | ---- | ||