Google Docs, Sheets, and Slides with the Dropbox API

// By Jenny Dong and April Wang • Jun 07, 2019

Dropbox announced an integration with Google Cloud to enable users to create, open, and edit Google Docs, Sheets, and Slides files in Dropbox.

Soon, using the Dropbox API, developers can integrate with G Suite content. New endpoints and extensions to existing endpoints will help Dropbox developers work with these files to serve shared users. This post outlines the changes and updates you should be aware of when handling Google Docs, Sheets, and Slides with the Dropbox API.

Non-Downloadable Files

G Suite files will be returned by files/list_folder, and can be moved, renamed, and deleted like other Dropbox files. Previews and thumbnails are supported as well.

However, as online-only files, they are not directly downloadablefiles/list_folder & files/get_metadata have been updated accordingly, and will return new metadata:

{
    "entries": [
        {
            ".tag": "file",
            "name": "Prime_Numbers.gsheet",
            "id": "id:a4ayc_80_OEAAAAAAAAAXw",
            "client_modified": "2015-05-12T15:50:38Z",
            "server_modified": "2015-05-12T15:50:38Z",
            "rev": "a1c10ce0dd78",
            "size": 7212,
            "path_lower": "/homework/math/prime_numbers.gsheet",
            "path_display": "/Homework/math/Prime_Numbers.gsheet",
            "is_downloadable": false,
            "export_info": {
                "exports_as": "xlsx"
            },
            ...
        }
    ...
}

The new is_downloadable  value will indicate if calling files/download is supported to return the binary file. Calling files/download and related endpoints will return an unsupported_file  exception when is_downloadable is false.

Non-downloadable files can instead be exported in the new files/export API call, to an appropriate filetype indicated in the file’s export_info .  

The new include_non_downloadable_files parameter on files/list_folder, which defaults to true, can be used to omit these types of files from list results.

Shared Links Update

To date, shared links have granted read-only access to content. Starting with G Suite, some types of Dropbox files may also allow someone with the link to edit as well.  We have enhanced our shared links API to support this.

Shared links may have a link_access_level parameter, which defines read-only or editable. This new parameter may be returned by /sharing/list_shared_links and is settable by /sharing/ create_shared_link_with_settings.  

{
  ....
  "url": "https://www.dropbox.com/scl/fi/r0xdzphoh99eef2fazh8q/new%20gsheet.gsheet?dl=0&rlkey=yil8l6grehzwi8tfkg5sbiqoe",
  "id": "id:0uVLZNU2SdAAAAAAAAAQ7w",
  "name": "new gsheet.gsheet",
  "path_lower": "/new gsheet.gsheet",
  "link_permissions": {
    "link_access_level": {
      ".tag": "viewer"
    }
    "effective_audience": {
      ".tag": "public"
    }
  }
}

If the link access level is unspecified, the access level will be viewer by default.

With this enhancement, it will be possible for these types of files to have multiple links one for views and one for edits. The view access level can be used in conjunction with the audience parameter, so you could create a public view only link and an editable link for the team.  

Please also note the following behaviors:

  • G Suite links may not be returned by /sharing/list_shared_links if a path is not specified.

  • The password and expiration settings are not currently supported for G Suite shared links and will return an invalid_settings error if set.

  • These links will have an effective_audience parameter returned instead of resolve_visibility to indicate the effective visibility of the link. Eventually all links will transition to return effective_audience instead. 

  • Historically, shared links have been unique to the link creator and content. Thus, the same piece of shared content may have multiple links created by different users. Starting with G Suite files, some types of shared links may be unique to the content only, so all users share the link to the content.
 

Testing

If you’re part of a Dropbox Business team, your admin can enable G Suite access in the Dropbox Admin Console so that you can test against the new document types in Dropbox. Please feel free to contact us here with any questions or feedback about using the Dropbox API to manage G Suite files in Dropbox.

Build with Dropbox today at  www.dropbox.com/developers


// Copy link