이제 Google 클래스룸 부가기능이 일반적으로 개발자에게 제공됩니다. 자세한 내용은
부가기능 문서를 참고하세요.
Google Classroom API 오류 구조
Classroom API는 개발자가 문제를 디버그하고 최종 사용자에게 실행 가능한 유용한 정보를 제공하는 데 도움이 되는 오류 정보를 반환합니다. 이 가이드에서는 API에서 반환된 오류 정보를 파싱하는 방법을 설명합니다.
Classroom API는 두 가지 수준의 오류 정보를 반환합니다.
- 헤더의 HTTP 오류 코드입니다.
- 추가 세부정보가 포함된 응답 본문의 객체입니다.
오류 메시지 구조
응답 본문에서 반환되는 오류에는 다음 필드가 포함됩니다.
code
: 숫자 HTTP 오류 코드입니다. 예를 들면 403
입니다.
message
: 오류에 관한 추가 세부정보입니다. 가능한 경우 오류 메시지 앞에 @
및 특정 오류 유형이 추가됩니다. 예로 @ClassroomApiDisabled
를 들 수 있습니다.
status
: HTTP 요청 상태입니다. 예를 들면 PERMISSION_DENIED
또는 NOT_FOUND
입니다.
요청이 ClassroomApiDisabled
오류로 실패하면 응답은 다음과 같습니다.
{
"error": {
"code": 403,
"message": "@ClassroomApiDisabled The user is not permitted to access the Classroom API.",
"status": "PERMISSION_DENIED"
}
}
응답 본문을 사용하여 오류의 원인을 디버그하고 사용자에게 유용한 정보를 제공할 수 있습니다. 동일한 문자열로 시작하는 다른 값과 일치하지 않도록 특정 오류 메시지를 확인할 때 뒤에 공백을 포함합니다. 제공된 오류 예시에서 메시지 필드가 "@ClassroomApiDisabled "
로 시작하는지를 확인하여 사용자에게 적절한 정보를 표시할 수 있습니다.
Classroom API에서 반환할 수 있는 일부 오류에 관한 자세한 내용은 일반적인 오류 페이지를 참고하세요.
달리 명시되지 않는 한 이 페이지의 콘텐츠에는 Creative Commons Attribution 4.0 라이선스에 따라 라이선스가 부여되며, 코드 샘플에는 Apache 2.0 라이선스에 따라 라이선스가 부여됩니다. 자세한 내용은 Google Developers 사이트 정책을 참조하세요. 자바는 Oracle 및/또는 Oracle 계열사의 등록 상표입니다.
최종 업데이트: 2025-01-30(UTC)
[null,null,["최종 업데이트: 2025-01-30(UTC)"],[[["The Classroom API provides error information via HTTP error codes in the header and detailed error objects in the response body."],["Error objects in the response body contain a numerical `code`, a detailed `message` potentially including a specific error type prepended with `@`, and an HTTP request `status`."],["Developers can use the error `message` field, particularly by checking for specific prefixes like `@ClassroomApiDisabled `, to debug issues and inform users."],["The error message structure provided by the API allows for the extraction of the HTTP code, the reason behind the error and its status."],["Refer to the Common Errors page to see a detailed list of possible error messages and the actions that can be taken in response to them."]]],[]]