Is there an API or a tool to let me create multiple assignments at once? #148423
Unanswered
lschoeneman1
asked this question in
GitHub Education
Replies: 2 comments 1 reply
-
Hi there! Yes, there’s an API you can use to create multiple assignments programmatically. If you’re using Google Classroom, the Google Classroom API provides a Here’s a quick example using Python: from googleapiclient.discovery import build
from google.oauth2 import service_account
SCOPES = ['https://www.googleapis.com/auth/classroom.courseworkmaterials']
SERVICE_ACCOUNT_FILE = 'your-service-account-file.json'
creds = service_account.Credentials.from_service_account_file(
SERVICE_ACCOUNT_FILE, scopes=SCOPES)
service = build('classroom', 'v1', credentials=creds)
course_id = 'your-course-id'
coursework = {
"title": "Assignment Title",
"description": "Assignment Description",
"dueDate": {"year": 2025, "month": 1, "day": 10},
"dueTime": {"hours": 23, "minutes": 59},
"workType": "ASSIGNMENT",
}
response = service.courses().courseWork().create(
courseId=course_id, body=coursework).execute()
print(f"Assignment created: {response.get('id')}") You can loop through a list of assignments to automate the process. For detailed setup, check out the Google Classroom API documentation. Let me know if you need more help! |
Beta Was this translation helpful? Give feedback.
1 reply
-
Automation Platforms: |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi everyone,
Is there an API or a tool to let me create multiple assignments at once? I have a bunch of assignments I need to create and doing it manually seems like it will take forever!
If there is an API for classroom, I can definitely write the code..
Any help would be appreciated.
thanks!
Beta Was this translation helpful? Give feedback.
All reactions