Sharing private survey with service account email address

118 views Asked by At

I've created a service account from the initial guide and am using the same sample code published on the Google Surveys GitHub repo.

I see that I have to add my service account email as an owner to the individual survey from other answers to get the results, but so far this isn't working. It looks like an email is sent to that address to verify ownership, but nothing is sent to me. Is there another way to confirm this please?

I'm using the correct credentials JSON file in oauth.py but all requests return the following:

Error fetching survey results: <HttpError 403 when requesting https://www.googleapis.com/surveys/v2/surveys/{id}/results?alt=media returned "Forbidden">

Am I missing something? Thanks in advance for any help.

1

There are 1 answers

4
Maia Werbos On BEST ANSWER

To check the current owners of the survey, you have two options:

1) Google Surveys UI. Click on the survey on the Your Surveys page. Next, click on the Confirm Survey tab and look at the Details section at the bottom of the page. This will show you the current owners of the survey, and give you the option to add one.

2) Use the OAuth Playground (the Getting Started Guide has detailed directions). Call "get" on the survey to see its owners list (see "Send a GET request to examine a survey").

You can use the API to update the owners without the need for a confirmation email.

  • Follow the directions in the Getting Started Guide to set up the OAuth Playground with credentials attached to the Google account that owns this particular survey.
  • Then, use the PUT method on your survey to update the owners. Make a request in the OAuth Playground with:
    • HTTP Method: PUT
    • Request URI: https://www.googleapis.com/surveys/v2/surveys/{survey id}
    • Enter request body: { "owners": ["[email protected]"] }

Hope this helps! I'm on the Google Surveys team; if you have any further issues, feel free to send me the request ID for your failed request, so I can debug in more detail.