Trouble updating working hours via API – schedule not saving changes #24008
Replies: 4 comments 2 replies
-
|
Hi @ooommmp! I'm Dosu and I’m helping the cal.com team. You need to update both the To reply, just mention @dosu. How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other |
Beta Was this translation helpful? Give feedback.
-
|
When i try with { I get a 400 Bad request error |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
|
{ it now rreturns a 500 code the api key is correct and corrrect everything is this on ccal.com side |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Body:
Hi, I’m trying to update working hours on a schedule via the API but the changes don’t seem to persist.
Here’s what I’m doing:
curl --location --request PATCH 'https://api.cal.com/v2/schedules/860961'
--header 'Content-Type: application/json'
--header 'Authorization: Bearer <my_token>'
--data '{
"workingHours": [
{
"days": [1, 2, 4, 5],
"startTime": 480,
"endTime": 1020
}
]
}'
But when I fetch the schedule afterwards with:
curl --location 'https://api.cal.com/v2/schedules/860961'
--header 'Authorization: Bearer <my_token>'
I still see this:
"workingHours": [
{
"days": [1, 2, 3, 4, 5],
"startTime": 540,
"endTime": 1020,
"userId": 1730116
}
],
"schedule": [
{
"days": [1, 2, 3, 4, 5],
"startTime": "1970-01-01T09:00:00.000Z",
"endTime": "1970-01-01T17:00:00.000Z"
}
]
It seems to always revert to Mon–Fri, 09:00–17:00.
What I actually want is:
• Schedule 1
• Mon–Fri: 09:00–13:00 and 14:00–18:00
• Sat: 09:00–13:00
• Sun: closed
• Schedule 2
• Mon: 08:00–17:00
• Tue: 08:00–17:00
• Wed: 08:00–17:00
• Thu: 08:00–17:00
• Fri: 08:00–17:00
• Sat: closed
• Sun: closed
Am I using the API incorrectly, or do I also need to update the schedule array alongside workingHours?
Thanks in advance! 🙏
Beta Was this translation helpful? Give feedback.
All reactions