curl --request POST \
--url https://api.sonderplan.com/v2/booking \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Test Booking",
"start": 1547501100,
"end": 1547538900,
"id": 1,
"start_date_time_iso": "2022-02-22T09:00:00+11:00",
"end_date_time_iso": "2022-02-22T17:00:00+11:00",
"all_day": "false",
"notes": "Additional note",
"repeat_master": "true",
"repeat_master_id": "0",
"repeat_rule": "FREQ=daily;INTERVAL=2;REPENDTYPE=date;UNTIL=20220228T130000;",
"resources": [
{
"id": 9458,
"rates": [
{
"rate_scheme_id": 984312,
"rate_scheme_name": "Resource Rate",
"currency": "AUD",
"buy": {
"unit": "hourly",
"unit_amount": "20.65",
"quantity": "2.4",
"discount": "20.00%"
},
"sell": {
"unit": "hourly",
"unit_amount": "20.65",
"quantity": "2.4",
"discount": "20.00%"
}
}
],
"time_entries": [
{
"name": "Colour Grading",
"description": "Opening scenes completed",
"start": 1547501100,
"end": 1547538900
}
]
}
],
"project": [
{
"id": 2342354,
"start": 1547501100,
"end": 1547538900
}
],
"client": [
{
"uuid": "p4",
"contact_person": {
"id": 2837
}
}
],
"status": [
{
"name": "Second Hold",
"description": "Has second priority if the first hold cancels",
"notification": true
}
],
"billable_items": [
{
"name": "NAS Storage",
"id": 2342354,
"description": "Rented per TB, per month",
"cost": "25.23",
"buy_cost": "20",
"currency": "AUD",
"quantity": "4",
"billable_item_id": 897832,
"taxes": [
{
"id": 3247,
"name": "GST",
"rate": "10.00",
"total": "151.00"
}
],
"create_new": true
}
],
"custom_fields": [
{
"id": 7823,
"name": "Type",
"value": "Video Editing",
"value_id": 8973,
"update_key": "2_1_7823"
}
]
}
'import requests
url = "https://api.sonderplan.com/v2/booking"
payload = {
"name": "Test Booking",
"start": 1547501100,
"end": 1547538900,
"id": 1,
"start_date_time_iso": "2022-02-22T09:00:00+11:00",
"end_date_time_iso": "2022-02-22T17:00:00+11:00",
"all_day": "false",
"notes": "Additional note",
"repeat_master": "true",
"repeat_master_id": "0",
"repeat_rule": "FREQ=daily;INTERVAL=2;REPENDTYPE=date;UNTIL=20220228T130000;",
"resources": [
{
"id": 9458,
"rates": [
{
"rate_scheme_id": 984312,
"rate_scheme_name": "Resource Rate",
"currency": "AUD",
"buy": {
"unit": "hourly",
"unit_amount": "20.65",
"quantity": "2.4",
"discount": "20.00%"
},
"sell": {
"unit": "hourly",
"unit_amount": "20.65",
"quantity": "2.4",
"discount": "20.00%"
}
}
],
"time_entries": [
{
"name": "Colour Grading",
"description": "Opening scenes completed",
"start": 1547501100,
"end": 1547538900
}
]
}
],
"project": [
{
"id": 2342354,
"start": 1547501100,
"end": 1547538900
}
],
"client": [
{
"uuid": "p4",
"contact_person": { "id": 2837 }
}
],
"status": [
{
"name": "Second Hold",
"description": "Has second priority if the first hold cancels",
"notification": True
}
],
"billable_items": [
{
"name": "NAS Storage",
"id": 2342354,
"description": "Rented per TB, per month",
"cost": "25.23",
"buy_cost": "20",
"currency": "AUD",
"quantity": "4",
"billable_item_id": 897832,
"taxes": [
{
"id": 3247,
"name": "GST",
"rate": "10.00",
"total": "151.00"
}
],
"create_new": True
}
],
"custom_fields": [
{
"id": 7823,
"name": "Type",
"value": "Video Editing",
"value_id": 8973,
"update_key": "2_1_7823"
}
]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'Test Booking',
start: 1547501100,
end: 1547538900,
id: 1,
start_date_time_iso: '2022-02-22T09:00:00+11:00',
end_date_time_iso: '2022-02-22T17:00:00+11:00',
all_day: 'false',
notes: 'Additional note',
repeat_master: 'true',
repeat_master_id: '0',
repeat_rule: 'FREQ=daily;INTERVAL=2;REPENDTYPE=date;UNTIL=20220228T130000;',
resources: [
{
id: 9458,
rates: [
{
rate_scheme_id: 984312,
rate_scheme_name: 'Resource Rate',
currency: 'AUD',
buy: {unit: 'hourly', unit_amount: '20.65', quantity: '2.4', discount: '20.00%'},
sell: {unit: 'hourly', unit_amount: '20.65', quantity: '2.4', discount: '20.00%'}
}
],
time_entries: [
{
name: 'Colour Grading',
description: 'Opening scenes completed',
start: 1547501100,
end: 1547538900
}
]
}
],
project: [{id: 2342354, start: 1547501100, end: 1547538900}],
client: [{uuid: 'p4', contact_person: {id: 2837}}],
status: [
{
name: 'Second Hold',
description: 'Has second priority if the first hold cancels',
notification: true
}
],
billable_items: [
{
name: 'NAS Storage',
id: 2342354,
description: 'Rented per TB, per month',
cost: '25.23',
buy_cost: '20',
currency: 'AUD',
quantity: '4',
billable_item_id: 897832,
taxes: [{id: 3247, name: 'GST', rate: '10.00', total: '151.00'}],
create_new: true
}
],
custom_fields: [
{
id: 7823,
name: 'Type',
value: 'Video Editing',
value_id: 8973,
update_key: '2_1_7823'
}
]
})
};
fetch('https://api.sonderplan.com/v2/booking', 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.sonderplan.com/v2/booking",
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([
'name' => 'Test Booking',
'start' => 1547501100,
'end' => 1547538900,
'id' => 1,
'start_date_time_iso' => '2022-02-22T09:00:00+11:00',
'end_date_time_iso' => '2022-02-22T17:00:00+11:00',
'all_day' => 'false',
'notes' => 'Additional note',
'repeat_master' => 'true',
'repeat_master_id' => '0',
'repeat_rule' => 'FREQ=daily;INTERVAL=2;REPENDTYPE=date;UNTIL=20220228T130000;',
'resources' => [
[
'id' => 9458,
'rates' => [
[
'rate_scheme_id' => 984312,
'rate_scheme_name' => 'Resource Rate',
'currency' => 'AUD',
'buy' => [
'unit' => 'hourly',
'unit_amount' => '20.65',
'quantity' => '2.4',
'discount' => '20.00%'
],
'sell' => [
'unit' => 'hourly',
'unit_amount' => '20.65',
'quantity' => '2.4',
'discount' => '20.00%'
]
]
],
'time_entries' => [
[
'name' => 'Colour Grading',
'description' => 'Opening scenes completed',
'start' => 1547501100,
'end' => 1547538900
]
]
]
],
'project' => [
[
'id' => 2342354,
'start' => 1547501100,
'end' => 1547538900
]
],
'client' => [
[
'uuid' => 'p4',
'contact_person' => [
'id' => 2837
]
]
],
'status' => [
[
'name' => 'Second Hold',
'description' => 'Has second priority if the first hold cancels',
'notification' => true
]
],
'billable_items' => [
[
'name' => 'NAS Storage',
'id' => 2342354,
'description' => 'Rented per TB, per month',
'cost' => '25.23',
'buy_cost' => '20',
'currency' => 'AUD',
'quantity' => '4',
'billable_item_id' => 897832,
'taxes' => [
[
'id' => 3247,
'name' => 'GST',
'rate' => '10.00',
'total' => '151.00'
]
],
'create_new' => true
]
],
'custom_fields' => [
[
'id' => 7823,
'name' => 'Type',
'value' => 'Video Editing',
'value_id' => 8973,
'update_key' => '2_1_7823'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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.sonderplan.com/v2/booking"
payload := strings.NewReader("{\n \"name\": \"Test Booking\",\n \"start\": 1547501100,\n \"end\": 1547538900,\n \"id\": 1,\n \"start_date_time_iso\": \"2022-02-22T09:00:00+11:00\",\n \"end_date_time_iso\": \"2022-02-22T17:00:00+11:00\",\n \"all_day\": \"false\",\n \"notes\": \"Additional note\",\n \"repeat_master\": \"true\",\n \"repeat_master_id\": \"0\",\n \"repeat_rule\": \"FREQ=daily;INTERVAL=2;REPENDTYPE=date;UNTIL=20220228T130000;\",\n \"resources\": [\n {\n \"id\": 9458,\n \"rates\": [\n {\n \"rate_scheme_id\": 984312,\n \"rate_scheme_name\": \"Resource Rate\",\n \"currency\": \"AUD\",\n \"buy\": {\n \"unit\": \"hourly\",\n \"unit_amount\": \"20.65\",\n \"quantity\": \"2.4\",\n \"discount\": \"20.00%\"\n },\n \"sell\": {\n \"unit\": \"hourly\",\n \"unit_amount\": \"20.65\",\n \"quantity\": \"2.4\",\n \"discount\": \"20.00%\"\n }\n }\n ],\n \"time_entries\": [\n {\n \"name\": \"Colour Grading\",\n \"description\": \"Opening scenes completed\",\n \"start\": 1547501100,\n \"end\": 1547538900\n }\n ]\n }\n ],\n \"project\": [\n {\n \"id\": 2342354,\n \"start\": 1547501100,\n \"end\": 1547538900\n }\n ],\n \"client\": [\n {\n \"uuid\": \"p4\",\n \"contact_person\": {\n \"id\": 2837\n }\n }\n ],\n \"status\": [\n {\n \"name\": \"Second Hold\",\n \"description\": \"Has second priority if the first hold cancels\",\n \"notification\": true\n }\n ],\n \"billable_items\": [\n {\n \"name\": \"NAS Storage\",\n \"id\": 2342354,\n \"description\": \"Rented per TB, per month\",\n \"cost\": \"25.23\",\n \"buy_cost\": \"20\",\n \"currency\": \"AUD\",\n \"quantity\": \"4\",\n \"billable_item_id\": 897832,\n \"taxes\": [\n {\n \"id\": 3247,\n \"name\": \"GST\",\n \"rate\": \"10.00\",\n \"total\": \"151.00\"\n }\n ],\n \"create_new\": true\n }\n ],\n \"custom_fields\": [\n {\n \"id\": 7823,\n \"name\": \"Type\",\n \"value\": \"Video Editing\",\n \"value_id\": 8973,\n \"update_key\": \"2_1_7823\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.sonderplan.com/v2/booking")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Test Booking\",\n \"start\": 1547501100,\n \"end\": 1547538900,\n \"id\": 1,\n \"start_date_time_iso\": \"2022-02-22T09:00:00+11:00\",\n \"end_date_time_iso\": \"2022-02-22T17:00:00+11:00\",\n \"all_day\": \"false\",\n \"notes\": \"Additional note\",\n \"repeat_master\": \"true\",\n \"repeat_master_id\": \"0\",\n \"repeat_rule\": \"FREQ=daily;INTERVAL=2;REPENDTYPE=date;UNTIL=20220228T130000;\",\n \"resources\": [\n {\n \"id\": 9458,\n \"rates\": [\n {\n \"rate_scheme_id\": 984312,\n \"rate_scheme_name\": \"Resource Rate\",\n \"currency\": \"AUD\",\n \"buy\": {\n \"unit\": \"hourly\",\n \"unit_amount\": \"20.65\",\n \"quantity\": \"2.4\",\n \"discount\": \"20.00%\"\n },\n \"sell\": {\n \"unit\": \"hourly\",\n \"unit_amount\": \"20.65\",\n \"quantity\": \"2.4\",\n \"discount\": \"20.00%\"\n }\n }\n ],\n \"time_entries\": [\n {\n \"name\": \"Colour Grading\",\n \"description\": \"Opening scenes completed\",\n \"start\": 1547501100,\n \"end\": 1547538900\n }\n ]\n }\n ],\n \"project\": [\n {\n \"id\": 2342354,\n \"start\": 1547501100,\n \"end\": 1547538900\n }\n ],\n \"client\": [\n {\n \"uuid\": \"p4\",\n \"contact_person\": {\n \"id\": 2837\n }\n }\n ],\n \"status\": [\n {\n \"name\": \"Second Hold\",\n \"description\": \"Has second priority if the first hold cancels\",\n \"notification\": true\n }\n ],\n \"billable_items\": [\n {\n \"name\": \"NAS Storage\",\n \"id\": 2342354,\n \"description\": \"Rented per TB, per month\",\n \"cost\": \"25.23\",\n \"buy_cost\": \"20\",\n \"currency\": \"AUD\",\n \"quantity\": \"4\",\n \"billable_item_id\": 897832,\n \"taxes\": [\n {\n \"id\": 3247,\n \"name\": \"GST\",\n \"rate\": \"10.00\",\n \"total\": \"151.00\"\n }\n ],\n \"create_new\": true\n }\n ],\n \"custom_fields\": [\n {\n \"id\": 7823,\n \"name\": \"Type\",\n \"value\": \"Video Editing\",\n \"value_id\": 8973,\n \"update_key\": \"2_1_7823\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sonderplan.com/v2/booking")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Test Booking\",\n \"start\": 1547501100,\n \"end\": 1547538900,\n \"id\": 1,\n \"start_date_time_iso\": \"2022-02-22T09:00:00+11:00\",\n \"end_date_time_iso\": \"2022-02-22T17:00:00+11:00\",\n \"all_day\": \"false\",\n \"notes\": \"Additional note\",\n \"repeat_master\": \"true\",\n \"repeat_master_id\": \"0\",\n \"repeat_rule\": \"FREQ=daily;INTERVAL=2;REPENDTYPE=date;UNTIL=20220228T130000;\",\n \"resources\": [\n {\n \"id\": 9458,\n \"rates\": [\n {\n \"rate_scheme_id\": 984312,\n \"rate_scheme_name\": \"Resource Rate\",\n \"currency\": \"AUD\",\n \"buy\": {\n \"unit\": \"hourly\",\n \"unit_amount\": \"20.65\",\n \"quantity\": \"2.4\",\n \"discount\": \"20.00%\"\n },\n \"sell\": {\n \"unit\": \"hourly\",\n \"unit_amount\": \"20.65\",\n \"quantity\": \"2.4\",\n \"discount\": \"20.00%\"\n }\n }\n ],\n \"time_entries\": [\n {\n \"name\": \"Colour Grading\",\n \"description\": \"Opening scenes completed\",\n \"start\": 1547501100,\n \"end\": 1547538900\n }\n ]\n }\n ],\n \"project\": [\n {\n \"id\": 2342354,\n \"start\": 1547501100,\n \"end\": 1547538900\n }\n ],\n \"client\": [\n {\n \"uuid\": \"p4\",\n \"contact_person\": {\n \"id\": 2837\n }\n }\n ],\n \"status\": [\n {\n \"name\": \"Second Hold\",\n \"description\": \"Has second priority if the first hold cancels\",\n \"notification\": true\n }\n ],\n \"billable_items\": [\n {\n \"name\": \"NAS Storage\",\n \"id\": 2342354,\n \"description\": \"Rented per TB, per month\",\n \"cost\": \"25.23\",\n \"buy_cost\": \"20\",\n \"currency\": \"AUD\",\n \"quantity\": \"4\",\n \"billable_item_id\": 897832,\n \"taxes\": [\n {\n \"id\": 3247,\n \"name\": \"GST\",\n \"rate\": \"10.00\",\n \"total\": \"151.00\"\n }\n ],\n \"create_new\": true\n }\n ],\n \"custom_fields\": [\n {\n \"id\": 7823,\n \"name\": \"Type\",\n \"value\": \"Video Editing\",\n \"value_id\": 8973,\n \"update_key\": \"2_1_7823\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"success": {
"id": 1
}
}{
"error": {
"code": "404",
"message": "Requested resource was not found"
}
}Create Booking
WRITE access to the SCHEDULE module is required to access this endpointbookingCreated webhook will be fired when this endpoint has run successfullynotify_user_resources option which can be used to silence notifications for end users.curl --request POST \
--url https://api.sonderplan.com/v2/booking \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Test Booking",
"start": 1547501100,
"end": 1547538900,
"id": 1,
"start_date_time_iso": "2022-02-22T09:00:00+11:00",
"end_date_time_iso": "2022-02-22T17:00:00+11:00",
"all_day": "false",
"notes": "Additional note",
"repeat_master": "true",
"repeat_master_id": "0",
"repeat_rule": "FREQ=daily;INTERVAL=2;REPENDTYPE=date;UNTIL=20220228T130000;",
"resources": [
{
"id": 9458,
"rates": [
{
"rate_scheme_id": 984312,
"rate_scheme_name": "Resource Rate",
"currency": "AUD",
"buy": {
"unit": "hourly",
"unit_amount": "20.65",
"quantity": "2.4",
"discount": "20.00%"
},
"sell": {
"unit": "hourly",
"unit_amount": "20.65",
"quantity": "2.4",
"discount": "20.00%"
}
}
],
"time_entries": [
{
"name": "Colour Grading",
"description": "Opening scenes completed",
"start": 1547501100,
"end": 1547538900
}
]
}
],
"project": [
{
"id": 2342354,
"start": 1547501100,
"end": 1547538900
}
],
"client": [
{
"uuid": "p4",
"contact_person": {
"id": 2837
}
}
],
"status": [
{
"name": "Second Hold",
"description": "Has second priority if the first hold cancels",
"notification": true
}
],
"billable_items": [
{
"name": "NAS Storage",
"id": 2342354,
"description": "Rented per TB, per month",
"cost": "25.23",
"buy_cost": "20",
"currency": "AUD",
"quantity": "4",
"billable_item_id": 897832,
"taxes": [
{
"id": 3247,
"name": "GST",
"rate": "10.00",
"total": "151.00"
}
],
"create_new": true
}
],
"custom_fields": [
{
"id": 7823,
"name": "Type",
"value": "Video Editing",
"value_id": 8973,
"update_key": "2_1_7823"
}
]
}
'import requests
url = "https://api.sonderplan.com/v2/booking"
payload = {
"name": "Test Booking",
"start": 1547501100,
"end": 1547538900,
"id": 1,
"start_date_time_iso": "2022-02-22T09:00:00+11:00",
"end_date_time_iso": "2022-02-22T17:00:00+11:00",
"all_day": "false",
"notes": "Additional note",
"repeat_master": "true",
"repeat_master_id": "0",
"repeat_rule": "FREQ=daily;INTERVAL=2;REPENDTYPE=date;UNTIL=20220228T130000;",
"resources": [
{
"id": 9458,
"rates": [
{
"rate_scheme_id": 984312,
"rate_scheme_name": "Resource Rate",
"currency": "AUD",
"buy": {
"unit": "hourly",
"unit_amount": "20.65",
"quantity": "2.4",
"discount": "20.00%"
},
"sell": {
"unit": "hourly",
"unit_amount": "20.65",
"quantity": "2.4",
"discount": "20.00%"
}
}
],
"time_entries": [
{
"name": "Colour Grading",
"description": "Opening scenes completed",
"start": 1547501100,
"end": 1547538900
}
]
}
],
"project": [
{
"id": 2342354,
"start": 1547501100,
"end": 1547538900
}
],
"client": [
{
"uuid": "p4",
"contact_person": { "id": 2837 }
}
],
"status": [
{
"name": "Second Hold",
"description": "Has second priority if the first hold cancels",
"notification": True
}
],
"billable_items": [
{
"name": "NAS Storage",
"id": 2342354,
"description": "Rented per TB, per month",
"cost": "25.23",
"buy_cost": "20",
"currency": "AUD",
"quantity": "4",
"billable_item_id": 897832,
"taxes": [
{
"id": 3247,
"name": "GST",
"rate": "10.00",
"total": "151.00"
}
],
"create_new": True
}
],
"custom_fields": [
{
"id": 7823,
"name": "Type",
"value": "Video Editing",
"value_id": 8973,
"update_key": "2_1_7823"
}
]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'Test Booking',
start: 1547501100,
end: 1547538900,
id: 1,
start_date_time_iso: '2022-02-22T09:00:00+11:00',
end_date_time_iso: '2022-02-22T17:00:00+11:00',
all_day: 'false',
notes: 'Additional note',
repeat_master: 'true',
repeat_master_id: '0',
repeat_rule: 'FREQ=daily;INTERVAL=2;REPENDTYPE=date;UNTIL=20220228T130000;',
resources: [
{
id: 9458,
rates: [
{
rate_scheme_id: 984312,
rate_scheme_name: 'Resource Rate',
currency: 'AUD',
buy: {unit: 'hourly', unit_amount: '20.65', quantity: '2.4', discount: '20.00%'},
sell: {unit: 'hourly', unit_amount: '20.65', quantity: '2.4', discount: '20.00%'}
}
],
time_entries: [
{
name: 'Colour Grading',
description: 'Opening scenes completed',
start: 1547501100,
end: 1547538900
}
]
}
],
project: [{id: 2342354, start: 1547501100, end: 1547538900}],
client: [{uuid: 'p4', contact_person: {id: 2837}}],
status: [
{
name: 'Second Hold',
description: 'Has second priority if the first hold cancels',
notification: true
}
],
billable_items: [
{
name: 'NAS Storage',
id: 2342354,
description: 'Rented per TB, per month',
cost: '25.23',
buy_cost: '20',
currency: 'AUD',
quantity: '4',
billable_item_id: 897832,
taxes: [{id: 3247, name: 'GST', rate: '10.00', total: '151.00'}],
create_new: true
}
],
custom_fields: [
{
id: 7823,
name: 'Type',
value: 'Video Editing',
value_id: 8973,
update_key: '2_1_7823'
}
]
})
};
fetch('https://api.sonderplan.com/v2/booking', 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.sonderplan.com/v2/booking",
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([
'name' => 'Test Booking',
'start' => 1547501100,
'end' => 1547538900,
'id' => 1,
'start_date_time_iso' => '2022-02-22T09:00:00+11:00',
'end_date_time_iso' => '2022-02-22T17:00:00+11:00',
'all_day' => 'false',
'notes' => 'Additional note',
'repeat_master' => 'true',
'repeat_master_id' => '0',
'repeat_rule' => 'FREQ=daily;INTERVAL=2;REPENDTYPE=date;UNTIL=20220228T130000;',
'resources' => [
[
'id' => 9458,
'rates' => [
[
'rate_scheme_id' => 984312,
'rate_scheme_name' => 'Resource Rate',
'currency' => 'AUD',
'buy' => [
'unit' => 'hourly',
'unit_amount' => '20.65',
'quantity' => '2.4',
'discount' => '20.00%'
],
'sell' => [
'unit' => 'hourly',
'unit_amount' => '20.65',
'quantity' => '2.4',
'discount' => '20.00%'
]
]
],
'time_entries' => [
[
'name' => 'Colour Grading',
'description' => 'Opening scenes completed',
'start' => 1547501100,
'end' => 1547538900
]
]
]
],
'project' => [
[
'id' => 2342354,
'start' => 1547501100,
'end' => 1547538900
]
],
'client' => [
[
'uuid' => 'p4',
'contact_person' => [
'id' => 2837
]
]
],
'status' => [
[
'name' => 'Second Hold',
'description' => 'Has second priority if the first hold cancels',
'notification' => true
]
],
'billable_items' => [
[
'name' => 'NAS Storage',
'id' => 2342354,
'description' => 'Rented per TB, per month',
'cost' => '25.23',
'buy_cost' => '20',
'currency' => 'AUD',
'quantity' => '4',
'billable_item_id' => 897832,
'taxes' => [
[
'id' => 3247,
'name' => 'GST',
'rate' => '10.00',
'total' => '151.00'
]
],
'create_new' => true
]
],
'custom_fields' => [
[
'id' => 7823,
'name' => 'Type',
'value' => 'Video Editing',
'value_id' => 8973,
'update_key' => '2_1_7823'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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.sonderplan.com/v2/booking"
payload := strings.NewReader("{\n \"name\": \"Test Booking\",\n \"start\": 1547501100,\n \"end\": 1547538900,\n \"id\": 1,\n \"start_date_time_iso\": \"2022-02-22T09:00:00+11:00\",\n \"end_date_time_iso\": \"2022-02-22T17:00:00+11:00\",\n \"all_day\": \"false\",\n \"notes\": \"Additional note\",\n \"repeat_master\": \"true\",\n \"repeat_master_id\": \"0\",\n \"repeat_rule\": \"FREQ=daily;INTERVAL=2;REPENDTYPE=date;UNTIL=20220228T130000;\",\n \"resources\": [\n {\n \"id\": 9458,\n \"rates\": [\n {\n \"rate_scheme_id\": 984312,\n \"rate_scheme_name\": \"Resource Rate\",\n \"currency\": \"AUD\",\n \"buy\": {\n \"unit\": \"hourly\",\n \"unit_amount\": \"20.65\",\n \"quantity\": \"2.4\",\n \"discount\": \"20.00%\"\n },\n \"sell\": {\n \"unit\": \"hourly\",\n \"unit_amount\": \"20.65\",\n \"quantity\": \"2.4\",\n \"discount\": \"20.00%\"\n }\n }\n ],\n \"time_entries\": [\n {\n \"name\": \"Colour Grading\",\n \"description\": \"Opening scenes completed\",\n \"start\": 1547501100,\n \"end\": 1547538900\n }\n ]\n }\n ],\n \"project\": [\n {\n \"id\": 2342354,\n \"start\": 1547501100,\n \"end\": 1547538900\n }\n ],\n \"client\": [\n {\n \"uuid\": \"p4\",\n \"contact_person\": {\n \"id\": 2837\n }\n }\n ],\n \"status\": [\n {\n \"name\": \"Second Hold\",\n \"description\": \"Has second priority if the first hold cancels\",\n \"notification\": true\n }\n ],\n \"billable_items\": [\n {\n \"name\": \"NAS Storage\",\n \"id\": 2342354,\n \"description\": \"Rented per TB, per month\",\n \"cost\": \"25.23\",\n \"buy_cost\": \"20\",\n \"currency\": \"AUD\",\n \"quantity\": \"4\",\n \"billable_item_id\": 897832,\n \"taxes\": [\n {\n \"id\": 3247,\n \"name\": \"GST\",\n \"rate\": \"10.00\",\n \"total\": \"151.00\"\n }\n ],\n \"create_new\": true\n }\n ],\n \"custom_fields\": [\n {\n \"id\": 7823,\n \"name\": \"Type\",\n \"value\": \"Video Editing\",\n \"value_id\": 8973,\n \"update_key\": \"2_1_7823\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.sonderplan.com/v2/booking")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Test Booking\",\n \"start\": 1547501100,\n \"end\": 1547538900,\n \"id\": 1,\n \"start_date_time_iso\": \"2022-02-22T09:00:00+11:00\",\n \"end_date_time_iso\": \"2022-02-22T17:00:00+11:00\",\n \"all_day\": \"false\",\n \"notes\": \"Additional note\",\n \"repeat_master\": \"true\",\n \"repeat_master_id\": \"0\",\n \"repeat_rule\": \"FREQ=daily;INTERVAL=2;REPENDTYPE=date;UNTIL=20220228T130000;\",\n \"resources\": [\n {\n \"id\": 9458,\n \"rates\": [\n {\n \"rate_scheme_id\": 984312,\n \"rate_scheme_name\": \"Resource Rate\",\n \"currency\": \"AUD\",\n \"buy\": {\n \"unit\": \"hourly\",\n \"unit_amount\": \"20.65\",\n \"quantity\": \"2.4\",\n \"discount\": \"20.00%\"\n },\n \"sell\": {\n \"unit\": \"hourly\",\n \"unit_amount\": \"20.65\",\n \"quantity\": \"2.4\",\n \"discount\": \"20.00%\"\n }\n }\n ],\n \"time_entries\": [\n {\n \"name\": \"Colour Grading\",\n \"description\": \"Opening scenes completed\",\n \"start\": 1547501100,\n \"end\": 1547538900\n }\n ]\n }\n ],\n \"project\": [\n {\n \"id\": 2342354,\n \"start\": 1547501100,\n \"end\": 1547538900\n }\n ],\n \"client\": [\n {\n \"uuid\": \"p4\",\n \"contact_person\": {\n \"id\": 2837\n }\n }\n ],\n \"status\": [\n {\n \"name\": \"Second Hold\",\n \"description\": \"Has second priority if the first hold cancels\",\n \"notification\": true\n }\n ],\n \"billable_items\": [\n {\n \"name\": \"NAS Storage\",\n \"id\": 2342354,\n \"description\": \"Rented per TB, per month\",\n \"cost\": \"25.23\",\n \"buy_cost\": \"20\",\n \"currency\": \"AUD\",\n \"quantity\": \"4\",\n \"billable_item_id\": 897832,\n \"taxes\": [\n {\n \"id\": 3247,\n \"name\": \"GST\",\n \"rate\": \"10.00\",\n \"total\": \"151.00\"\n }\n ],\n \"create_new\": true\n }\n ],\n \"custom_fields\": [\n {\n \"id\": 7823,\n \"name\": \"Type\",\n \"value\": \"Video Editing\",\n \"value_id\": 8973,\n \"update_key\": \"2_1_7823\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sonderplan.com/v2/booking")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Test Booking\",\n \"start\": 1547501100,\n \"end\": 1547538900,\n \"id\": 1,\n \"start_date_time_iso\": \"2022-02-22T09:00:00+11:00\",\n \"end_date_time_iso\": \"2022-02-22T17:00:00+11:00\",\n \"all_day\": \"false\",\n \"notes\": \"Additional note\",\n \"repeat_master\": \"true\",\n \"repeat_master_id\": \"0\",\n \"repeat_rule\": \"FREQ=daily;INTERVAL=2;REPENDTYPE=date;UNTIL=20220228T130000;\",\n \"resources\": [\n {\n \"id\": 9458,\n \"rates\": [\n {\n \"rate_scheme_id\": 984312,\n \"rate_scheme_name\": \"Resource Rate\",\n \"currency\": \"AUD\",\n \"buy\": {\n \"unit\": \"hourly\",\n \"unit_amount\": \"20.65\",\n \"quantity\": \"2.4\",\n \"discount\": \"20.00%\"\n },\n \"sell\": {\n \"unit\": \"hourly\",\n \"unit_amount\": \"20.65\",\n \"quantity\": \"2.4\",\n \"discount\": \"20.00%\"\n }\n }\n ],\n \"time_entries\": [\n {\n \"name\": \"Colour Grading\",\n \"description\": \"Opening scenes completed\",\n \"start\": 1547501100,\n \"end\": 1547538900\n }\n ]\n }\n ],\n \"project\": [\n {\n \"id\": 2342354,\n \"start\": 1547501100,\n \"end\": 1547538900\n }\n ],\n \"client\": [\n {\n \"uuid\": \"p4\",\n \"contact_person\": {\n \"id\": 2837\n }\n }\n ],\n \"status\": [\n {\n \"name\": \"Second Hold\",\n \"description\": \"Has second priority if the first hold cancels\",\n \"notification\": true\n }\n ],\n \"billable_items\": [\n {\n \"name\": \"NAS Storage\",\n \"id\": 2342354,\n \"description\": \"Rented per TB, per month\",\n \"cost\": \"25.23\",\n \"buy_cost\": \"20\",\n \"currency\": \"AUD\",\n \"quantity\": \"4\",\n \"billable_item_id\": 897832,\n \"taxes\": [\n {\n \"id\": 3247,\n \"name\": \"GST\",\n \"rate\": \"10.00\",\n \"total\": \"151.00\"\n }\n ],\n \"create_new\": true\n }\n ],\n \"custom_fields\": [\n {\n \"id\": 7823,\n \"name\": \"Type\",\n \"value\": \"Video Editing\",\n \"value_id\": 8973,\n \"update_key\": \"2_1_7823\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"success": {
"id": 1
}
}{
"error": {
"code": "404",
"message": "Requested resource was not found"
}
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Query Parameters
Report any clashes with new resources supplied, or existing resources on the booking
Specifies if user resources (resources with a contact attached) should be sent an email notification about the created booking
Body
Booking object that needs to be added
Standard booking model that returns most properties by default
Booking Name
"Test Booking"
Unix Timestamp of the booking start. Alternatively use start_date_time_iso which automatically calculates the unix timestamp.
1547501100
Unix timestamp of the booking end. Alternatively use end_date_time_iso which automatically calculates the unix timestamp.
1547538900
Booking ID
1
ISO-8601 formatted result of the booking start
"2022-02-22T09:00:00+11:00"
ISO-8601 formatted result of the booking end
"2022-02-22T17:00:00+11:00"
Is the booking all day
"false"
Additional booking information
"Additional note"
Is this booking designated as the master booking linked to repeats
"true"
If this booking is a repeat, this is the id of the master booking
"0"
Specifically formatted rule for the repeat logic
"FREQ=daily;INTERVAL=2;REPENDTYPE=date;UNTIL=20220228T130000;"
Show child attributes
Show child attributes
Show child attributes
Show child attributes
The client (either person or organization) attached to this booking
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Response
Successful Operation
Show child attributes
Show child attributes