Google Classroom API . courses . posts

Instance Methods

addOnAttachments()

Returns the addOnAttachments Resource.

close()

Close httplib2 connections.

getAddOnContext(courseId, postId, addOnToken=None, attachmentId=None, itemId=None, x__xgafv=None)

Gets metadata for Classroom add-ons in the context of a specific post. To maintain the integrity of its own data and permissions model, an add-on should call this to validate query parameters and the requesting user's role whenever the add-on is opened in an [iframe](https://developers.google.com/classroom/add-ons/get-started/iframes/iframes-overview). This method returns the following error codes: * `PERMISSION_DENIED` for access errors. * `INVALID_ARGUMENT` if the request is malformed. * `NOT_FOUND` if one of the identified resources does not exist.

Method Details

close()
Close httplib2 connections.
getAddOnContext(courseId, postId, addOnToken=None, attachmentId=None, itemId=None, x__xgafv=None)
Gets metadata for Classroom add-ons in the context of a specific post. To maintain the integrity of its own data and permissions model, an add-on should call this to validate query parameters and the requesting user's role whenever the add-on is opened in an [iframe](https://developers.google.com/classroom/add-ons/get-started/iframes/iframes-overview). This method returns the following error codes: * `PERMISSION_DENIED` for access errors. * `INVALID_ARGUMENT` if the request is malformed. * `NOT_FOUND` if one of the identified resources does not exist.

Args:
  courseId: string, Required. Identifier of the course. (required)
  postId: string, Optional. Deprecated, use `item_id` instead. (required)
  addOnToken: string, Optional. Token that authorizes the request. The token is passed as a query parameter when the user is redirected from Classroom to the add-on's URL. The authorization token is required when neither of the following is true: * The add-on has attachments on the post. * The developer project issuing the request is the same project that created the post.
  attachmentId: string, Optional. The identifier of the attachment. This field is required for all requests except when the user is in the [Attachment Discovery iframe](https://developers.google.com/classroom/add-ons/get-started/iframes/attachment-discovery-iframe).
  itemId: string, Identifier of the `Announcement`, `CourseWork`, or `CourseWorkMaterial` under which the attachment is attached. This field is required, but is not marked as such while we are migrating from post_id.
  x__xgafv: string, V1 error format.
    Allowed values
      1 - v1 error format
      2 - v2 error format

Returns:
  An object of the form:

    { # Attachment-relevant metadata for Classroom add-ons in the context of a specific post.
  "courseId": "A String", # Immutable. Identifier of the course.
  "itemId": "A String", # Immutable. Identifier of the `Announcement`, `CourseWork`, or `CourseWorkMaterial` under which the attachment is attached.
  "postId": "A String", # Immutable. Deprecated, use `item_id` instead.
  "studentContext": { # Role-specific context if the requesting user is a student. # Add-on context corresponding to the requesting user's role as a student. Its presence implies that the requesting user is a student in the course.
    "submissionId": "A String", # Requesting user's submission id to be used for grade passback and to identify the student when showing student work to the teacher. This is set exactly when `supportsStudentWork` is `true`.
  },
  "supportsStudentWork": True or False, # Optional. Whether the post allows the teacher to see student work and passback grades.
  "teacherContext": { # Role-specific context if the requesting user is a teacher. # Add-on context corresponding to the requesting user's role as a teacher. Its presence implies that the requesting user is a teacher in the course.
  },
}