Loading

Create a document using the 'Files Connect' REST API

Дата публикации: Oct 13, 2022
Описание

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. 

NOTE: There is no current functionality to Create or Delete items in BOX using the REST API.

Prerequisites: Being able to access an org having a working Google Drive external data source. See Set Up Salesforce Files Connect.
Решение

To create a document in the cloud using 'REST explorer' in Workbench.


Part I
 
1. Go to Workbench (use API version 35 or higher). 
2. Select REST Explorer in 'Jump to:'.
3. Click Select.
4. Select GET.
5. Enter /services/data/v35.0/connect/content-hub/repositories
6. Click Execute.
7. Expand the 'repositories' node. 
8. Expand a google drive repository.
9. Click the rootFolderItemsUrl property of the GDrive node to get the list of top level folders.
10. Click the folderItemsUrl property of the 'My Drive' folder and list its contents. 

Part II - Create the document
 
1. Click POST.
2. Click Headers.
3. In 'Request Headers', enter

Content-Type: multipart/form-data; boundary=ArsfGT67minsdfhDSDFHHy987
Accept: Application/json


4. In 'Request body', enter:

--ArsfGT67minsdfhDSDFHHy987
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"
             }
           ]
}

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

[HELLO GDRIVE!!!]

--ArsfGT67minsdfhDSDFHHy987--



4. Click Execute.

Result: You may verify what just got created by opening the document in GDrive.

Note: Documents created using the 'Files Connect' REST API will have the 'Created by' field as the user who set up the Files connect.
Номер статьи базы знаний

000387790

 
Загрузка
Salesforce Help | Article