Services
What you sell: each service with its price, type, booking rules and, for tiered services, its group.
The service object
Every service record carries these fields in this order, after object, which is always "service".
| Field | Type | Description |
|---|---|---|
id | integer | |
group_id | integer | The service group this service is a tier of (Service Groups page); 0 = in no group. Read-only. |
group_num | integer | The tier's size: the hours (hourly service) or sessions (fixed fee) bought at this tier's price, shown as HRS on the Service Groups page. 0 when in no group. Read-only. |
name | string, up to 255 characters | The service group's name; null when the service is in no group. Read-only. |
service_description | text | The service name, shown wherever the service is booked or billed (HTML). |
service_cost | decimal | The price, 2 decimals: per hour (service_type 0) or a fixed fee per session (service_type 1). |
service_taxable | integer | 1 = sales tax applies, 0 = not. |
service_type | integer | 0 = hourly, 1 = fixed fee. |
service_status | integer | 1 = active, 0 = inactive. Deleted services are never returned. |
service_security | integer | Who sees the service: 0 = all users, 1 = everyone but clients, 2 = admin and staff only. |
service_reminders | integer | 1 = session reminders go out for sessions with this service, 0 = none. |
online_booking | integer | 1 = clients can choose it on the online booking page, 0 = not. |
min_duration | integer | Shortest session, in minutes, a client or practitioner may add with this service; 0 = no minimum. |
max_duration | integer | Longest session, in minutes, a client or practitioner may add with this service; 0 = no maximum. |
start_interval | integer | Start times for sessions a client or practitioner adds: 0 = any time, 1 = on the hour, 2 = at 30 minutes past the hour. |
service_sub | integer | 1 = a subscription or membership (a fixed fee for access to your services); sessions with it cannot be added through the API. 0 = a regular service. |
service_frequency | integer | The period service_frequency_number counts in: 0 = no limit, 1 = week (Monday to Sunday), 2 = calendar month, 3 = calendar year. |
service_frequency_number | integer | The most sessions with this service one client may have per service_frequency period (cancelled sessions do not count), checked whenever a session is added, API included. 0 = no limit. |
Example
{
"object": "service",
"id": 42,
"group_id": 7,
"group_num": 1,
"name": "Example name",
"service_description": "An example description.",
"service_cost": 25.5,
"service_taxable": 1,
"service_type": 1,
"service_status": 1,
"service_security": 1,
"service_reminders": 1,
"online_booking": 1,
"min_duration": 1,
"max_duration": 1,
"start_interval": 1,
"service_sub": 1,
"service_frequency": 1,
"service_frequency_number": 1
} List services
Parameters
| Parameter | In | Description |
|---|---|---|
limit | query | Records per page, 1 to 1000 (default 100). |
offset | query | Records to skip (default 0). |
Returns
A list envelope of service records (see Pagination).
Request
curl "https://www.bizstim.com/api/v1/services" \
-H "X-API-KEY: YOUR_API_KEY" \
-H "Accept: application/json"<?php
$ch = curl_init('https://www.bizstim.com/api/v1/services');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['X-API-KEY: YOUR_API_KEY', 'Accept: application/json'],
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);const response = await fetch('https://www.bizstim.com/api/v1/services', {
headers: { 'X-API-KEY': 'YOUR_API_KEY', 'Accept': 'application/json' }
});
const data = await response.json();Response
{
"object": "list",
"total": 2,
"limit": 100,
"offset": 0,
"has_more": false,
"data": [
{
"object": "service",
"id": 42,
"group_id": 7,
"group_num": 1,
"name": "Example name",
"service_description": "An example description.",
"service_cost": 25.5,
"service_taxable": 1,
"service_type": 1,
"service_status": 1,
"service_security": 1,
"service_reminders": 1,
"online_booking": 1,
"min_duration": 1,
"max_duration": 1,
"start_interval": 1,
"service_sub": 1,
"service_frequency": 1,
"service_frequency_number": 1
},
{
"object": "service",
"id": 43,
"group_id": 7,
"group_num": 1,
"name": "Example name",
"service_description": "An example description.",
"service_cost": 25.5,
"service_taxable": 1,
"service_type": 1,
"service_status": 1,
"service_security": 1,
"service_reminders": 1,
"online_booking": 1,
"min_duration": 1,
"max_duration": 1,
"start_interval": 1,
"service_sub": 1,
"service_frequency": 1,
"service_frequency_number": 1
}
]
} Retrieve a service
Parameters
| Parameter | In | Description |
|---|---|---|
id | path | The record's id. |
Returns
One service record, or 404 not_found when no record with that id exists on your account.
Request
curl "https://www.bizstim.com/api/v1/services/42" \
-H "X-API-KEY: YOUR_API_KEY" \
-H "Accept: application/json"<?php
$ch = curl_init('https://www.bizstim.com/api/v1/services/42');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['X-API-KEY: YOUR_API_KEY', 'Accept: application/json'],
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);const response = await fetch('https://www.bizstim.com/api/v1/services/42', {
headers: { 'X-API-KEY': 'YOUR_API_KEY', 'Accept': 'application/json' }
});
const data = await response.json();Response
{
"object": "service",
"id": 42,
"group_id": 7,
"group_num": 1,
"name": "Example name",
"service_description": "An example description.",
"service_cost": 25.5,
"service_taxable": 1,
"service_type": 1,
"service_status": 1,
"service_security": 1,
"service_reminders": 1,
"online_booking": 1,
"min_duration": 1,
"max_duration": 1,
"start_interval": 1,
"service_sub": 1,
"service_frequency": 1,
"service_frequency_number": 1
} Create a service
Request body
A JSON object (Content-Type: application/json) with these fields.
| Field | Type | Required | Description |
|---|---|---|---|
service_description | string | yes | The service name, shown wherever the service is booked or billed. HTML is cleaned on save. |
service_cost | number, 0 to 99999999.99 | yes | The price: per hour or a fixed fee, as service_type says. Stored with 2 decimals. |
service_type | integer | no | 0 hourly (default), 1 fixed fee. |
service_taxable | boolean | no | Sales tax applies. Default false. |
service_reminders | boolean | no | Session reminders are sent for this service. Default true. |
service_security | integer | no | Who sees the service: 0 everyone (default), 1 everyone but clients, 2 admin and staff only. |
online_booking | boolean | no | Clients can choose it on the online booking page. Default false. |
service_sub | boolean | no | Plans replace subscription services: true is refused ("Subscription services are replaced by Plans."). Default false. |
min_duration | integer, minutes | no | The shortest session allowed with this service, checked when a client or practitioner adds a session (not for admin, staff or the API). 0 = no minimum (default). |
max_duration | integer, minutes | no | The longest session allowed with this service, checked when a client or practitioner adds a session (not for admin, staff or the API). 0 = no maximum (default). |
start_interval | integer | no | Start times for sessions a client or practitioner adds: 0 any time (default), 1 on the hour, 2 at 30 minutes past the hour. |
service_frequency_number | integer | no | The most sessions with this service one client may have per service_frequency period (cancelled sessions do not count). Set both to restrict; 0 = no limit (default). |
service_frequency | integer | no | The period of service_frequency_number: 0 none (default), 1 week, 2 month, 3 year. |
Returns
201 with the new service record: active, in no group. The default wage, the calendar colour and the service's skills are set in the app. 400 invalid_request names the field to fix.
Request
curl -X POST "https://www.bizstim.com/api/v1/services" \
-H "X-API-KEY: YOUR_API_KEY" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{
"service_description": "Math tutoring",
"service_cost": 60
}'<?php
$ch = curl_init('https://www.bizstim.com/api/v1/services');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => '{
"service_description": "Math tutoring",
"service_cost": 60
}',
CURLOPT_HTTPHEADER => ['X-API-KEY: YOUR_API_KEY', 'Accept: application/json', 'Content-Type: application/json'],
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);const response = await fetch('https://www.bizstim.com/api/v1/services', {
method: 'POST',
headers: { 'X-API-KEY': 'YOUR_API_KEY', 'Accept': 'application/json', 'Content-Type': 'application/json' },
body: JSON.stringify({
"service_description": "Math tutoring",
"service_cost": 60
})
});
const data = await response.json();Response (201)
{
"object": "service",
"id": 42,
"group_id": 7,
"group_num": 1,
"name": "Example name",
"service_description": "An example description.",
"service_cost": 25.5,
"service_taxable": 1,
"service_type": 1,
"service_status": 1,
"service_security": 1,
"service_reminders": 1,
"online_booking": 1,
"min_duration": 1,
"max_duration": 1,
"start_interval": 1,
"service_sub": 1,
"service_frequency": 1,
"service_frequency_number": 1
} Update a service
Parameters
| Parameter | In | Description |
|---|---|---|
id | path | The record's id. |
Request body
A JSON object (Content-Type: application/json) with these fields.
| Field | Type | Required | Description |
|---|---|---|---|
service_description | string | no | The service name (cannot be emptied). |
service_cost | number, 0 to 99999999.99 | no | The price, stored with 2 decimals. |
service_status | integer | no | 1 active, 0 inactive. A service with upcoming sessions or covered by a live plan stays active (409). To delete a service, use DELETE (2 is refused). |
service_type | integer | no | 0 hourly, 1 fixed fee. |
service_taxable | boolean | no | Sales tax applies. |
service_reminders | boolean | no | Session reminders are sent for this service. |
service_security | integer | no | 0 everyone, 1 everyone but clients, 2 admin and staff only. A service in a group keeps its visibility (409); a service visible to everyone that a plan sold online covers cannot be hidden (409). |
online_booking | boolean | no | Clients can choose it on the online booking page. |
service_sub | boolean | no | false switches a subscription service off; true is refused unless the service already is one (Plans replace subscription services). |
min_duration | integer, minutes | no | Shortest session a client or practitioner may add; 0 = no minimum. |
max_duration | integer, minutes | no | Longest session a client or practitioner may add; 0 = no maximum. |
start_interval | integer | no | Start times for sessions a client or practitioner adds: 0 any time, 1 on the hour, 2 at 30 minutes past the hour. |
service_frequency_number | integer | no | The most sessions one client may have per service_frequency period; 0 = no limit. |
service_frequency | integer | no | 0 none, 1 week, 2 month, 3 year. |
Returns
200 with the updated service record. Fields left out keep their values; the default wage, the calendar colour and the service's skills are kept too. group_id, group_num and name are read-only: service groups are managed in the app. 400 invalid_request names the field to fix; 404 not_found (deleted services too); 409 conflict for the Smart Learn service, for a service_security change on a service in a group, and for hiding (1 or 2) a service covered by a plan sold online. 409 conflict also for service_status 0 on a service with upcoming sessions or covered by a live plan (ServicesAPI_model::updateService(), the list page's rule).
Request
curl -X PATCH "https://www.bizstim.com/api/v1/services/42" \
-H "X-API-KEY: YOUR_API_KEY" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{
"service_cost": 65,
"service_status": 0
}'<?php
$ch = curl_init('https://www.bizstim.com/api/v1/services/42');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'PATCH',
CURLOPT_POSTFIELDS => '{
"service_cost": 65,
"service_status": 0
}',
CURLOPT_HTTPHEADER => ['X-API-KEY: YOUR_API_KEY', 'Accept: application/json', 'Content-Type: application/json'],
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);const response = await fetch('https://www.bizstim.com/api/v1/services/42', {
method: 'PATCH',
headers: { 'X-API-KEY': 'YOUR_API_KEY', 'Accept': 'application/json', 'Content-Type': 'application/json' },
body: JSON.stringify({
"service_cost": 65,
"service_status": 0
})
});
const data = await response.json();Response
{
"object": "service",
"id": 42,
"group_id": 7,
"group_num": 1,
"name": "Example name",
"service_description": "An example description.",
"service_cost": 25.5,
"service_taxable": 1,
"service_type": 1,
"service_status": 1,
"service_security": 1,
"service_reminders": 1,
"online_booking": 1,
"min_duration": 1,
"max_duration": 1,
"start_interval": 1,
"service_sub": 1,
"service_frequency": 1,
"service_frequency_number": 1
} Delete a service
Parameters
| Parameter | In | Description |
|---|---|---|
id | path | The record's id. |
Returns
200 with {"id", "object": "service", "deleted": true}. As in the app, the service is marked deleted: sessions that use it keep it, it is taken off every client's list of services, and the API no longer returns it. 404 not_found; 409 conflict for the Smart Learn service, and for a service with upcoming sessions or covered by a live plan (it is kept).
Request
curl -X DELETE "https://www.bizstim.com/api/v1/services/42" \
-H "X-API-KEY: YOUR_API_KEY" \
-H "Accept: application/json"<?php
$ch = curl_init('https://www.bizstim.com/api/v1/services/42');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'DELETE',
CURLOPT_HTTPHEADER => ['X-API-KEY: YOUR_API_KEY', 'Accept: application/json'],
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);const response = await fetch('https://www.bizstim.com/api/v1/services/42', {
method: 'DELETE',
headers: { 'X-API-KEY': 'YOUR_API_KEY', 'Accept': 'application/json' }
});
const data = await response.json();Response
{
"id": 42,
"object": "service",
"deleted": true
}