Availability routes: set
The Availability Verbs set as api.sb routes, with inputs, result, refusals and an example.
Reference for Availability, one group of Availability routes.
Availability.set
Set records the weekly hours a Worker can be booked in and the calendars whose busy times it subtracts. Verb page.
POST /{namespace}/ availabilities/ setBody, as JSON: the inputs. Emits Availability.set.
Inputs
| Input | Type | Required | Description |
|---|---|---|---|
worker | Worker | required | Who is booked. |
hours | json | required | Open hours by weekday. |
timezone | string | required | An IANA time zone. |
calendars | string[] | Connected calendars to subtract busy times from. |
Returns
| Output | Type | Required | Description |
|---|---|---|---|
availability | Availability | required | The Availability, replacing the Worker’s last one. |
Refuses when
| Check | Error | Fix | Then call |
|---|---|---|---|
| The key is valid, but its scopes do not allow this operation. | forbidden | Use a key whose scopes cover the operation, or ask an owner of the namespace to grant them. | None. |
Example
curl -X POST https: //api.sb/ leaseline.app/ availabilities/ set \
-H "Authorization: Bearer $STARTUP_BUILDER_API_KEY" \
-H "Content-Type: application/ json" \
-d '{"worker": "worker_whZFpOKWIV", "hours": {"tue": ["09: 00-12: 00"], "thu": ["13: 00-17: 00"]}, "timezone": "America/ Chicago"}'{
"api": "https: //api.sb/ leaseline.app",
"availability": {
"$id": "https: //api.sb/ leaseline.app/ availabilities/ availability_8Zj0a7vvRl",
"$type": "Availability",
"worker": "worker_whZFpOKWIV",
"hours": {
"mon": [
"09: 00-12: 00"
],
"thu": [
"13: 00-17: 00"
]
},
"timezone": "America/ Chicago"
},
"action": {
"$id": "https: //api.sb/ leaseline.app/ actions/ act_br07HsG8MG",
"operation": "Availability.set",
"status": "done"
},
"links": {
"self": "https: //api.sb/ leaseline.app/ actions/ act_br07HsG8MG"
}
}