為讓表單建立者進一步控管回覆者,我們推出了精細的回覆者控管功能。2026 年 1 月 31 日後透過 API 建立的表單,預設為未發布狀態。詳情請參閱「
Google 表單的 API 變更」。
總覽
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
Google Forms API 是 RESTful 介面,可讓您建立及修改表單和測驗、擷取表單回覆和測驗成績、設定測驗答案鍵並自動提供意見回饋,以及接收推播通知。這個 API 最常見的用途包括下列工作:
- 建立表單或測驗
- 發布及管理回覆者
- 更新表單或測驗
- 擷取表單或測驗的回應
- 讀取表單內容和中繼資料
- 設定及接收推播通知
- 以下列出 Forms API 中常用的字詞:
- Form
在雲端硬碟中建立及儲存的 Google 表單文件。每個表單都以 Form
資源表示,並具有專屬的 formId
值,其中包含字母、數字、連字號或底線。您可以在 Google 表單網址中找到表單 ID:
https://docs.google.com/forms/d/FORM_ID/edit
- 測驗
這類 Google 表單文件可根據正確答案評估表單回覆。如要建立測驗,只能使用 batchUpdate()
方法,將現有表單的 isQuiz
設定更新為 true
。
- 評分
- 問題的分數值、答案和意見回饋,適用於
isQuiz
為 true
的情況。以 Grading
資源表示。 - 意見回饋
- 使用者在測驗中回答問題時收到的回覆,以
Feedback
資源表示。
- 項目
表單中的單一元素,由 Item 資源表示。Item
是重複元素,可包含區段、問題群組、問題、文字、圖片或影片。
- 問題
表單上的單一問題,以 Question
資源表示。
- 問題群組
一組問題共用同一組可能答案 (例如 1 到 5 的評分格線)。以 QuestionGroupItem
資源表示。
- Section
區段可將表單分成多個頁面,並新增條件式邏輯 (例如根據使用者回答內容顯示特定問題)。章節對應於 PageBreakItem
資源。
- 答案
使用者對問題的回答,以 Answer
資源表示。包括成績資訊 (如有)、中繼資料和答案內容。
- 回應
使用者提交表單,以 FormResponse
資源表示。
- 觀看
觸發條件:追蹤表單結構定義異動 (例如編輯問題) 或表單回應提交情形,並在發生異動時傳送推播通知。以 Watch
資源表示。
管理表單和測驗時,由於許多表單物件可以多種方式互相巢狀化,因此指定不同欄位可能很複雜。如要瞭解表單的視覺化呈現方式如何對應至欄位,建議您使用 UI 建立幾個應用程式可能會產生的表單範例。然後使用 forms.get()
方法擷取對應的 JSON,以便進行比較。舉例來說,這個測驗範例對應的 JSON 如下:
{
"formId": "FORM_ID",
"info": {
"title": "Famous Black Women",
"description": "Please complete this quiz based off of this week's readings for class.",
"documentTitle": "API Example Quiz"
},
"settings": {
"quizSettings": {
"isQuiz": true
}
},
"revisionId": "00000021",
"responderUri": "https://docs.google.com/forms/d/e/1FAIpQLSd0iBLPh4suZoGW938EU1WIxzObQv_jXto0nT2U8HH2KsI5dg/viewform",
"items": [
{
"itemId": "5d9f9786",
"imageItem": {
"image": {
"contentUri": "DIRECT_URL",
"properties": {
"alignment": "LEFT"
}
}
}
},
{
"itemId": "72b30353",
"title": "Which African American woman authored \"I Know Why the Caged Bird Sings\"?",
"questionItem": {
"question": {
"questionId": "25405d4e",
"required": true,
"grading": {
"pointValue": 2,
"correctAnswers": {
"answers": [
{
"value": "Maya Angelou"
}
]
}
},
"choiceQuestion": {
"type": "RADIO",
"options": [
{
"value": "Maya Angelou"
},
{
"value": "bell hooks"
},
{
"value": "Alice Walker"
},
{
"value": "Roxane Gay"
}
]
}
}
}
},
{
"itemId": "0a4859c8",
"title": "Who was the first Dominican-American woman elected to state office?",
"questionItem": {
"question": {
"questionId": "37fff47a",
"grading": {
"pointValue": 2,
"correctAnswers": {
"answers": [
{
"value": "Grace Diaz"
}
]
}
},
"choiceQuestion": {
"type": "RADIO",
"options": [
{
"value": "Rosa Clemente"
},
{
"value": "Grace Diaz"
},
{
"value": "Juana Matias"
},
{
"value": "Sabrina Matos"
}
]
}
}
}
}
],
"publishSettings" : {
"isPublished": true,
"isAcceptingResponses": true
}
}
後續步驟
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-08-29 (世界標準時間)。
[null,null,["上次更新時間:2025-08-29 (世界標準時間)。"],[],["The Google Forms API facilitates creating, modifying, and retrieving data from forms and quizzes. Key actions include creating and updating forms/quizzes, retrieving responses, reading form content/metadata, and setting up push notifications. Quizzes can include grading, answer keys, and feedback. Forms consist of *Items*, like *Questions*, *Question Groups*, and *Sections*. User input is stored as *Answers* in *Responses*. *Watches* track form changes and trigger push notifications.\n"],null,["# Overview\n\nThe Google Forms API is a RESTful interface that lets you create and modify forms\nand quizzes, retrieve form responses and quiz grades, set up quiz answer keys\nwith automatic feedback, and receive push notifications. The most common uses\nof this API include the following tasks:\n\n- Create a form or quiz\n- Publish and manage responders\n- Update a form or quiz\n- Retrieve responses from a form or quiz\n- Read form content and metadata\n- Set up and receive push notifications\n\nThe following is a list of common terms used in the Forms API:\n*Form*\n\n: A Google Forms document, created and stored in Drive. Each\n form is represented by a\n [`Form`](/workspace/forms/api/reference/rest/v1/forms) resource\n and has a unique `formId` value, containing letters, numbers, hyphens, or\n underscores. You can find the form ID in a Google Forms URL:\n\n: `https://docs.google.com/forms/d/FORM_ID/edit`\n\n*Quiz*\n\n: A specific type of Google Forms document that allows for grading of the\n form responses against an answer key. A quiz can only be created by using\n the [`batchUpdate()`](/workspace/forms/api/reference/rest/v1/forms/batchUpdate)\n method to update the `isQuiz` setting on an existing form to `true`.\n\n *Grading*\n : A point value, answer key, and feedback for a question, applied when\n `isQuiz` is `true`. Represented by the\n [`Grading`](/workspace/forms/api/reference/rest/v1/forms#grading) resource.\n\n *Feedback*\n : A response given to the end user when responding to a question on a quiz,\n represented by the [`Feedback`](/workspace/forms/api/reference/rest/v1/Feedback)\n resource.\n\n*Item*\n\n: A single element in a form, represented by the\n [Item](/workspace/forms/api/reference/rest/v1/forms#item) resource. `Item` is a\n repeating element which can contain a section, question group, question,\n text, image, or video.\n\n*Question*\n\n: A single question on the form, represented by the\n [`Question`](/workspace/forms/api/reference/rest/v1/forms#question) resource.\n\n*Question group*\n\n: A group of questions that all share the same set of possible answers (for\n example, a grid of ratings from 1 to 5). Represented by the\n [`QuestionGroupItem`](/workspace/forms/api/reference/rest/v1/forms#questiongroupitem)\n resource.\n\n*Section*\n\n: A section is a way to break up a form into multiple pages and add\n conditional logic (such as only showing certain questions based on how the\n user answers). Sections correspond to the\n [`PageBreakItem`](/workspace/forms/api/reference/rest/v1/forms#PageBreakItem)\n resource.\n\n*Answer*\n\n: The end user's answer to a question, represented by the\n [`Answer`](/workspace/forms/api/reference/rest/v1/forms.responses#Answer)\n resource. Includes both grade information (if present), metadata, and the\n content of the answer.\n\n*Response*\n\n: The end user's submission of a form, represented by the\n [`FormResponse`](/workspace/forms/api/reference/rest/v1/forms.responses)\n resource.\n\n*Watch*\n\n: A trigger that tracks changes to either form schema changes (such as edits\n to questions) or form response submissions and sends a push notification when\n a change occurs. Represented by the\n [`Watch`](/workspace/forms/api/reference/rest/v1/forms.watches) resource.\n\nForm structure\n--------------\n\nWhen managing forms and quizzes, understanding how to specify different fields\ncan be complicated, given that many of the form objects can be nested inside\neach other in multiple ways. To see how the visual representation of a form\nmaps to the fields, we recommend using the UI to create a few examples of\nforms your application might generate. Then retrieve the corresponding JSON\nusing the\n[`forms.get()`](/workspace/forms/api/reference/rest/v1/forms/get) method\nso you can compare. For example,\n[this example quiz](https://docs.google.com/forms/d/e/1FAIpQLSd0iBLPh4suZoGW938EU1WIxzObQv_jXto0nT2U8HH2KsI5dg/viewform)\ncorresponds to the following JSON: \n\n {\n \"formId\": \"FORM_ID\",\n \"info\": {\n \"title\": \"Famous Black Women\",\n \"description\": \"Please complete this quiz based off of this week's readings for class.\",\n \"documentTitle\": \"API Example Quiz\"\n },\n \"settings\": {\n \"quizSettings\": {\n \"isQuiz\": true\n }\n },\n \"revisionId\": \"00000021\",\n \"responderUri\": \"https://docs.google.com/forms/d/e/1FAIpQLSd0iBLPh4suZoGW938EU1WIxzObQv_jXto0nT2U8HH2KsI5dg/viewform\",\n \"items\": [\n {\n \"itemId\": \"5d9f9786\",\n \"imageItem\": {\n \"image\": {\n \"contentUri\": \"DIRECT_URL\",\n \"properties\": {\n \"alignment\": \"LEFT\"\n }\n }\n }\n },\n {\n \"itemId\": \"72b30353\",\n \"title\": \"Which African American woman authored \\\"I Know Why the Caged Bird Sings\\\"?\",\n \"questionItem\": {\n \"question\": {\n \"questionId\": \"25405d4e\",\n \"required\": true,\n \"grading\": {\n \"pointValue\": 2,\n \"correctAnswers\": {\n \"answers\": [\n {\n \"value\": \"Maya Angelou\"\n }\n ]\n }\n },\n \"choiceQuestion\": {\n \"type\": \"RADIO\",\n \"options\": [\n {\n \"value\": \"Maya Angelou\"\n },\n {\n \"value\": \"bell hooks\"\n },\n {\n \"value\": \"Alice Walker\"\n },\n {\n \"value\": \"Roxane Gay\"\n }\n ]\n }\n }\n }\n },\n {\n \"itemId\": \"0a4859c8\",\n \"title\": \"Who was the first Dominican-American woman elected to state office?\",\n \"questionItem\": {\n \"question\": {\n \"questionId\": \"37fff47a\",\n \"grading\": {\n \"pointValue\": 2,\n \"correctAnswers\": {\n \"answers\": [\n {\n \"value\": \"Grace Diaz\"\n }\n ]\n }\n },\n \"choiceQuestion\": {\n \"type\": \"RADIO\",\n \"options\": [\n {\n \"value\": \"Rosa Clemente\"\n },\n {\n \"value\": \"Grace Diaz\"\n },\n {\n \"value\": \"Juana Matias\"\n },\n {\n \"value\": \"Sabrina Matos\"\n }\n ]\n }\n }\n }\n }\n ],\n \"publishSettings\" : {\n \"isPublished\": true,\n \"isAcceptingResponses\": true\n }\n }\n\nNext steps\n----------\n\n- To learn about developing with Google Workspace APIs, including handling authentication and authorization, refer to [Get started as a Workspace developer](/workspace/guides/getstarted-overview).\n- To learn how to configure and run a basic Forms API app, read the [Quickstarts overview](/workspace/forms/api/guides/quickstarts-overview)."]]