Saltar al contenido principal

Update Weekly Availability

This endpoint allows you to update an existing weekly availability schedule. Only the fields you provide will be modified, while others remain unchanged.

🔹 Endpoint Details

PUT /api/v1/weekly-schedules/{id}

🔒 Authentication

HeaderRequiredDescription
Content-TypeYesMust be application/json
AuthorizationYesFormat: ONLIVESITE Credential:ONLIVEAccessKeyId, Signature=CalculatedSignature

📝 Request Structure

Path Parameters

ParameterTypeRequiredDescriptionExample
idstring (UUID)YesUnique identifier of the schedule"f57b71ad-c1cc-4af6-853b-616ecb7d234c"

Updatable Fields

FieldTypeRequiredDescriptionExample
namestringNoNew schedule name"Updated Availability"
configurationobjectNoSchedule configurationSee configuration structure
serviceIdsstring[]NoAssociated services["uuid1", "uuid2"]
timezonestringNoIANA timezone name"Europe/Madrid"

Configuration Structure

FieldTypeRequiredDescription
workingHoursobjectNoDay-based schedule updates
dateOverridesobjectNoSpecial date schedule updates
outsOfTheOfficearrayNoOut-of-office period updates

🧩 Request Example

curl -X PUT "https://openapi.onlive.site/api/v1/weekly-schedules/f57b71ad-c1cc-4af6-853b-616ecb7d234c" \
-H "Content-Type: application/json" \
-H "Authorization: ONLIVESITE Credential:ONLIVEAccessKeyId, Signature=CalculatedSignature" \
-d '{
"configuration": {
"workingHours": {
"0": [
[
"09:00",
"14:00"
],
[
"16:00",
"20:30"
]
],
"1": [
[
"09:00",
"14:00"
],
[
"16:00",
"20:30"
]
],
"2": [
[
"09:00",
"14:00"
],
[
"16:00",
"20:30"
]
],
"3": [
[
"09:00",
"14:00"
],
[
"16:00",
"20:30"
]
],
"4": [
[
"09:00",
"14:00"
],
[
"16:00",
"20:30"
]
],
"5": [
[
"10:00",
"14:00"
]
],
"6": []
},
"dateOverrides": {
"2025-03-19": [
[
"08:00",
"12:00"
]
]
},
"outsOfTheOffice": [
[
"2025-03-06T18:57",
"2025-03-07T18:57"
]
]
},
"serviceIds": [
"1c79cfed-2076-438c-99f4-1c26da94ab0b",
"1c79cfed-2076-438c-99f4-1c26da94ab43"
]
}'

📤 Response Format

Successful Response (200 OK)

{
"id": "f57b71ad-c1cc-4af6-853b-616ecb7d234c",
"createdAt": "2025-05-22T12:45:06.490Z",
"updatedAt": "2025-05-22T13:00:00.490Z"
// ... updated schedule object
}

❌ Error Responses

400 Bad Request

{
"statusCode": 400,
"message": "Invalid input",
"errors": [
{
"field": "configuration.workingHours",
"message": "Invalid time format"
}
]
}

401 Unauthorized

{
"statusCode": 401,
"message": "Invalid or missing authorization credentials"
}

404 Not Found

{
"statusCode": 404,
"message": "Schedule not found"
}

📘 Notes

  • Only include fields you want to update
  • The updatedAt timestamp is automatically updated
  • Omitted fields retain their current values
  • Changes affect future availability only
  • Existing appointments are not affected
  • Time slots must be in schedule's timezone

✅ Common Use Cases

  • 📝 Schedule Adjustment: Modify working hours
  • 🔄 Service Association: Update linked services
  • 🕒 Special Hours: Add or modify date overrides
  • 🏖️ Vacation Planning: Update out-of-office periods
  • ⚙️ Configuration: Adjust timezone settings

🔍 Update Restrictions

  1. Immutable Fields

    • Schedule ID
    • Organization ID
    • Creation timestamp
    • Calendar ID
  2. Time Updates

    • Must maintain valid time formats
    • No overlapping time slots
    • Future-dated changes only
  3. Service Updates

    • Services must exist
    • Services must be in your organization
    • Previous associations are replaced

🏷️ Field Validation

  1. Time Values

    • Must be in "HH:mm" format
    • End time after start time
    • Valid hours (00-23)
    • Valid minutes (00-59)
  2. Date Values

    • ISO 8601 format for out-of-office
    • "YYYY-MM-DD" for overrides
    • Future dates only
  3. Configuration

    • Valid day numbers (0-6)
    • No overlapping slots
    • Valid timezone names