Skip to content

Commit f08f0b5

Browse files
feat: implement instructor API v2 grading GET endpoints (#37890)
1 parent a487617 commit f08f0b5

5 files changed

Lines changed: 1134 additions & 34 deletions

File tree

lms/djangoapps/instructor/docs/references/instructor-v2-grading-api-spec.yaml

Lines changed: 124 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ security:
3232
- JWTAuth: []
3333

3434
tags:
35+
- name: Course
36+
description: Course-level configuration and metadata
3537
- name: Learners
3638
description: Learner information and enrollment data
3739
- name: Problems
@@ -83,6 +85,9 @@ paths:
8385
Retrieve problem metadata including display name, location in course hierarchy,
8486
and usage key.
8587
88+
When a `learner` query parameter is provided, the response also includes the
89+
learner's current score and attempt count for the problem.
90+
8691
**Note:** Requires exact problem location - no search or partial matching.
8792
operationId: getProblem
8893
produces:
@@ -95,6 +100,7 @@ paths:
95100
required: true
96101
type: string
97102
x-example: "block-v1:edX+DemoX+Demo_Course+type@problem+block@sample_problem"
103+
- $ref: '#/parameters/EmailOrUsernameQuery'
98104
responses:
99105
200:
100106
description: Problem information retrieved successfully
@@ -109,6 +115,33 @@ paths:
109115
404:
110116
$ref: '#/responses/NotFound'
111117

118+
# ==================== COURSE CONFIG ENDPOINTS ====================
119+
120+
/api/instructor/v2/courses/{course_key}/grading-config:
121+
get:
122+
tags:
123+
- Course
124+
summary: Get course grading configuration
125+
description: |
126+
Retrieve the grading policy for a course, including assignment type weights
127+
and letter grade cutoff thresholds.
128+
operationId: getGradingConfig
129+
produces:
130+
- application/json
131+
parameters:
132+
- $ref: '#/parameters/CourseKey'
133+
responses:
134+
200:
135+
description: Grading configuration retrieved successfully
136+
schema:
137+
$ref: '#/definitions/GradingConfig'
138+
400:
139+
$ref: '#/responses/BadRequest'
140+
401:
141+
$ref: '#/responses/Unauthorized'
142+
403:
143+
$ref: '#/responses/Forbidden'
144+
112145
# ==================== GRADING ENDPOINTS ====================
113146

114147
/api/instructor/v2/courses/{course_key}/{problem}/grading/attempts/reset:
@@ -378,6 +411,14 @@ parameters:
378411
type: string
379412
x-example: "john_harvard"
380413

414+
EmailOrUsernameQuery:
415+
name: email_or_username
416+
in: query
417+
required: false
418+
description: Learner's username or email address.
419+
type: string
420+
x-example: "john_harvard"
421+
381422
ProblemLocationPath:
382423
name: problem
383424
in: path
@@ -548,8 +589,7 @@ definitions:
548589
required:
549590
- username
550591
- email
551-
- first_name
552-
- last_name
592+
- full_name
553593
properties:
554594
username:
555595
type: string
@@ -558,44 +598,64 @@ definitions:
558598
type: string
559599
format: email
560600
example: "john@example.com"
561-
first_name:
562-
type: string
563-
example: "John"
564-
last_name:
601+
full_name:
565602
type: string
566-
example: "Harvard"
603+
description: Learner's full name from their Open edX profile
604+
example: "John Harvard"
567605
progress_url:
568606
type: string
569607
format: uri
570608
description: URL to learner's progress page
571609
x-nullable: true
572-
gradebook_url:
573-
type: string
574-
format: uri
575-
description: URL to learner's gradebook view
576-
x-nullable: true
577-
current_score:
578-
type: object
579-
x-nullable: true
580-
properties:
581-
score:
582-
type: number
583-
format: float
584-
minimum: 0
585-
total:
586-
type: number
587-
format: float
588-
minimum: 0
589-
attempts:
610+
611+
GradingConfig:
612+
type: object
613+
description: Course grading policy configuration
614+
required:
615+
- graders
616+
- grade_cutoffs
617+
properties:
618+
graders:
619+
type: array
620+
description: List of grader configurations by assignment type
621+
items:
622+
type: object
623+
required:
624+
- type
625+
- min_count
626+
- drop_count
627+
- weight
628+
properties:
629+
type:
630+
type: string
631+
description: Assignment type name
632+
example: "Homework"
633+
short_label:
634+
type: string
635+
x-nullable: true
636+
description: Short label used when displaying assignment names
637+
example: "HW"
638+
min_count:
639+
type: integer
640+
minimum: 0
641+
description: Minimum number of assignments counted in this category
642+
drop_count:
643+
type: integer
644+
minimum: 0
645+
description: Number of lowest scores dropped from this category
646+
weight:
647+
type: number
648+
format: float
649+
minimum: 0
650+
maximum: 1
651+
description: Weight of this assignment type in the final grade (0.0 to 1.0)
652+
grade_cutoffs:
590653
type: object
591-
x-nullable: true
592-
properties:
593-
current:
594-
type: integer
595-
minimum: 0
596-
total:
597-
type: integer
598-
minimum: 0
654+
description: Grade cutoffs mapping letter grades to minimum score thresholds (0.0 to 1.0)
655+
example:
656+
A: 0.9
657+
B: 0.8
658+
C: 0.7
599659

600660
Problem:
601661
type: object
@@ -626,6 +686,37 @@ definitions:
626686
usage_key:
627687
type: string
628688
description: Block usage key (omitted for course level)
689+
current_score:
690+
type: object
691+
x-nullable: true
692+
description: Learner's current score (present when learner query param is provided and has a submission)
693+
properties:
694+
score:
695+
type: number
696+
format: float
697+
x-nullable: true
698+
minimum: 0
699+
total:
700+
type: number
701+
format: float
702+
x-nullable: true
703+
minimum: 0
704+
attempts:
705+
type: object
706+
x-nullable: true
707+
description: Learner's attempt data (present when learner query param is provided and has a submission)
708+
properties:
709+
current:
710+
type: integer
711+
minimum: 0
712+
description: Number of times the learner has attempted this problem
713+
total:
714+
type: integer
715+
x-nullable: true
716+
minimum: 0
717+
description: >
718+
Maximum number of attempts allowed for this problem.
719+
A null value means the problem allows unlimited attempts.
629720
630721
Error:
631722
type: object

0 commit comments

Comments
 (0)