Skip to content

Availability routes: update, delete

The Availability Verbs update, delete as api.sb routes, with inputs, result, refusals and an example.

Reference for Availability, one group of Availability routes.

Availability.update

Changes the given properties of an Availability. Verb page.

Text
PATCH /{namespace}/availabilities/{id}

Path: id. Body, as JSON: the other inputs. Emits Availability.updated.

Inputs

InputTypeRequiredDescription
idstringrequiredThe id of the Availability.
workerWorkerWho is booked: a Human, or an Agent that takes calls.
hoursjsonOpen hours by weekday, in its time zone.
timezonestringAn IANA time zone.
calendarsstring[]Connected calendars whose busy times it subtracts.
bufferintegerMinutes kept free before and after each Meeting.
noticeintegerThe fewest hours ahead a Meeting can be booked.

Returns

OutputTypeRequiredDescription
availabilityAvailabilityrequiredThe Availability.

Refuses when

CheckErrorFixThen call
The key is valid, but its scopes do not allow this operation.forbiddenUse a key whose scopes cover the operation, or ask an owner of the namespace to grant them.None.

Example

Terminal
curl -X PATCH https://api.sb/leaseline.app/availabilities/availability_8Zj0a7vvRl \
  -H "Authorization: Bearer $STARTUP_BUILDER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"worker":"worker_whZFpOKWIV"}'
JSON
{
  "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.update",
    "status": "done"
  },
  "links": {
    "self": "https://api.sb/leaseline.app/actions/act_br07HsG8MG"
  }
}

Availability.delete

Deletes an Availability: a soft delete that keeps its history, undone by Thing.restore. Verb page.

Text
DELETE /{namespace}/availabilities/{id}

Path: id. Emits Availability.deleted.

Inputs

InputTypeRequiredDescription
idstringrequiredThe id of the Availability.

Returns

OutputTypeRequiredDescription
availabilityAvailabilityrequiredThe Availability.

Refuses when

CheckErrorFixThen call
The key is valid, but its scopes do not allow this operation.forbiddenUse a key whose scopes cover the operation, or ask an owner of the namespace to grant them.None.

Example

Terminal
curl -X DELETE https://api.sb/leaseline.app/availabilities/availability_8Zj0a7vvRl \
  -H "Authorization: Bearer $STARTUP_BUILDER_API_KEY"
JSON
{
  "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.delete",
    "status": "done"
  },
  "links": {
    "self": "https://api.sb/leaseline.app/actions/act_br07HsG8MG"
  }
}