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:
{
"action":"create",
"folderId":"0ADK06pfg",
"userId":"103354693083460731603"
}
To handle this information:
Detect the
create
value in thestate
parameter to verify that this is a request to create a new file.Use the
files.create
method to create the file using thefolderId
anduserId
values.
The state
parameter is URL-encoded, so your app must handle the escape
characters and parse it as JSON.