Course와 같은 새 리소스를 만들려면 해당 리소스의 create() 메서드를 호출합니다.
Create() 호출에는 항상 해당 리소스의 초기 중요 세부정보가 입력으로 필요합니다. 예를 들어 Course를 만들려면 Course 리소스에서 create() 메서드를 호출하고 요청에 name 및 description를 지정합니다. room과 같은 선택적 정보도 지정할 수 있습니다.
하위 리소스 (하위 리소스라고도 함)의 경우 상위 리소스의 식별자도 필요합니다. 예를 들어 Course 내에서 CourseWork를 만들 때 CourseWork이 속한 Course를 설정하려면 Courseid이 필요합니다.
Create() 메서드는 API 호출 응답에서 새로 생성된 리소스의 인스턴스를 반환합니다. 반환된 리소스에는 일반적으로 리소스 id 또는 creationTime과 같은 추가 서버 생성 필드가 있습니다.
패치
기존 리소스를 수정하려면 해당 리소스에서 patch() 메서드 (update()라고도 함)를 호출합니다. patch() 메서드는 create()과 거의 동일하지만 두 가지 주요 차이점이 있습니다. patch() 메서드를 호출할 때는 다음을 지정해야 합니다.
수정할 리소스의 id입니다.
업데이트할 리소스의 필드를 결정하는 필드 목록(updateMask)입니다. 기본 필드 집합이 있거나 필드가 추론되는 경우에는 선택사항입니다.
Patch() 메서드는 모든 변경사항이 완료된 API 호출 응답에서 업데이트된 리소스의 전체 인스턴스를 반환합니다.
가져오기 및 나열
리소스를 가져오는 방법에는 get()와 list() 두 가지가 있습니다.
get() 메서드는 식별자를 통해 특정 리소스를 가져옵니다. 예를 들어 id 또는 alias에 따라 Course를 가져옵니다. get() 호출은 전체 리소스를 직접 반환합니다.
list() 메서드는 개별 리소스 식별자 없이 단일 요청에서 동일한 유형의 여러 리소스를 가져옵니다. list() 작업은 종종 일부 상위 리소스의 모든 하위 리소스를 가져옵니다. 예를 들어 Course 내의 모든 CourseWork를 가져옵니다. 이 방법은 여러 get() 호출을 하는 것과 비교하여 요청을 최소화하는 데 유용하며, 특히 원하는 리소스의 id를 모르는 경우에 유용합니다.
일반적으로 list() 메서드에는 단일 호출에서 반환할 수 있는 최대 리소스 양이 있으며 호출에 pageSize 값을 포함하여 하한을 구성할 수 있습니다. 리소스가 한도보다 많은 경우 list() 메서드는 페이지로 나누기를 지원합니다. 반환되는 결과의 각 '페이지'는 다음 리소스 배치를 가져오기 위해 후속 list() 호출에 포함될 수 있는 pageToken를 제공합니다.
삭제
delete() 메서드는 id와 같은 리소스 식별자를 허용하고 해당 리소스를 삭제합니다. delete()이 성공하면 빈 응답이 반환됩니다.
기타 연산
Classroom API로 가능한 모든 작업을 앞서 언급한 표준 작업으로 수행할 수 있는 것은 아닙니다(예: CourseWork 리소스의 할당 대상 수정). 이러한 경우 modifyAssignees 메서드와 같은 맞춤 메서드를 사용할 수 있습니다. 이러한 메서드의 동작은 맞춤형이므로 개별적으로 문서를 참고해야 합니다.
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["필요한 정보가 없음","missingTheInformationINeed","thumb-down"],["너무 복잡함/단계 수가 너무 많음","tooComplicatedTooManySteps","thumb-down"],["오래됨","outOfDate","thumb-down"],["번역 문제","translationIssue","thumb-down"],["샘플/코드 문제","samplesCodeIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2025-07-31(UTC)"],[],[],null,["# How requests work\n\nThis page describes a high-level overview of how requests work in the\nGoogle Classroom API. The goal is to aid readers who aren't already familiar with\nresource-oriented design or Google Workspace APIs.\n\nFor specific code samples, see the corresponding API guides, for example [Create\n\\& manage courses](/workspace/classroom/guides/manage-courses) or [Create \\& manage coursework](/workspace/classroom/guides/manage-coursework).\n\nResource-oriented design\n------------------------\n\nAs mentioned in [API resources](/workspace/classroom/guides/key-concepts/api-structure), the Classroom API follows\n[resource-oriented design](https://google.aip.dev/121) patterns. Most resources have methods for standard\noperations like creating, reading, updating, and deleting instances of the\nresource.\n\nFor example, it's possible to [`create()`](/workspace/classroom/reference/rest/v1/courses/create), [`patch()`](/workspace/classroom/reference/rest/v1/courses/patch), [`get()`](/workspace/classroom/reference/rest/v1/courses/get), [`list()`](/workspace/classroom/reference/rest/v1/courses/list),\nand [`delete()`](/workspace/classroom/reference/rest/v1/courses/delete) a Classroom [`Course`](/workspace/classroom/reference/rest/v1/courses) using the API.\n\nCreate\n------\n\nTo create a new resource, like a `Course`, call the `create()` method for the\ncorresponding resource.\n\n`Create()` calls always require the initial, critical details of the\ncorresponding resource as input. For example, to create a `Course`, call the\n`create()` method on the `Course` resource and specify the `name` and\n`description` in the request, along with optional information like the `room`.\n\nFor subresources (sometimes called child resources), identifiers for the parent\nresource are also required. For example, when creating a [`CourseWork`](/workspace/classroom/reference/rest/v1/courses.courseWork) within a\n`Course`, the `Course` `id` is needed to establish in which `Course` the\n`CourseWork` belongs.\n\n`Create()` methods return an instance of the newly created resource in the API\ncall response. The returned resource typically has any additional,\nserver-generated fields, such as the resource `id` or `creationTime`.\n\nPatch\n-----\n\nTo modify existing resources, call the `patch()` method (which is sometimes\ncalled `update()`) on the corresponding resource. The `patch()` method is almost\nidentical to `create()`, with two key differences; when calling the `patch()`\nmethod you must specify:\n\n1. The `id` of the resource to modify.\n2. A list of fields, called an `updateMask`, to determine which fields on the resource to update. This is optional in cases where there is a default set of fields or the fields are inferred.\n\n| **Tip:** You might notice `update()` methods alongside `patch()` methods. While both modify a resource, they differ in behavior. `Update()` completely replaces a resource with a new one, while `patch()` only updates select fields. For example, [`courses.update()`](/workspace/classroom/reference/rest/v1/courses/update) replaces an entire existing `Course`, while [`courses.patch()`](/workspace/classroom/reference/rest/v1/courses/patch) uses the aforementioned `fieldMask` to modify only specific fields in the `Course`. For simplicity, the Google Classroom API almost exclusively uses `patch()`, and it's recommended that you use that method generally.\n\n`Patch()` methods return the full instance of the updated resource in the API\ncall response, with all changes completed.\n\nGet and list\n------------\n\nThere are two methods for retrieving resources: `get()` and `list()`.\n\nThe `get()` method retrieves a specific resource by some identifier. For\nexample, fetching a `Course` based on `id` or [`alias`](/workspace/classroom/reference/rest/v1/courses.aliases). The `get()` call\nreturns the full resource directly.\n\nThe `list()` method retrieves multiple resources of the same type in a single\nrequest, without the need for the individual resource identifiers. Often the\n`list()` operation gets all the subresources of some parent resource, for\nexample, retrieving all the `CourseWork` within a `Course`. This is useful for\nminimizing requests, compared to making multiple `get()` calls, and particularly\nvaluable when you don't know the `id` of the resources you want.\n\nGenerally, `list()` methods have some maximum amount of resources that can be\nreturned in a single call, and lower limits can be configured by including a\n`pageSize` value with the call. In cases where there are more resources than the\nlimit, the `list()` method supports *pagination* ; each \"page\" of results that is\nreturned provides a `pageToken`, which can be included in a subsequent `list()`\ncall to fetch the next batch of resources.\n\nDelete\n------\n\nThe `delete()` method accepts a resource identifier, like `id`, and deletes the\ncorresponding resource. If the `delete()` is successful, an empty response is\nreturned.\n\nOther operations\n----------------\n\nNot all operations possible with the Classroom API can be achieved\nwith the aforementioned standard operations, for example, modifying the\nassignees of a `CourseWork` resource. In these cases, custom methods are\navailable, like the [`modifyAssignees`](/workspace/classroom/reference/rest/v1/courses.courseWork/modifyAssignees) method. The behavior of these methods\nare bespoke and you should consult the documentation for them individually."]]