Mantieni tutto organizzato con le raccolte
Salva e classifica i contenuti in base alle tue preferenze.
Gli sviluppatori possono utilizzare l'API Google Classroom per interagire con i compiti in
Google Classroom. Un'applicazione che utilizza l'API in questo modo viene definita
integrazione CourseWork.
Questo percorso di integrazione viene comunemente utilizzato per creare e valutare i compiti con
link a risorse esterne a Classroom. Offre agli sviluppatori un maggiore accesso alla gestione dei lavori del corso rispetto ai
pulsanti di condivisione di Classroom.
Come funziona
La funzionalità principale di un'integrazione CourseWork è la creazione e la gestione di compiti, annunci e materiali del corso utilizzando l'API Classroom.
Un esempio di percorso dell'utente comune reso possibile da un'integrazione CourseWork è quello di
consentire agli insegnanti di scoprire, assegnare e valutare i contenuti dal tuo sito web
o dalla tua applicazione:
Un utente insegnante accede al tuo sito web.
L'insegnante trova o crea contenuti che vuole condividere con la sua
classe. L'insegnante fa clic su un pulsante del tuo sito web per inviare questi contenuti a
Google Classroom.
La tua applicazione invia una richiesta a courses.courseWork.create. La
richiesta contiene un oggetto CourseWork nel corpo che contiene:
L'ID del corso di destinazione.
Il titolo dell'assegnazione.
Il testo descrittivo del compito.
Un linkMaterial con l'URL dei contenuti selezionati dall'insegnante.
(Facoltativo) Il punteggio massimo ottenibile per i contenuti selezionati.
In Classroom viene visualizzato un nuovo compito con un allegato di link.
Il link fa riferimento all'URL specificato nella richiesta create. Per un esempio, vedi la Figura 1.
Nel registro
di Classroom viene visualizzata anche una nuova colonna per il compito, incluso il punteggio massimo, se fornito.
Gli studenti ricevono il compito e fanno clic su link Material per aprire l'URL fornito in una nuova scheda e visualizzare o completare i contenuti sul tuo sito web.
(Facoltativo) Fornisci i controlli per consentire allo studente di consegnare il compito.
(Facoltativo) Invia una richiesta a
courses.courseWork.studentSubmissions.modifyAttachments per aggiungere
allegati a un invio dello studente, ad esempio un file di Google Drive o link
Material che rimanda al lavoro dello studente sul tuo sito web.
Tieni presente quanto segue prima di decidere se l'integrazione di CourseWork è la
scelta giusta per le esigenze del tuo prodotto.
Devi autorizzare l'utente e richiedere il suo consenso. Stai effettuando
richieste API per conto dell'utente. Ciò significa, ad esempio, che non puoi
creare compiti in nessun corso Google Classroom; puoi creare
compiti solo nei corsi in cui l'utente autorizzato insegna.
Devi fornire all'utente un modo per selezionare un corso per ricevere i contenuti.
Prendi in considerazione l'utilizzo di courses.list per ottenere un elenco dei corsi insegnati dall'utente, quindi consenti all'utente di selezionare uno o più corsi dall'elenco.
Quando un utente fa clic su un link Material in Classroom, il link si apre in una nuova
scheda. Il server non riceverà informazioni da Classroom quando si apre l'URL.
Un insegnante può modificare o eliminare il materiale del corso indipendentemente dallo
sviluppatore. Ciò significa che le conoscenze di uno sviluppatore sui corsi potrebbero
diventare obsolete. Se devi essere a conoscenza delle modifiche apportate ai compiti,
valuta la possibilità di configurare le notifiche push per le modifiche ai compiti.
Un insegnante può creare compiti nella UI di Classroom con
link incollati agli URL del tuo sito web. I compiti creati in questo modo sono
di proprietà esclusiva dell'insegnante, quindi non potrai visualizzare, modificare o impostare
i voti per la consegna utilizzando l'API Classroom.
[null,null,["Ultimo aggiornamento 2025-08-01 UTC."],[],[],null,["# CourseWork integration\n\nDevelopers can use Google Classroom API to interact with coursework in\nGoogle Classroom. An application that uses the API in this way is referred to\nas a *`CourseWork` integration*.\n| **Key Point:** A `CourseWork` integration allows developers to programmatically access and modify the state of Google Classroom announcements, course materials, assignments, and student submissions. Choose this path if you need a low-cost way to push your content into Classroom.\n\nThis integration path is commonly used to create and grade assignments with\nlinks to resources outside of Classroom. It provides more\ndeveloper access to coursework management as compared to [Classroom Share buttons](/workspace/classroom/guides/sharebutton).\n\nHow it works\n------------\n\nThe core feature of a `CourseWork` integration is the creation and management of\nassignments, announcements, and course materials using Classroom API.\n\nOne example of a common user journey enabled by a `CourseWork` integration is to\nallow teachers to discover, assign, and grade content from within your website\nor application:\n\n1. A teacher user signs in to your website.\n2. The teacher finds or creates content that they want to share with their class. The teacher clicks a button on your website to send this content to Google Classroom.\n3. Your application issues a request to [`courses.courseWork.create`](/workspace/classroom/reference/rest/v1/courses.courseWork/create). The request contains a `CourseWork` object in its body that contains:\n - The destination course ID.\n - The title of the assignment.\n - The text description for the assignment.\n - A `link` [`Material`](/workspace/classroom/reference/rest/v1/Material) with the URL to the content selected by the teacher.\n - Optionally, the maximum score attainable for the selected content.\n4. A new assignment appears in Classroom with a link attachment. The link refers to the URL specified in the `create` request. See Figure 1 for an example.\n5. A new column for the assignment also appears in the Classroom gradebook, including the maximum score if provided.\n6. Students receive the assignment and click the `link Material` to open the provided URL in a new tab and view or complete the content on your website. Optionally, provide controls for the student to [turn in the assignment](/workspace/classroom/guides/manage-coursework#manage_student_response_state).\n7. Optionally, issue a request to [`courses.courseWork.studentSubmissions.modifyAttachments`](/workspace/classroom/reference/rest/v1/courses.courseWork.studentSubmissions/modifyAttachments) to add attachments to a student submission, such as a Google Drive file or `link\n Material` that points to the student's work on your website.\n8. Optionally, issue a request to [`courses.courseWork.studentSubmissions.patch`](/workspace/classroom/reference/rest/v1/courses.courseWork.studentSubmissions/patch) to set the student's grade for the assignment.\n\n**Figure 1.** Teacher view when editing an assignment with `link Material`\ncreated by a `CourseWork` integration.\n\nAlternatively, you could call [`courses.announcements.create`](/workspace/classroom/reference/rest/v1/courses.announcements/create) or\n[`courses.courseWorkMaterials.create`](/workspace/classroom/reference/rest/v1/courses.courseWorkMaterials/create) to create an announcement or course\nmaterial instead of an assignment. See the [Create \\& manage coursework](/workspace/classroom/guides/manage-coursework) and [Set\n\\& update grades](/workspace/classroom/guides/classroom-api/manage-grades) pages for detailed descriptions of the relevant\nClassroom API actions.\n\nConsiderations\n--------------\n\n| **Key Point:** There are some important limitations to a `CourseWork` integration. If these prevent you from realizing your product, consider building a [Google Classroom add-on](/workspace/classroom/add-ons) instead.\n\nKeep the following in mind before deciding if a `CourseWork` integration is the\nright choice for your product needs.\n\n- You need to authorize the user and prompt for their consent. You're making API requests *on the user's behalf* . This means, for example, that you can't create coursework in *any* Google Classroom course; you can only create coursework in courses that the authorized user teaches.\n- You need a way for the user to select a course to receive the content. Consider using [`courses.list`](/workspace/classroom/reference/rest/v1/courses/list) to get a list of the courses taught by the user, then allow the user to select one or more of the courses from the list.\n- When a user clicks a `link Material` in Classroom, the link opens in a new tab. Your server won't receive any information from Classroom when the URL opens.\n- A teacher can modify or delete the coursework independently of the developer. This means that a developer's knowledge of the coursework might become out of date. If you need to be aware of changes in coursework, consider setting up [push notifications](/workspace/classroom/best-practices/push-notifications) for coursework changes.\n- A teacher can create coursework in the Classroom UI with pasted links to URLs on your website. Coursework created in this manner are solely owned by the teacher, so you won't be able to view, modify, or set submission grades using the Classroom API."]]