Assign a material
/assignmentsAssigns a published, listed material to up to 500 people, as the assignment composer does, including emails and notifications. People who already hold a direct assignment for the material, or aren’t active members, are skipped and listed in skipped; everyone else is assigned. If nobody can be assigned, the response is still 201 with an empty data and everyone in skipped.
Authorization
apiKey assignments:writeAn organisation API key, sent as Authorization: Bearer enl_…. Create keys in Settings, API Keys.
In: header
Scope: assignments:write
Header Parameters
A unique value per change, up to 255 characters. Retrying with the same key returns the first response for 24 hours.
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/assignments" \ -H "Idempotency-Key: string" \ -H "Content-Type: application/json" \ -d '{ "material_id": "fba2a54e-bc4a-4e2a-8ad4-84dcfe66dea1", "user_ids": [ "2d98503d-4ab4-41bd-8fc6-78cc006fd2db" ] }'{ "data": [ { "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", "user_id": "a169451c-8525-4352-b8ca-070dd449a1a5", "material_id": "fba2a54e-bc4a-4e2a-8ad4-84dcfe66dea1", "material_type": "course", "origin": "direct", "learning_path_id": "5c3b73d2-4376-40f6-99e3-f25504b37bc7", "schedule": { "type": "none" }, "status": "outstanding", "due_at": "2019-08-24T14:15:22Z", "completed_at": "2019-08-24T14:15:22Z", "previous_period_missed": true, "assigned_at": "2019-08-24T14:15:22Z", "assigned_by_id": "22930149-1fab-4145-94b5-af2031b8de65", "unassigned_at": "2019-08-24T14:15:22Z" } ], "skipped": [ { "user_id": "a169451c-8525-4352-b8ca-070dd449a1a5", "reason": "already_assigned" } ]}