cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
BJH
Community Participant

More API issues with assignments...(or just documentation)?

More issues with the Assignments API...or just perhaps the docs?

  // (Optional) If 'submission' is included in the 'include' parameter, includes a
  // Submission object that represents the current user's (user who is requesting
  // information from the api) current submission for the assignment. See the
  // Submissions API for an example response. If the user does not have a
  // submission, this key will be absent.
  "submission": null,

But this is not true.  Here is an assignment with no submission:

"only_visible_to_overrides": false,
    "submission": {
        "id": 16290561,
        "body": null,
        "url": null,
        "grade": null,
        "score": null,
        "submitted_at": null,
        "assignment_id": 713759,
        "user_id": 34475,
        "submission_type": null,
        "workflow_state": "unsubmitted",
        "grade_matches_current_submission": true,
        "graded_at": null,
        "grader_id": null,
        "attempt": null,
        "cached_due_date": "2020-09-28T04:59:59Z",
        "excused": null,
        "late_policy_status": null,
        "points_deducted": null,
        "grading_period_id": null,
        "extra_attempts": null,
        "posted_at": null,
        "late": false,
        "missing": false,
        "seconds_late": 0,
        "entered_grade": null,
        "entered_score": null,
        "preview_url": "https://xxxx.instructure.com/courses/41166/assignments/713759/submissions/34475?preview=1&version=0"
    },
    "locked_for_user": false,

 Many fields within this are null.  It shows workflow_state unsubmitted, the preview_url shows "No Submission", but this submission field is clearly not a null field.  It must be enumerated and parsed for other info.

Also, there are many attributes on the assignment response which are not listed in the documentation.  For instance, it too has a workflow_state, but this is not explained in the documentation.

It would appear that to truly find unsubmitted assignments we need to parse (at least) the workflow_state and locked status for the assignment, ensure that submission_types is not 'none' and then parse through "submission" to see if the value is actually unsubmitted within its workflow_state?

I'm confused.  Either I'm missing something major here or else we are not being provided with accurate information that allows us access to pull data that is impossible to easily do within the UI.

Labels (3)
0 Kudos
2 Replies
bbennett2
Community Champion

I've confirmed the same behavior. Instead of not returning submission in the response, it returns an object with null values throughout. However, the workflow_state key is documented in the Submission object docs at the top of the page:

 // The current state of the submission
"workflow_state": "submitted",
BJH
Community Participant

The workflow_state for the submission object is documented, but the workflow_state for the assignment is not documented, and they are not the same.  See first and last lines:

    "workflow_state": "published",
    "muted": true,
    "html_url": "https://xxxx.instructure.com/courses/41176/assignments/693815",
    "published": true,
    "only_visible_to_overrides": false,
    "submission": {
        "id": 15657320,
        "body": null,
        "url": null,
        "grade": null,
        "score": null,
        "submitted_at": null,
        "assignment_id": 693815,
        "user_id": 34475,
        "submission_type": null,
        "workflow_state": "unsubmitted",