Skip to main content

Examples

These examples show how to create categoriesCategoryA visual indicator (a color) applied to appointments to classify or label them., resourcesResourceAn entity that can carry out work - a person, vehicle, tool, or room - that you schedule on the planning board., tasksTaskA unit of work that belongs to a job. It appears in the open task list until it is scheduled to a resource. and appointmentsAppointmentA task scheduled to a resource for a specific period - the scheduled instance you see on the planning board. with the Python SDK. The flow is the same as in the .NET and JavaScript SDKs:

  1. Build a dict (or a list of dicts) for the entity you want to send.
  2. Call the matching accessor on the client.
  3. Branch on result.ok or call result.raise_for_error().

Create a category​

A category drives the background color of appointments on the planning boardPlanning boardThe main graphical scheduling surface where dispatchers drag tasks onto resources across a timeline..

from dimescheduler import DimeSchedulerClient, Environment

with DimeSchedulerClient(api_key="MY_API_KEY", environment=Environment.Sandbox) as client:
result = client.categories.create({
"name": "INSTALL",
"displayName": "Install",
"color": "#22d3ee",
})
result.raise_for_error()

Update the live location of a resource​

After this call, resource GEOFFREY shows up in Amsterdam on the map.

result = client.resource_gps_trackings.create({
"resourceNo": "GEOFFREY",
"latitude": 52.372746,
"longitude": 4.893086,
})

Create a job and its first task​

A task must belong to a jobJobA high-level container, comparable to a project, that bundles related tasks together with common information such as customer, billing, and address., so send them in order:

source_app, source_type, job_no = "CRM", "SERVICECASE", "CASE_123"

client.jobs.create({
"sourceApp": source_app,
"sourceType": source_type,
"jobNo": job_no,
"shortDescription": "Repair HVAC in Berlin office",
})

client.tasks.create({
"sourceApp": source_app,
"sourceType": source_type,
"jobNo": job_no,
"taskNo": "CASE_123_ACTIVITY001",
"shortDescription": "Repair HVAC",
})

Need to send many at once? Pass a list. Most CRUD endpoints accept either a single entity or a sequence:

client.tasks.create([task_1, task_2, task_3])

Read appointments for a date range​

from datetime import datetime, timezone

result = client.appointments.get(
start_date=datetime(2026, 5, 1, tzinfo=timezone.utc),
end_date=datetime(2026, 5, 31, tzinfo=timezone.utc),
resources=["GEOFFREY", "JOHNNY"],
)
for appointment in result.data or []:
print(appointment["appointmentNo"], appointment["startDate"])

Send a fly-in message to online users​

result = client.messages.send({
"text": "Heads up - planning board reload in 5 minutes.",
"severity": "Warning",
})

Handle rate limits explicitly​

import time
from dimescheduler import RateLimitError

for attempt in range(5):
result = client.categories.create(category)
if result.ok:
break
err = result.to_error()
if isinstance(err, RateLimitError):
time.sleep(err.retry_after or 2 ** attempt)
continue
result.raise_for_error() # any other failure: bail

More examples live alongside the source in the dime-scheduler/sdk monorepo.