Creating a Schedule
This endpoint allows operators to create a new schedule with a list of entries defining their availability.
Endpoint
POST /operator/schedules
Required Fields
Name | Type | Required | Description | Default |
---|---|---|---|---|
name | string | No | Name for the new schedule | "Untitled Schedule" |
entries | array | Yes | List of schedule entries to create | — |
Schedule Entry Object
Field | Type | Required | Description | Default |
---|---|---|---|---|
start_time | datetime | Yes | Start time for this schedule entry (ISO 8601) | — |
end_time | datetime | Yes | End time for this schedule entry (ISO 8601) | — |
availability_status | string | Yes | Availability status during this time period (e.g., AVAILABLE, UNAVAILABLE) | — |
start_position | object | Yes | Starting location coordinates (latitude, longitude) | — |
end_position | object | Yes | Ending location coordinates (latitude, longitude) | — |
Example Request
curl -X POST "https://api.opteverything.com/operator/schedules" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <YOUR_TOKEN>" \
-d '{
"name": "Morning Shift",
"entries": [
{
"start_time": "2024-06-01T08:00:00Z",
"end_time": "2024-06-01T12:00:00Z",
"availability_status": "AVAILABLE",
"start_position": {"latitude": 40.7128, "longitude": -74.0060},
"end_position": {"latitude": 40.7589, "longitude": -73.9851}
}
]
}'
Responses
Success (201 Created)
Status Code: 201 Created
{
"schedule_id": 0,
"created_at": "2024-07-29T12:00:00Z",
"name": "Morning Shift",
"entries": [
{
"entry_id": 0,
"schedule_id": 0,
"start_time": "2024-06-01T08:00:00Z",
"end_time": "2024-06-01T12:00:00Z",
"start_position_id": 0,
"end_position_id": 0,
"availability_status": "AVAILABLE"
}
]
}
Field | Type | Description |
---|---|---|
schedule_id | integer | Unique identifier for the newly created schedule |
created_at | datetime | Timestamp when the schedule was created |
name | string | Name of the schedule |
entries | array | List of schedule entries |
For more details, see the API documentation or the schema in
schemas/schedule.py
.