From ef5649ac7748d2db6472f18ccb178cf30db59356 Mon Sep 17 00:00:00 2001 From: Christian Schalk Date: Mon, 14 Mar 2022 16:44:15 -0700 Subject: [PATCH 1/2] Updates to Apps Script webapp for V1 GA --- .../AppsScriptFormsAPIWebApp/FormsAPI.gs | 20 +++++++++---------- .../demos/AppsScriptFormsAPIWebApp/Main.html | 18 ++++++++--------- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/forms-api/demos/AppsScriptFormsAPIWebApp/FormsAPI.gs b/forms-api/demos/AppsScriptFormsAPIWebApp/FormsAPI.gs index 87c170caf..50892992a 100644 --- a/forms-api/demos/AppsScriptFormsAPIWebApp/FormsAPI.gs +++ b/forms-api/demos/AppsScriptFormsAPIWebApp/FormsAPI.gs @@ -13,7 +13,7 @@ // limitations under the License. // Global constants. Customize as needed. -const formsAPIUrl = 'https://forms.googleapis.com/v1beta/forms/'; +const formsAPIUrl = 'https://forms.googleapis.com/v1/forms/'; const formId = ''; const topicName = 'projects/'; @@ -22,7 +22,7 @@ const topicName = 'projects/'; /** * Forms API Method: forms.create - * POST https://forms.googleapis.com/v1beta/forms + * POST https://forms.googleapis.com/v1/forms */ function create(title) { const accessToken = ScriptApp.getOAuthToken(); @@ -50,7 +50,7 @@ function create(title) { /** * Forms API Method: forms.get - * GET https://forms.googleapis.com/v1beta/forms/{formId}/responses/{responseId} + * GET https://forms.googleapis.com/v1/forms/{formId}/responses/{responseId} */ function get(formId) { const accessToken = ScriptApp.getOAuthToken(); @@ -76,7 +76,7 @@ function get(formId) { /** * Forms API Method: forms.batchUpdate - * POST https://forms.googleapis.com/v1beta/forms/{formId}:batchUpdate + * POST https://forms.googleapis.com/v1/forms/{formId}:batchUpdate */ function batchUpdate(formId) { const accessToken = ScriptApp.getOAuthToken(); @@ -111,7 +111,7 @@ function batchUpdate(formId) { /** * Forms API Method: forms.responses.get - * GET https://forms.googleapis.com/v1beta/forms/{formId}/responses/{responseId} + * GET https://forms.googleapis.com/v1/forms/{formId}/responses/{responseId} */ function responsesGet(formId, responseId) { const accessToken = ScriptApp.getOAuthToken(); @@ -137,7 +137,7 @@ function responsesGet(formId, responseId) { /** * Forms API Method: forms.responses.list - * GET https://forms.googleapis.com/v1beta/forms/{formId}/responses + * GET https://forms.googleapis.com/v1/forms/{formId}/responses */ function responsesList(formId) { const accessToken = ScriptApp.getOAuthToken(); @@ -163,7 +163,7 @@ function responsesList(formId) { /** * Forms API Method: forms.watches.create - * POST https://forms.googleapis.com/v1beta/forms/{formId}/watches + * POST https://forms.googleapis.com/v1/forms/{formId}/watches */ function createWatch(formId) { let accessToken = ScriptApp.getOAuthToken(); @@ -200,7 +200,7 @@ function createWatch(formId) { /** * Forms API Method: forms.watches.delete - * DELETE https://forms.googleapis.com/v1beta/forms/{formId}/watches/{watchId} + * DELETE https://forms.googleapis.com/v1/forms/{formId}/watches/{watchId} */ function deleteWatch(formId, watchId) { let accessToken = ScriptApp.getOAuthToken(); @@ -230,7 +230,7 @@ function deleteWatch(formId, watchId) { /** * Forms API Method: forms.watches.list - * GET https://forms.googleapis.com/v1beta/forms/{formId}/watches + * GET https://forms.googleapis.com/v1/forms/{formId}/watches */ function watchesList(formId) { Logger.log('formId is: ' + formId); @@ -255,7 +255,7 @@ function watchesList(formId) { /** * Forms API Method: forms.watches.renew - * POST https://forms.googleapis.com/v1beta/forms/{formId}/watches/{watchId}:renew + * POST https://forms.googleapis.com/v1/forms/{formId}/watches/{watchId}:renew */ function renewWatch(formId, watchId) { let accessToken = ScriptApp.getOAuthToken(); diff --git a/forms-api/demos/AppsScriptFormsAPIWebApp/Main.html b/forms-api/demos/AppsScriptFormsAPIWebApp/Main.html index f53ff9a8a..b3414959a 100644 --- a/forms-api/demos/AppsScriptFormsAPIWebApp/Main.html +++ b/forms-api/demos/AppsScriptFormsAPIWebApp/Main.html @@ -257,7 +257,7 @@

(spec)
+ (spec)
Form title: @@ -267,7 +267,7 @@

(spec)
+ (spec)
@@ -275,7 +275,7 @@

(spec)
+ (spec)
@@ -284,7 +284,7 @@

(spec)
+ (spec)
@@ -293,7 +293,7 @@

(spec)
+ (spec)
Response id:
@@ -303,7 +303,7 @@

(spec)
+ (spec)
@@ -312,7 +312,7 @@

(spec)
+ (spec)
Watch id:
@@ -322,7 +322,7 @@

(spec)
+ (spec)
@@ -331,7 +331,7 @@

(spec)
+ (spec)
Watch id:
From 9a3a31aa29e74599270f3660e42350deb9320a12 Mon Sep 17 00:00:00 2001 From: Christian Schalk Date: Mon, 14 Mar 2022 16:59:06 -0700 Subject: [PATCH 2/2] Updates for Forms API GA v1 --- forms-api/snippets/README.md | 6 ++---- forms-api/snippets/retrieve_all_responses.gs | 4 ++-- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/forms-api/snippets/README.md b/forms-api/snippets/README.md index 17026ac9c..189d7d6c0 100644 --- a/forms-api/snippets/README.md +++ b/forms-api/snippets/README.md @@ -1,4 +1,2 @@ -The Google Forms API is currently in Restricted Beta. To use the API and these -samples prior to General Availability, your Google Cloud project must be -allowlisted. To request that your project be allowlisted, complete the -[Early Adopter Program application](https://developers.google.com/forms/api/eap). +To run, you must set up your GCP project to use the Forms API. +See: https://developers.google.com/forms/api/ diff --git a/forms-api/snippets/retrieve_all_responses.gs b/forms-api/snippets/retrieve_all_responses.gs index 688adecdd..fd9939700 100644 --- a/forms-api/snippets/retrieve_all_responses.gs +++ b/forms-api/snippets/retrieve_all_responses.gs @@ -1,4 +1,4 @@ -# Copyright 2021 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -20,7 +20,7 @@ // Get OAuth Token var OAuthToken = ScriptApp.getOAuthToken(); Logger.log('OAuth token is: ' + OAuthToken); - var formsAPIUrl = 'https://forms.googleapis.com/v1beta/forms/' + formId + '/' + 'responses'; + var formsAPIUrl = 'https://forms.googleapis.com/v1/forms/' + formId + '/' + 'responses'; Logger.log('formsAPIUrl is: ' + formsAPIUrl); var options = { 'headers': {