Notice: important security update for Drive document URLs and resource keys. For more information, refer to Access link-shared files using resource keys

Handle a New URL

When a user clicks the "New" button and selects an app in the Drive UI, Drive redirects the user to that app's New URL defined when you Configure a Drive integration.

As mentioned in Configure a Drive UI integration, your app receives a default set of template variables within a state parameter. The default state information for a New URL is:


To handle this information:

  1. Detect the create value in the state parameter to verify that this is a request to create a new file.

  2. Use the files.create method to create the file using the folderId and userId values.

The state parameter is URL-encoded, so your app must handle the escape characters and parse it as JSON.