Submissions API: retreive where workflow_state either graded or submitted same call

Jump to solution
Doug9
Community Participant

Using the Submissions API, "List Submissions for Multiple Assignments" is it possible to restrict the query to return submissions with a workflow_state of either 'graded' or 'submitted' in one API call? I am calling the API from a Python script using the Requests module.

I find I get no data back with workflow_state='graded,submitted' or URL Encoded version 'graded%2Csubmitted', and it seems I must either leave the parameter off and return everything or run two API calls.  The Live API interactive window also seems to only allow one value or none in workflow state parameter.

Is there a way to call this API such that I get submissions with either state in one call?  

/api/v1/courses/sis_course_id%3A2024-5-AB308/students/submissions?student_ids[]=all&workflow_state=graded%2Csubmitted&per_page=100

 Thank you

0 Likes
1 Solution
JamesSekcienski
Community Coach
Community Coach

@Doug9 

Since the parameter doesn't have square brackets at the end of the name, it typically means that it only accepts one value.  Thus, when using that endpoint you would need to make two API calls (one for each of the workflow states you want) or make a single call without using the worfklow_state parameter and then filter the results to only the ones you want.

Also, is there a reason you aren't including "pending_review" as a workflow_state to look at?  This workflow state is used to indicate quizzes that have been submitted but still have questions that need to be graded by the instructor.

View solution in original post