Print this page

Files Connect - Create a document using the Files Connect REST API

Knowledge Article Number 000230081
Description This article shows how to create an external Google Drive document with the Files Connect REST API v 35 (or higher) using the Salesforce Workbench. This approach also applies to other cloud systems like Sharepoint Online.

Prerequisites: Being able to access an org having a working Google Drive external data source. See Set Up Salesforce Files Connect.
  • Jump to REST explorer and click the Select button:
User-added image
  • To list the org's available external file repositories, execute a GET on
    /services/data/v35.0/connect/content-hub/repositories, and expand the repositories node.
    Choose a google drive repository and expand it as well:
User-added image
  • Click on the rootFolderItemsUrl property of the GDrive node to get the list of top level folders.
    You will be able to find the MyDrive folder in that list:
User-added image
  • Click on the folderItemsUrl property of the "My Drive" folder to navigate down to at its level and list its contents:
User-added image
Note: you can either stay on the "My Drive" folder to create a document there or repeat this process
to reach any child folder and use it as the document's location.
In this example, "My Drive" contains a folder named "Other" as well as 7 other folders or documents (aka items).
  • To create a document, change the request method to POST and click on the headers button.
    • In the Request header field, enter:
Content-Type: multipart/form-data; boundary=ArsfGT67minsdfhDSDFHHy987
Accept: Application/json
  • In the Request body field, enter:
Content-Type: application/json; charset=UTF-8
Content-Disposition: form-data; name="json"

"itemTypeId" : "document",
  "fields" :
              "name" : "name",
      "value" : "Created via Files Connect REST API"

Content-Disposition: form-data; name="fileData"; filename="HelloGDrive.txt"
Content-Type: application/octet-stream; charset=ISO-8859-1



  • Click Execute
  • The result should look like this:
User-added image
  • You may verify what just got created by opening the document in GDrive:
User-added image


promote demote