Precalculate a possible booking
curl --request POST \
--url https://b.anny.co/api/v1/order/bookings/calculate \
--header 'Content-Type: application/vnd.api+json' \
--data '
{
"resource_id": "22230",
"service_id": "2800",
"start_date": "2021-10-04T13:00:00+02:00",
"end_date": "2021-10-04T17:00:00+02:00",
"description": "",
"customer_note": "",
"booking_add_ons": [
{
"add_on_id": "239",
"quantity": 2
}
],
"sub_bookings": [
{
"resource_id": "21888",
"service_id": "2777",
"quantity": 1
}
],
"quantity": 1,
"custom_fields": {}
}
'import requests
url = "https://b.anny.co/api/v1/order/bookings/calculate"
payload = {
"resource_id": "22230",
"service_id": "2800",
"start_date": "2021-10-04T13:00:00+02:00",
"end_date": "2021-10-04T17:00:00+02:00",
"description": "",
"customer_note": "",
"booking_add_ons": [
{
"add_on_id": "239",
"quantity": 2
}
],
"sub_bookings": [
{
"resource_id": "21888",
"service_id": "2777",
"quantity": 1
}
],
"quantity": 1,
"custom_fields": {}
}
headers = {"Content-Type": "application/vnd.api+json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/vnd.api+json'},
body: JSON.stringify({
resource_id: '22230',
service_id: '2800',
start_date: '2021-10-04T13:00:00+02:00',
end_date: '2021-10-04T17:00:00+02:00',
description: '',
customer_note: '',
booking_add_ons: [{add_on_id: '239', quantity: 2}],
sub_bookings: [{resource_id: '21888', service_id: '2777', quantity: 1}],
quantity: 1,
custom_fields: {}
})
};
fetch('https://b.anny.co/api/v1/order/bookings/calculate', 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://b.anny.co/api/v1/order/bookings/calculate",
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([
'resource_id' => '22230',
'service_id' => '2800',
'start_date' => '2021-10-04T13:00:00+02:00',
'end_date' => '2021-10-04T17:00:00+02:00',
'description' => '',
'customer_note' => '',
'booking_add_ons' => [
[
'add_on_id' => '239',
'quantity' => 2
]
],
'sub_bookings' => [
[
'resource_id' => '21888',
'service_id' => '2777',
'quantity' => 1
]
],
'quantity' => 1,
'custom_fields' => [
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/vnd.api+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://b.anny.co/api/v1/order/bookings/calculate"
payload := strings.NewReader("{\n \"resource_id\": \"22230\",\n \"service_id\": \"2800\",\n \"start_date\": \"2021-10-04T13:00:00+02:00\",\n \"end_date\": \"2021-10-04T17:00:00+02:00\",\n \"description\": \"\",\n \"customer_note\": \"\",\n \"booking_add_ons\": [\n {\n \"add_on_id\": \"239\",\n \"quantity\": 2\n }\n ],\n \"sub_bookings\": [\n {\n \"resource_id\": \"21888\",\n \"service_id\": \"2777\",\n \"quantity\": 1\n }\n ],\n \"quantity\": 1,\n \"custom_fields\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/vnd.api+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://b.anny.co/api/v1/order/bookings/calculate")
.header("Content-Type", "application/vnd.api+json")
.body("{\n \"resource_id\": \"22230\",\n \"service_id\": \"2800\",\n \"start_date\": \"2021-10-04T13:00:00+02:00\",\n \"end_date\": \"2021-10-04T17:00:00+02:00\",\n \"description\": \"\",\n \"customer_note\": \"\",\n \"booking_add_ons\": [\n {\n \"add_on_id\": \"239\",\n \"quantity\": 2\n }\n ],\n \"sub_bookings\": [\n {\n \"resource_id\": \"21888\",\n \"service_id\": \"2777\",\n \"quantity\": 1\n }\n ],\n \"quantity\": 1,\n \"custom_fields\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://b.anny.co/api/v1/order/bookings/calculate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/vnd.api+json'
request.body = "{\n \"resource_id\": \"22230\",\n \"service_id\": \"2800\",\n \"start_date\": \"2021-10-04T13:00:00+02:00\",\n \"end_date\": \"2021-10-04T17:00:00+02:00\",\n \"description\": \"\",\n \"customer_note\": \"\",\n \"booking_add_ons\": [\n {\n \"add_on_id\": \"239\",\n \"quantity\": 2\n }\n ],\n \"sub_bookings\": [\n {\n \"resource_id\": \"21888\",\n \"service_id\": \"2777\",\n \"quantity\": 1\n }\n ],\n \"quantity\": 1,\n \"custom_fields\": {}\n}"
response = http.request(request)
puts response.read_body{
"start_date": "2021-10-06T07:00:00+00:00",
"end_date": "2021-10-06T11:00:00+00:00",
"subtotal": 249,
"total": 277,
"gross_amount": 277,
"net_amount": 232.77,
"tax_amount": 44.23,
"charged_duration": 240,
"currency": "EUR",
"service": {
"id": 2800,
"name": "Coaching: Leadership - Empower Your Employees"
},
"resource": {
"id": 22230,
"name": "Leadership Coach"
},
"booking_add_ons": [
{
"add_on": {
"id": 239,
"name": "Vegan Food"
},
"total": 0,
"quantity": 3,
"currency": "EUR"
}
],
"sub_bookings": [
{
"total": 28,
"currency": "EUR",
"service": {
"id": 2777,
"name": "Basic"
},
"resource": {
"id": 21888,
"name": "C01 - London"
}
}
],
"quantity": 1
}Orders & Checkout
Precalculate a possible booking
This endpoint allows to precalculate a booking without creating it.
POST
/
api
/
v1
/
order
/
bookings
/
calculate
Precalculate a possible booking
curl --request POST \
--url https://b.anny.co/api/v1/order/bookings/calculate \
--header 'Content-Type: application/vnd.api+json' \
--data '
{
"resource_id": "22230",
"service_id": "2800",
"start_date": "2021-10-04T13:00:00+02:00",
"end_date": "2021-10-04T17:00:00+02:00",
"description": "",
"customer_note": "",
"booking_add_ons": [
{
"add_on_id": "239",
"quantity": 2
}
],
"sub_bookings": [
{
"resource_id": "21888",
"service_id": "2777",
"quantity": 1
}
],
"quantity": 1,
"custom_fields": {}
}
'import requests
url = "https://b.anny.co/api/v1/order/bookings/calculate"
payload = {
"resource_id": "22230",
"service_id": "2800",
"start_date": "2021-10-04T13:00:00+02:00",
"end_date": "2021-10-04T17:00:00+02:00",
"description": "",
"customer_note": "",
"booking_add_ons": [
{
"add_on_id": "239",
"quantity": 2
}
],
"sub_bookings": [
{
"resource_id": "21888",
"service_id": "2777",
"quantity": 1
}
],
"quantity": 1,
"custom_fields": {}
}
headers = {"Content-Type": "application/vnd.api+json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/vnd.api+json'},
body: JSON.stringify({
resource_id: '22230',
service_id: '2800',
start_date: '2021-10-04T13:00:00+02:00',
end_date: '2021-10-04T17:00:00+02:00',
description: '',
customer_note: '',
booking_add_ons: [{add_on_id: '239', quantity: 2}],
sub_bookings: [{resource_id: '21888', service_id: '2777', quantity: 1}],
quantity: 1,
custom_fields: {}
})
};
fetch('https://b.anny.co/api/v1/order/bookings/calculate', 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://b.anny.co/api/v1/order/bookings/calculate",
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([
'resource_id' => '22230',
'service_id' => '2800',
'start_date' => '2021-10-04T13:00:00+02:00',
'end_date' => '2021-10-04T17:00:00+02:00',
'description' => '',
'customer_note' => '',
'booking_add_ons' => [
[
'add_on_id' => '239',
'quantity' => 2
]
],
'sub_bookings' => [
[
'resource_id' => '21888',
'service_id' => '2777',
'quantity' => 1
]
],
'quantity' => 1,
'custom_fields' => [
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/vnd.api+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://b.anny.co/api/v1/order/bookings/calculate"
payload := strings.NewReader("{\n \"resource_id\": \"22230\",\n \"service_id\": \"2800\",\n \"start_date\": \"2021-10-04T13:00:00+02:00\",\n \"end_date\": \"2021-10-04T17:00:00+02:00\",\n \"description\": \"\",\n \"customer_note\": \"\",\n \"booking_add_ons\": [\n {\n \"add_on_id\": \"239\",\n \"quantity\": 2\n }\n ],\n \"sub_bookings\": [\n {\n \"resource_id\": \"21888\",\n \"service_id\": \"2777\",\n \"quantity\": 1\n }\n ],\n \"quantity\": 1,\n \"custom_fields\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/vnd.api+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://b.anny.co/api/v1/order/bookings/calculate")
.header("Content-Type", "application/vnd.api+json")
.body("{\n \"resource_id\": \"22230\",\n \"service_id\": \"2800\",\n \"start_date\": \"2021-10-04T13:00:00+02:00\",\n \"end_date\": \"2021-10-04T17:00:00+02:00\",\n \"description\": \"\",\n \"customer_note\": \"\",\n \"booking_add_ons\": [\n {\n \"add_on_id\": \"239\",\n \"quantity\": 2\n }\n ],\n \"sub_bookings\": [\n {\n \"resource_id\": \"21888\",\n \"service_id\": \"2777\",\n \"quantity\": 1\n }\n ],\n \"quantity\": 1,\n \"custom_fields\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://b.anny.co/api/v1/order/bookings/calculate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/vnd.api+json'
request.body = "{\n \"resource_id\": \"22230\",\n \"service_id\": \"2800\",\n \"start_date\": \"2021-10-04T13:00:00+02:00\",\n \"end_date\": \"2021-10-04T17:00:00+02:00\",\n \"description\": \"\",\n \"customer_note\": \"\",\n \"booking_add_ons\": [\n {\n \"add_on_id\": \"239\",\n \"quantity\": 2\n }\n ],\n \"sub_bookings\": [\n {\n \"resource_id\": \"21888\",\n \"service_id\": \"2777\",\n \"quantity\": 1\n }\n ],\n \"quantity\": 1,\n \"custom_fields\": {}\n}"
response = http.request(request)
puts response.read_body{
"start_date": "2021-10-06T07:00:00+00:00",
"end_date": "2021-10-06T11:00:00+00:00",
"subtotal": 249,
"total": 277,
"gross_amount": 277,
"net_amount": 232.77,
"tax_amount": 44.23,
"charged_duration": 240,
"currency": "EUR",
"service": {
"id": 2800,
"name": "Coaching: Leadership - Empower Your Employees"
},
"resource": {
"id": 22230,
"name": "Leadership Coach"
},
"booking_add_ons": [
{
"add_on": {
"id": 239,
"name": "Vegan Food"
},
"total": 0,
"quantity": 3,
"currency": "EUR"
}
],
"sub_bookings": [
{
"total": 28,
"currency": "EUR",
"service": {
"id": 2777,
"name": "Basic"
},
"resource": {
"id": 21888,
"name": "C01 - London"
}
}
],
"quantity": 1
}Abfrageparameter
Body
application/vnd.api+json
Antwort
200 - application/vnd.api+json
OK