API Reference
Log In
API Reference

Moving & Copying Files

You'll need:

  • an access token
  • a SideDrawer Account

Moving Files

Steps

1. Get Drawer Folders

Get the Folders (record) in a Drawer (sidedrawer).

GET /api/v2/records/sidedrawer/sidedrawer-id/{sidedrawerId}/records

[
  {
    "id": "{originRecordId}",
    "name": "Origin Folder (record) name",
    "description": "string",
    "recordSubtype": {
      "name": "string",
      "logo": "string",
      "displayValue": [
        {
          "locale": "en-CA",
          "value": "string",
          "description": "string"
        }
      ],
      "orderId": 0
    },
    "recordSubtypeOther": "string",
    "storageLocation": "string",
    "recordType": {
      "name": "string",
      "sidedrawerType": "string",
      "sidedrawerTypeOtherName": "string",
      "logo": "string",
      "displayValue": [
        {
          "locale": "en-CA",
          "value": "string",
          "description": "string"
        }
      ],
      "cobrandId": "string",
      "orderId": 0
    },
    "status": "string",
    "updatedAt": "2024-08-09T18:34:12.500Z",
    "lastModifiedBy": "string",
    "contributors": [
      "string"
    ]
  }
]

2. "Move"

Call the "move" endpoint.

PUT /api/v2/record-files/sidedrawer/sidedrawer-id/{sidedrawerId}/records/record-id/{recordId}/record-files/move

{
    "destinationSidedrawerId": "{destinationSidedrawerId}",
    "destinationRecordId": "{destinationRecordId}",
    "fileToken": "string"
}
{
  "id": "{recordFileId}",
  "fileName": "string",
  "correlationId": "string",
  "uploadDetail": "string",
  "caption": "string",
  "uploader": "string",
  "url": "string",
  "fileTypeEnum": "image"
}

3. Get original Folder files

Get the list of files in the origin Folder (record) from the database.

GET /api/v2/record-files/sidedrawer/sidedrawer-id/{sidedrawerId}/records/record-id/{recordId}/record-files

In this example, the file we moved was the only file in the original Folder. The response of the endpoint shows that there are no more files in the original folder, as we would expect, since we moved the only file there was.

{
    "data": [],
    "hasMore": false,
    "nextPage": null,
    "previousPage": null,
    "totalCount": 0
}

4. Get original cloud folder files

Get the list of files in the origin Folder (record) from the cloud storage folder.

GET /api/v2/record-files/sidedrawer/sidedrawer-id/{sidedrawerId}/records/record-id/{recordId}/cloud-folder-record-files

As above, we expect and get a response that shows there are no more files in the original Folder.

{
    "data": [],
    "endingBefore": null,
    "startingAfter": null,
    "hasMore": false
}

Copying Files

Steps

1. Get Drawer Folders

Get the Folders (record) in a Drawer (sidedrawer).

GET /api/v2/records/sidedrawer/sidedrawer-id/{sidedrawerId}/records

[
  {
    "id": "{originRecordId}",
    "name": "Origin Folder (record) name",
    "description": "string",
    "recordSubtype": {
      "name": "string",
      "logo": "string",
      "displayValue": [
        {
          "locale": "en-CA",
          "value": "string",
          "description": "string"
        }
      ],
      "orderId": 0
    },
    "recordSubtypeOther": "string",
    "storageLocation": "string",
    "recordType": {
      "name": "string",
      "sidedrawerType": "string",
      "sidedrawerTypeOtherName": "string",
      "logo": "string",
      "displayValue": [
        {
          "locale": "en-CA",
          "value": "string",
          "description": "string"
        }
      ],
      "cobrandId": "string",
      "orderId": 0
    },
    "status": "string",
    "updatedAt": "2024-08-09T18:34:12.500Z",
    "lastModifiedBy": "string",
    "contributors": [
      "string"
    ]
  }
]

2. "Copy"

Call the "copy" endpoint.

PUT /api/v2/record-files/sidedrawer/sidedrawer-id/{sidedrawerId}/records/record-id/{recordId}/record-files/copy

{
    "destinationSidedrawerId": "{destinationSidedrawerId}",
    "destinationRecordId": "{destinationRecordId}",
    "fileToken": "{originalFileToken}"
}
{
    "cloudStorage": false,
    "displayType": "review",
    "quarantined": false,
    "sealed": false,
    "active": true,
    "scan": false,
    "clean": false,
    "createdAt": "2024-08-09T18:54:53.356Z",
    "updatedAt": "2024-08-09T18:54:53.356Z",
    "correlationId": "",
    "sidedrawer": "{destinationSidedrawerId}",
    "recordDetail": "string",
    "fileName": "string",
    "caption": "string",
    "uploadTitle": "string",
    "fileExtension": "txt",
    "fileSize": 4668,
    "blocks": [
        {
            "order": 0,
            "hash": "{hash}"
        }
    ],
    "uploader": "auth0|string",
    "fileType": "document",
    "metadata": [],
    "format": "blocks",
    "_id": "{recordFileId}",
    "fileToken": "string",
    "checkSum": "{hash}"
}

3. Get original folder files

Get the list of files in the origin Folder (record) from the database.

GET /api/v2/record-files/sidedrawer/sidedrawer-id/{sidedrawerId}/records/record-id/{recordId}/record-files

Since, in this example, we've copied the original file and moved it, rather than just moving the original file as in the "Moving Files" example, we expect to still see that the file is in this Folder (record). And that is indeed what the response shows!

[
    {
        "cloudStorage": false,
        "displayType": "review",
        "quarantined": false,
        "sealed": false,
        "active": true,
        "scan": false,
        "clean": false,
        "updatedAt": "2024-08-09T15:43:59.709Z",
        "fileToken": "string",
        "sidedrawer": "{destinationSidedrawerId}",
        "recordDetail": "{recordDetail}",
        "fileType": "document",
        "fileName": "string",
        "fileExtension": "txt",
        "fileSize": 4668,
        "uploader": "string",
        "caption": "string",
        "uploadTitle": "string",
        "metadata": [],
        "format": "blocks",
        "checkSum": "{hash}",
        "blocks": [
            {
                "hash": "{hash}",
                "order": 1
            }
        ],
        "id": "string",
        "uploaderOpenId": "auth0|string",
        "lastModifiedBy": "string",
        "record": "string"
    }
]

4. Get original cloud folder files

Get the list of files in the origin Folder (record) from the cloud storage folder.

GET /api/v2/record-files/sidedrawer/sidedrawer-id/{sidedrawerId}/records/record-id/{recordId}/cloud-folder-record-files

Since we didn't have any files in the cloud storage folder to begin with, it makes sense that we don't have any there now.

{
    "data": [],
    "endingBefore": null,
    "startingAfter": null,
    "hasMore": false
}