Skip to main content

Examples

The general 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 colour of appointments on the planning board.

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 job, 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.