curl -X POST "https://api.playground.try.be/shop/rooms" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{
"name": "Treatment Room 1",
"capacity": 1,
"site_id": "0193b6e0-3b56-7000-9f50-9d3d5e2c2222",
"organisation_id": "00000000-0000-0000-0000-000000000000",
"use_custom_opening_hours": false,
"availability_rules": [
{
"weekday": "monday",
"time_from": "09:00",
"time_to": "17:00"
}
],
"suitable_for_tags": [
"64a9f3b2c3d8e1f4a5b6c7d8"
],
"tag_ids": [
"64a9f3b2c3d8e1f4a5b6c7d8"
],
"zone_ids": [
"64a9f3b2c3d8e1f4a5b6c7d8"
]
}'
const response = await fetch('https://api.playground.try.be/shop/rooms', {
method: 'POST',
headers: {
Authorization: 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json',
Accept: 'application/json',
},
body: JSON.stringify({
"name": "Treatment Room 1",
"capacity": 1,
"site_id": "0193b6e0-3b56-7000-9f50-9d3d5e2c2222",
"organisation_id": "00000000-0000-0000-0000-000000000000",
"use_custom_opening_hours": false,
"availability_rules": [
{
"weekday": "monday",
"time_from": "09:00",
"time_to": "17:00"
}
],
"suitable_for_tags": [
"64a9f3b2c3d8e1f4a5b6c7d8"
],
"tag_ids": [
"64a9f3b2c3d8e1f4a5b6c7d8"
],
"zone_ids": [
"64a9f3b2c3d8e1f4a5b6c7d8"
]
}),
})
if (!response.ok) {
throw new Error(`Trybe API ${response.status}: ${await response.text()}`)
}
const data = await response.json()
import httpx
response = httpx.post(
"https://api.playground.try.be/shop/rooms",
headers={
"Authorization": "Bearer YOUR_API_KEY",
"Accept": "application/json",
"Content-Type": "application/json",
},
json={
"name": "Treatment Room 1",
"capacity": 1,
"site_id": "0193b6e0-3b56-7000-9f50-9d3d5e2c2222",
"organisation_id": "00000000-0000-0000-0000-000000000000",
"use_custom_opening_hours": False,
"availability_rules": [
{
"weekday": "monday",
"time_from": "09:00",
"time_to": "17:00"
}
],
"suitable_for_tags": [
"64a9f3b2c3d8e1f4a5b6c7d8"
],
"tag_ids": [
"64a9f3b2c3d8e1f4a5b6c7d8"
],
"zone_ids": [
"64a9f3b2c3d8e1f4a5b6c7d8"
]
},
)
response.raise_for_status()
data = response.json()
<?php
$client = new \GuzzleHttp\Client();
$response = $client->request('POST', 'https://api.playground.try.be/shop/rooms', [
'headers' => [
'Authorization' => 'Bearer YOUR_API_KEY',
'Accept' => 'application/json',
'Content-Type' => 'application/json',
],
'json' => [
'name' => 'Treatment Room 1',
'capacity' => 1,
'site_id' => '0193b6e0-3b56-7000-9f50-9d3d5e2c2222',
'organisation_id' => '00000000-0000-0000-0000-000000000000',
'use_custom_opening_hours' => false,
'availability_rules' => [
[
'weekday' => 'monday',
'time_from' => '09:00',
'time_to' => '17:00'
]
],
'suitable_for_tags' => [
'64a9f3b2c3d8e1f4a5b6c7d8'
],
'tag_ids' => [
'64a9f3b2c3d8e1f4a5b6c7d8'
],
'zone_ids' => [
'64a9f3b2c3d8e1f4a5b6c7d8'
]
],
]);
$data = json_decode($response->getBody(), true);
package main
import (
"bytes"
"encoding/json"
"net/http"
)
func main() {
payload, _ := json.Marshal(map[string]interface{}{
"name": "Treatment Room 1",
"capacity": 1,
"site_id": "0193b6e0-3b56-7000-9f50-9d3d5e2c2222",
"organisation_id": "00000000-0000-0000-0000-000000000000",
"use_custom_opening_hours": false,
"availability_rules": []interface{}{
map[string]interface{}{
"weekday": "monday",
"time_from": "09:00",
"time_to": "17:00",
},
},
"suitable_for_tags": []interface{}{
"64a9f3b2c3d8e1f4a5b6c7d8",
},
"tag_ids": []interface{}{
"64a9f3b2c3d8e1f4a5b6c7d8",
},
"zone_ids": []interface{}{
"64a9f3b2c3d8e1f4a5b6c7d8",
},
})
req, _ := http.NewRequest("POST", "https://api.playground.try.be/shop/rooms", bytes.NewBuffer(payload))
req.Header.Set("Authorization", "Bearer YOUR_API_KEY")
req.Header.Set("Accept", "application/json")
req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
var data map[string]interface{}
json.NewDecoder(resp.Body).Decode(&data)
}