Add a lesson
Puts a lesson into an empty period of a DEFINED schedule kept in WorkRoad. Set the periods first with PUT /schedules/{scheduleId}/structure. Returns the schedule; the lesson is the entry in days[] for day, at period in its elements. Element ids change whenever the timetable is saved in the app, so read GET /schedules/{scheduleId} for the current id instead of keeping one.
Required scopes: schedule:update
In: header
Path Parameters
Schedule id, scoped to the key's user.
^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$uuidHeader Parameters
A client-generated key (1 to 255 visible ASCII characters) that makes this POST safe to retry. A retry with the same key and body replays the original response; the same key with a different body returns 409 idempotency_conflict. Stored for 24 hours.
^[\x21-\x7E]{1,255}$1 <= length <= 255Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
application/json
application/json
application/json
application/json
application/json
application/json
application/json
application/json
curl -X POST "https://example.com/schedules/497f6eca-6276-4993-bfeb-53cbbbba6f08/elements" \ -H "Content-Type: application/json" \ -d '{ "day": 0, "period": 0, "lessonName": "string" }'{ "data": { "id": "4d3c2b1a-0f9e-4d8c-8b7a-6f5e4d3c2b1a", "name": "Year 12", "type": "DEFINED", "external": null, "owned": true, "editable": true, "firstDay": 1, "selectedDays": [ 1, 2, 3, 4, 5 ], "issue": null, "structure": { "periods": [ { "index": 0, "name": "Period 1", "start": "09:00", "end": "10:00" }, { "index": 1, "name": "Period 2", "start": "10:00", "end": "11:00" } ] }, "days": [ { "day": 1, "elements": [ { "id": "6e5d4c3b-2a19-4f08-9e7d-6c5b4a392817", "period": 0, "lessonName": "Biology", "subjectId": "5f0c1d2e-3a4b-4c5d-8e6f-7a8b9c0d1e2f", "subjectLabel": null, "room": "S2", "teacher": "Dr Patel", "timeStart": null, "timeEnd": null }, { "id": "7f6e5d4c-3b2a-4190-8f8e-7d6c5b4a3928", "period": 1, "lessonName": null, "subjectId": null, "subjectLabel": null, "room": null, "teacher": null, "timeStart": null, "timeEnd": null } ] } ] }}