Study Plan API at a Glance

Read top to bottom: what the student does in the app, the one call it triggers, and what comes back. Dashed boxes are optional. All paths start with https://plan.class-quiz.com/api/v1.

1The study-plan screen opens
GET /students/{id}/setupSend nothing.
  • subjects: the marks to ask for
  • durations: the period buttons
  • plans: name, label, difficulty /5
  • latest_saved_plan: restore it if present
2Student sets marks, period and planCall again on every change.
POST /students/{id}/simulate
  • subjects: [{subject, mark}]
  • months: 1, 3, 6 or 9
  • plan: {plan_id: "regular"}
  • subjects: predicted marks
  • recommendation.best_plan_id: the "recommended" tag
  • week.cards: the tray
  • week.recommended: our suggested week
3Student drags cards onto the week (أنظم أسبوعي) Empty board + "اقترح علي": show recommended from step 2.
no callThe board lives in the app. At most 5 cards a day; a study day may stay empty once every card is placed.
Keep 7 days. Steps 4 to 6 send them as {day, is_rest, subjects} (shape below).
optional4"اقترح علي" after placing some cards
POST /students/{id}/week/suggest
  • same body as step 2
  • week.days: what's placed so far
  • recommended: the week completed around the student's cards
  • started_week_replaced: true → the board was invalid, this is a whole new week
5"أؤكد أسبوعي"Every card and rest day is placed.
POST /students/{id}/week/confirm
  • same body as step 2
  • week.days: all 7 days
  • week.layout: the saved week
  • Marks, period and plan are saved with it
optional6"تعديل الخطة"
PUT /students/{id}/week/edit
  • days: all 7 days
  • The same plan with the new week (same id and dates)
7The missions screen opens
GET /students/{id}/missionsSend nothing.
  • missions daily: one per slot, programmed_at = its day (0 = Monday)
  • missions weekly: one per subject, programmed_at = null
  • today_index: show the daily missions of this day

The two shapes you send

The body of steps 2, 4 and 5. subjects must be exactly the ones from setup.

{
  "subjects": [
    { "subject": "Arabic", "mark": 12 },
    { "subject": "Math",   "mark": 16 }, …
  ],
  "months": 3,
  "plan": { "plan_id": "regular" }
}

The week, added as "week": { "days": [...] } in steps 4 and 5, and as "days" in step 6. day is the index (0 = Monday). subjects is {subject_id: minutes}, with the minutes from week.cards. In Unity, send it with Newtonsoft: JsonUtility drops dictionaries.

[
  { "day": 0, "is_rest": false, "subjects": { "10": 40, "15": 30 } },
  { "day": 1, "is_rest": false, "subjects": { "11": 30, "3": 30 } },
  …
  { "day": 5, "is_rest": true,  "subjects": {} },
  { "day": 6, "is_rest": true,  "subjects": {} }
]

Good to know

  • Plans: light نسق خفيف, regular نسق منتظم, strong نسق قوي, or custom with days_per_week and hours_per_day.
  • Texts come ready in Arabic (name_ar, label, minutes_label). Show them as they are.
  • Subject IDs: Arabic 11, Math 4, Science 3, French 10, English 15.
  • Every error looks like {"error": {"code", "message", "details"}}. Check code.
  • Optional: POST /students/{id}/recommend ranks all plans for the same marks.