Busy Times
Create a busy time
POST
/
busy_times
cURL
curl --request POST \
--url https://api.caspen.com/v1/busy_times \
--header 'Content-Type: application/json' \
--data '
{
"location_id": 123,
"practitioner_id": 123,
"starts_at": "2023-11-07T05:31:56Z",
"ends_at": "2023-11-07T05:31:56Z",
"busy_time_type_id": 123,
"name": "<string>",
"note": "<string>",
"room_id": 123,
"vehicle_id": 123,
"repeating_rule": {
"frequency": "weekly",
"interval": 2,
"days": [],
"occurrences": 50,
"skip_conflicts": true
},
"resource_ids": [
123
]
}
'import requests
url = "https://api.caspen.com/v1/busy_times"
payload = {
"location_id": 123,
"practitioner_id": 123,
"starts_at": "2023-11-07T05:31:56Z",
"ends_at": "2023-11-07T05:31:56Z",
"busy_time_type_id": 123,
"name": "<string>",
"note": "<string>",
"room_id": 123,
"vehicle_id": 123,
"repeating_rule": {
"frequency": "weekly",
"interval": 2,
"days": [],
"occurrences": 50,
"skip_conflicts": True
},
"resource_ids": [123]
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
location_id: 123,
practitioner_id: 123,
starts_at: '2023-11-07T05:31:56Z',
ends_at: '2023-11-07T05:31:56Z',
busy_time_type_id: 123,
name: '<string>',
note: '<string>',
room_id: 123,
vehicle_id: 123,
repeating_rule: {
frequency: 'weekly',
interval: 2,
days: [],
occurrences: 50,
skip_conflicts: true
},
resource_ids: [123]
})
};
fetch('https://api.caspen.com/v1/busy_times', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.caspen.com/v1/busy_times",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'location_id' => 123,
'practitioner_id' => 123,
'starts_at' => '2023-11-07T05:31:56Z',
'ends_at' => '2023-11-07T05:31:56Z',
'busy_time_type_id' => 123,
'name' => '<string>',
'note' => '<string>',
'room_id' => 123,
'vehicle_id' => 123,
'repeating_rule' => [
'frequency' => 'weekly',
'interval' => 2,
'days' => [
],
'occurrences' => 50,
'skip_conflicts' => true
],
'resource_ids' => [
123
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.caspen.com/v1/busy_times"
payload := strings.NewReader("{\n \"location_id\": 123,\n \"practitioner_id\": 123,\n \"starts_at\": \"2023-11-07T05:31:56Z\",\n \"ends_at\": \"2023-11-07T05:31:56Z\",\n \"busy_time_type_id\": 123,\n \"name\": \"<string>\",\n \"note\": \"<string>\",\n \"room_id\": 123,\n \"vehicle_id\": 123,\n \"repeating_rule\": {\n \"frequency\": \"weekly\",\n \"interval\": 2,\n \"days\": [],\n \"occurrences\": 50,\n \"skip_conflicts\": true\n },\n \"resource_ids\": [\n 123\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.caspen.com/v1/busy_times")
.header("Content-Type", "application/json")
.body("{\n \"location_id\": 123,\n \"practitioner_id\": 123,\n \"starts_at\": \"2023-11-07T05:31:56Z\",\n \"ends_at\": \"2023-11-07T05:31:56Z\",\n \"busy_time_type_id\": 123,\n \"name\": \"<string>\",\n \"note\": \"<string>\",\n \"room_id\": 123,\n \"vehicle_id\": 123,\n \"repeating_rule\": {\n \"frequency\": \"weekly\",\n \"interval\": 2,\n \"days\": [],\n \"occurrences\": 50,\n \"skip_conflicts\": true\n },\n \"resource_ids\": [\n 123\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.caspen.com/v1/busy_times")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"location_id\": 123,\n \"practitioner_id\": 123,\n \"starts_at\": \"2023-11-07T05:31:56Z\",\n \"ends_at\": \"2023-11-07T05:31:56Z\",\n \"busy_time_type_id\": 123,\n \"name\": \"<string>\",\n \"note\": \"<string>\",\n \"room_id\": 123,\n \"vehicle_id\": 123,\n \"repeating_rule\": {\n \"frequency\": \"weekly\",\n \"interval\": 2,\n \"days\": [],\n \"occurrences\": 50,\n \"skip_conflicts\": true\n },\n \"resource_ids\": [\n 123\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"location_id": "<string>",
"practitioner_id": "<string>",
"starts_at": "<string>",
"ends_at": "<string>",
"duration": 123,
"name": "<string>",
"note": "<string>",
"created_at": "<string>"
}{
"message": "<string>"
}{
"message": "<string>",
"errors": {}
}Body
application/json
Maximum string length:
255Show child attributes
Show child attributes
Response
BusyTimeResource
The busy time's unique identifier.
Example:
"bti_01HQFQ9QWTNNPY58FZ8CB3FWWK"
The location identifier where the busy time takes place.
Example:
"loc_01HQFQ9QWTNNPY58FZ8CB3FWWK"
The practitioner identifier assigned to the busy time.
Example:
"pra_01HQFQ9QWTNNPY58FZ8CB3FWWK"
The busy time start time (ISO 8601).
Example:
"2024-01-01T10:00:00Z"
The busy time end time (ISO 8601).
Example:
"2024-01-01T11:00:00Z"
The busy time duration in minutes.
Example:
60
The busy time name.
Example:
"Lunch break"
The busy time note.
Example:
"Practitioner unavailable for personal appointment."
The timestamp when the busy time was created (ISO 8601).
Example:
"2024-01-01T12:00:00Z"
⌘I
cURL
curl --request POST \
--url https://api.caspen.com/v1/busy_times \
--header 'Content-Type: application/json' \
--data '
{
"location_id": 123,
"practitioner_id": 123,
"starts_at": "2023-11-07T05:31:56Z",
"ends_at": "2023-11-07T05:31:56Z",
"busy_time_type_id": 123,
"name": "<string>",
"note": "<string>",
"room_id": 123,
"vehicle_id": 123,
"repeating_rule": {
"frequency": "weekly",
"interval": 2,
"days": [],
"occurrences": 50,
"skip_conflicts": true
},
"resource_ids": [
123
]
}
'import requests
url = "https://api.caspen.com/v1/busy_times"
payload = {
"location_id": 123,
"practitioner_id": 123,
"starts_at": "2023-11-07T05:31:56Z",
"ends_at": "2023-11-07T05:31:56Z",
"busy_time_type_id": 123,
"name": "<string>",
"note": "<string>",
"room_id": 123,
"vehicle_id": 123,
"repeating_rule": {
"frequency": "weekly",
"interval": 2,
"days": [],
"occurrences": 50,
"skip_conflicts": True
},
"resource_ids": [123]
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
location_id: 123,
practitioner_id: 123,
starts_at: '2023-11-07T05:31:56Z',
ends_at: '2023-11-07T05:31:56Z',
busy_time_type_id: 123,
name: '<string>',
note: '<string>',
room_id: 123,
vehicle_id: 123,
repeating_rule: {
frequency: 'weekly',
interval: 2,
days: [],
occurrences: 50,
skip_conflicts: true
},
resource_ids: [123]
})
};
fetch('https://api.caspen.com/v1/busy_times', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.caspen.com/v1/busy_times",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'location_id' => 123,
'practitioner_id' => 123,
'starts_at' => '2023-11-07T05:31:56Z',
'ends_at' => '2023-11-07T05:31:56Z',
'busy_time_type_id' => 123,
'name' => '<string>',
'note' => '<string>',
'room_id' => 123,
'vehicle_id' => 123,
'repeating_rule' => [
'frequency' => 'weekly',
'interval' => 2,
'days' => [
],
'occurrences' => 50,
'skip_conflicts' => true
],
'resource_ids' => [
123
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.caspen.com/v1/busy_times"
payload := strings.NewReader("{\n \"location_id\": 123,\n \"practitioner_id\": 123,\n \"starts_at\": \"2023-11-07T05:31:56Z\",\n \"ends_at\": \"2023-11-07T05:31:56Z\",\n \"busy_time_type_id\": 123,\n \"name\": \"<string>\",\n \"note\": \"<string>\",\n \"room_id\": 123,\n \"vehicle_id\": 123,\n \"repeating_rule\": {\n \"frequency\": \"weekly\",\n \"interval\": 2,\n \"days\": [],\n \"occurrences\": 50,\n \"skip_conflicts\": true\n },\n \"resource_ids\": [\n 123\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.caspen.com/v1/busy_times")
.header("Content-Type", "application/json")
.body("{\n \"location_id\": 123,\n \"practitioner_id\": 123,\n \"starts_at\": \"2023-11-07T05:31:56Z\",\n \"ends_at\": \"2023-11-07T05:31:56Z\",\n \"busy_time_type_id\": 123,\n \"name\": \"<string>\",\n \"note\": \"<string>\",\n \"room_id\": 123,\n \"vehicle_id\": 123,\n \"repeating_rule\": {\n \"frequency\": \"weekly\",\n \"interval\": 2,\n \"days\": [],\n \"occurrences\": 50,\n \"skip_conflicts\": true\n },\n \"resource_ids\": [\n 123\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.caspen.com/v1/busy_times")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"location_id\": 123,\n \"practitioner_id\": 123,\n \"starts_at\": \"2023-11-07T05:31:56Z\",\n \"ends_at\": \"2023-11-07T05:31:56Z\",\n \"busy_time_type_id\": 123,\n \"name\": \"<string>\",\n \"note\": \"<string>\",\n \"room_id\": 123,\n \"vehicle_id\": 123,\n \"repeating_rule\": {\n \"frequency\": \"weekly\",\n \"interval\": 2,\n \"days\": [],\n \"occurrences\": 50,\n \"skip_conflicts\": true\n },\n \"resource_ids\": [\n 123\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"location_id": "<string>",
"practitioner_id": "<string>",
"starts_at": "<string>",
"ends_at": "<string>",
"duration": 123,
"name": "<string>",
"note": "<string>",
"created_at": "<string>"
}{
"message": "<string>"
}{
"message": "<string>",
"errors": {}
}