Derive a Google Form View ID from the Definition ID
<p>When I define a form, it has the url:</p>

<p><a href="https://docs.google.com/a/domain.com/forms/d/1d2Y9R9JJwymtjEbZI6xTMLtS9wB7GDMaopTQeNNNaD0/edit" rel="nofollow">https://docs.google.com/a/domain.com/forms/d/1d2Y9R9JJwymtjEbZI6xTMLtS9wB7GDMaopTQeNNNaD0/edit</a></p>

<p>I finish adding the questions I want the form to have and use the "Send" button to distribute my form, I do not click the "Include form in email" tickbox. The person that I e-mail the form to now recieves and e-mail inviting them to complete the form, when they do so they end up on a page with the following url:</p>

<p><a href="https://docs.google.com/a/domain.com/forms/d/e/1FAIpQLScINR5rudwEKNVwlvz45ersqk_SO0kNcyN_EM1tJe3mXeFksw/viewform" rel="nofollow">https://docs.google.com/a/domain.com/forms/d/e/1FAIpQLScINR5rudwEKNVwlvz45ersqk_SO0kNcyN_EM1tJe3mXeFksw/viewform</a></p>

<p>In my AppEngine / Python 2.7 code I only have access to this id - '1d2Y9R9JJwymtjEbZI6xTMLtS9wB7GDMaopTQeNNNaD0' - my question is how can I get from this original definition id to the view id - '1FAIpQLScINR5rudwEKNVwlvz45ersqk_SO0kNcyN_EM1tJe3mXeFksw'</p>

<p>I have tried using the Google Drive v2 AND v3 REST API's to retrieve the 'definition' file but the response has no reference (that I can see) to this 'view' id.
I have also tried using Google AppsScript FormApp API to retrieve the 'definition' form, but this also contains no reference (that I can see) to the 'view' id.
In all the cases I have tried if I use the 'view' ID as the source the API's return a 404 error indicating that this 'view' ID is not the ID of a Google Drive file.</p>

<p>Any ideas?</p>

<p>Use Google Apps Script to publish a Web App (or use the Execution API) to leaverage the "getPublishedUrl" function</p>

<pre><code>function doGet(theRequest){
  var theDefinitionId = theRequest.parameters.formId;
  var thePublishedUrl = myAPI_(theDefinitionId);
  var output = ContentService.createTextOutput(thePublishedUrl);
  output = output.setMimeType(ContentService.MimeType.JSON);
  return output;
}

function myAPI_(theDefinitionId){
  var thePublishedUrl = null;
  try{
    var existingForm = FormApp.openById(theDefinitionId);
    thePublishedUrl = existingForm.getPublishedUrl();
  } catch (err){
    Logger.log(err);
  }
  var theReturn = {publishedUrl: thePublishedUrl};
  var theJSONReturn = JSON.stringify(theReturn);
  return theJSONReturn;
}
</code></pre>

python google-form