curl -X POST "https://api.playground.try.be/shop/yield-rules" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{
"site_id": "00000000-0000-0000-0000-000000000000",
"offerings": [
{
"offering_type": "appointment",
"offering_id": "00000000-0000-0000-0000-000000000000"
}
],
"weekdays": [
"monday"
],
"time_from": "12:00",
"time_to": "21:00",
"triggers": {
"practitioner_utilisation": {
"from": 70,
"to": 90
},
"room_occupancy": {
"from": 70,
"to": 90
}
},
"adjustment": {
"type": "amount",
"value": 15
},
"rounding": "one",
"reporting_tier": "low",
"reduction_advance_interval": "P2D"
}'
const response = await fetch('https://api.playground.try.be/shop/yield-rules', {
method: 'POST',
headers: {
Authorization: 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json',
Accept: 'application/json',
},
body: JSON.stringify({
"site_id": "00000000-0000-0000-0000-000000000000",
"offerings": [
{
"offering_type": "appointment",
"offering_id": "00000000-0000-0000-0000-000000000000"
}
],
"weekdays": [
"monday"
],
"time_from": "12:00",
"time_to": "21:00",
"triggers": {
"practitioner_utilisation": {
"from": 70,
"to": 90
},
"room_occupancy": {
"from": 70,
"to": 90
}
},
"adjustment": {
"type": "amount",
"value": 15
},
"rounding": "one",
"reporting_tier": "low",
"reduction_advance_interval": "P2D"
}),
})
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/yield-rules",
headers={
"Authorization": "Bearer YOUR_API_KEY",
"Accept": "application/json",
"Content-Type": "application/json",
},
json={
"site_id": "00000000-0000-0000-0000-000000000000",
"offerings": [
{
"offering_type": "appointment",
"offering_id": "00000000-0000-0000-0000-000000000000"
}
],
"weekdays": [
"monday"
],
"time_from": "12:00",
"time_to": "21:00",
"triggers": {
"practitioner_utilisation": {
"from": 70,
"to": 90
},
"room_occupancy": {
"from": 70,
"to": 90
}
},
"adjustment": {
"type": "amount",
"value": 15
},
"rounding": "one",
"reporting_tier": "low",
"reduction_advance_interval": "P2D"
},
)
response.raise_for_status()
data = response.json()
<?php
$client = new \GuzzleHttp\Client();
$response = $client->request('POST', 'https://api.playground.try.be/shop/yield-rules', [
'headers' => [
'Authorization' => 'Bearer YOUR_API_KEY',
'Accept' => 'application/json',
'Content-Type' => 'application/json',
],
'json' => [
'site_id' => '00000000-0000-0000-0000-000000000000',
'offerings' => [
[
'offering_type' => 'appointment',
'offering_id' => '00000000-0000-0000-0000-000000000000'
]
],
'weekdays' => [
'monday'
],
'time_from' => '12:00',
'time_to' => '21:00',
'triggers' => [
'practitioner_utilisation' => [
'from' => 70,
'to' => 90
],
'room_occupancy' => [
'from' => 70,
'to' => 90
]
],
'adjustment' => [
'type' => 'amount',
'value' => 15
],
'rounding' => 'one',
'reporting_tier' => 'low',
'reduction_advance_interval' => 'P2D'
],
]);
$data = json_decode($response->getBody(), true);
package main
import (
"bytes"
"encoding/json"
"net/http"
)
func main() {
payload, _ := json.Marshal(map[string]interface{}{
"site_id": "00000000-0000-0000-0000-000000000000",
"offerings": []interface{}{
map[string]interface{}{
"offering_type": "appointment",
"offering_id": "00000000-0000-0000-0000-000000000000",
},
},
"weekdays": []interface{}{
"monday",
},
"time_from": "12:00",
"time_to": "21:00",
"triggers": map[string]interface{}{
"practitioner_utilisation": map[string]interface{}{
"from": 70,
"to": 90,
},
"room_occupancy": map[string]interface{}{
"from": 70,
"to": 90,
},
},
"adjustment": map[string]interface{}{
"type": "amount",
"value": 15,
},
"rounding": "one",
"reporting_tier": "low",
"reduction_advance_interval": "P2D",
})
req, _ := http.NewRequest("POST", "https://api.playground.try.be/shop/yield-rules", 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)
}