edoc content services Guide
Breadcrumbs

Create a document and transfer a file

Method and endpoint

POST /Documents

You can use the POST /Documents method and endpoint to create a new document including the associated properties and file in the selected destination system.

Things to know

Each document must and can only contain one file. In some destination systems, you can save several files per document. Even in these destination systems, edoc content services only saves a single file per document.

You will receive the following information:

  • FileContentBase64: Specifies the file as a Base64 string.

  • Category: Specifies the category to which the document is to be assigned in the destination system.

  • FileName: Displays the name of the file.

  • Properties: Specifies the properties of the document. A property consists of the property name and an array of values. If there is only one value, the array only contains this one element.

Information on retrieving the category and its properties can be found under: Retrieve the categories of a destination system

If the process was successful, the ID of the new document is returned. The returned document ID was automatically assigned by the destination system.

Example of a request

JSON
POST /Documents
Accept: application/json
ModuleId: sharepoint
ConnectionString: targetHost=https://test.sharepoint.com;User=MyUserName;Password=MyPassword;ListId=MyListId;

{
  "fileContentBase64": "dGVzdCAwMg0KMTExMQ0KMjIyMg0KMzMzMzMzDQo0NDQ0NDQ0DQo1NTU1NTU1NQ0KNjY2NjY2NjY2DQo3Nzc3Nzc3Nzc3Nw0KODg4ODg4ODg4ODg4OA==",
  "category": "dc4af18a-dd54-4735-bad5-92517e8653f2",
  "fileName": "MyFile.txt",
  "properties": {
    "Title": [
      "This is MyDocument"
    ],
    "TenantId": [
      "1234"
    ],
    "Tenant_x0020_Name": [
      "MyTenant"
    ],
    "Vendor_x002d_No_x002e_": [
      "9876"
    ],
    "Vendor_x002d_Name": [
      "MyVendor"
    ]
  }
}

Example of a response

JSON
{
  "id": "762f8698-f605-4de5-89fb-6f5fff3435fd",
  "link": "https://MyContentService/Documents/762f8698-f605-4de5-89fb-6f5fff3435fd"
}