Upload a file to Drive
The one call in this section that is not a JSON body, a multipart upload to the account's own Drive.
Every other call in this section sends api_key and its fields as one JSON body. upload_drive_file_user
is the exception: the file itself has to travel as a multipart part, so api_key and the rest of
the fields ride alongside it as form fields instead of JSON. The endpoint is still /cpi/upload_drive_file_user,
same as any other method, multer is mounted ahead of the router for every route and only acts
when the request is actually multipart.
Method
Upload Drive File User
Uploads drive file to user drive.
upload_drive_file_user is one of the handful of methods with an empty fields array in the
registry (it takes a file, not typed parameters), so the interactive reference cannot show you its
inputs. They are read directly from the request by the handler, and reproduced from source below.
Walkthrough
Send the file as multipart, not JSON
The file part must be named file, that is the only field name multer is configured to accept.
Everything else is an ordinary form field on the same request: api_key, an optional path (the
folder to place it in, defaults to /), an optional make_public boolean, and an optional tags
value (a comma-separated string or a JSON array).
The response
Success answers code: 760, not the usual 1, branch on code > 0, not on a specific value. A
name collision at the same path is not an error either: the file is stored under a disambiguated
server_file_name and rename comes back true so you know the original name was not what
actually got used. filename always echoes the original upload name regardless.
Errors
Because this method has no declared fields, none of these come back as the usual
'x' is a mandatory field message, they are the handler's own text in data, all at code: -400:
A missing or unauthorized api_key still fails the normal way, at -401, before the handler is
ever reached. See Errors.