• Register

Trash API

The Trash API allows you to list, restore, and permanently remove deleted files and folders in your Egnyte account's trash. Note that only administrators or power users with trash management privileges can generate a list of items that are in the trash.

Trash Contents v1 (to be deprecated)

This endpoint is used to list all of the contents of the trash in your domain.

GET/pubapi/v1/fs/trash

Request Parameters

Parameter Description Required Possible Values
sort_by Controls how the list is sorted. The default is to sort by deletion date. No delete_date, name, deleted_by, purge_date
sort_direction Determines whether list items are sorted in ascending or descending order. The default is to sort by descending order. No asc, desc
count Limits the number of entries per page. The default is to display 50 entries per page. No Any non-negative integer
offset The 0-based index of the initial entries being requested. No Any non-negative integer

Method-specific Response Codes

Error Code Error Message HTTP Code Troubleshooting
Forbidden User is not authorized to manage resources. 403 Only admins can modify the contents of the trash.

Sample Response Body

The response is a list of trashItems.

{
  "count": 2,
  "offset": 0,
  "items":[
    {
    "id": "NWM5ZTViMWMtOWMxNS00MDM3LWE5NjgtYTkzYzlhNTgzZjg4fDE0NjA5OTU4OTgwOTh8ZmlsZQ",
    "type": "file",
    "path": "/Private/asmith/2013-06-22 12.36.20.jpg",
    "size": 1733,
    "owner": {
      "_self":{
        "url": "/rest/public/1.0/users/1"
        },
      "id": 1,
      "username": "asmith",
      "firstName": "Ashley",
      "lastName": "Smith",
      "email": "asmith@abccompany.com",
      "typeName": "admin"
      },
    "name": "2013-06-22 12.36.20.jpg",
    "deleted_by": "Ashley Smith",
    "delete_date": "2016-04-18T16:11:38Z",
    "purge_date": "2016-05-19T00:00:00Z",
    "last_modified": "2016-04-18T16:11:09Z"
      },
      {
      "id": "Y2U3MDVlNmItOWJhYS00ZjA2LTk5Y2EtNTZlMzA4YjFmNTkzfDE0NjA5OTU4OTc4OTZ8ZmlsZQ",
      "type": "folder",
      "path": "/Shared/test1/sampleFolder",
      "deleted_by": "Cara de Freitas Bart",
      "delete_date": "2016-04-18T16:11:37Z",
      "purge_date": "2016-05-19T00:00:00Z",
      "name" : "sampleFolder"
      }],
      "total_count": 2
}

Trash Contents v2

This endpoint is used to list all of the contents of the trash in your domain.

GET/pubapi/v2/fs/trash

Request Parameters

Parameter Description Required Possible Values
sort_by Controls how the list is sorted. The default is to sort by deletion date. No delete_date, name, deleted_by, purge_date
sort_direction Determines whether list items are sorted in ascending or descending order. The default is to sort by descending order. No asc, desc
count Limits the number of entries per page. The default is to display 50 entries per page. No Any non-negative integer
offset Specifies the offset of the first entry to be returned. The default offset is 0. No Any non-negative integer
deletedBy Searches by a specific user by their first and/or last name (same as the WebUI search) No Valid first/last name as a string encoded
startDate The start datetime to search for the files (similar to the usage in the WebUI) No, unless deletedBy or endDate are used ISO-8601 format, e.g. "2016-04-18T16:11:38Z"
endDate The end datetime to search for the files (similar to the usage in the WebUI) No, unless deletedBy or startDate are used ISO-8601 format, e.g. "2016-04-18T16:11:38Z"

Method-specific Response Codes

Error Code Error Message HTTP Code Troubleshooting
Forbidden User is not authorized to manage resources. 403 Only admins can modify the contents of the trash.

Sample Response Body

The response is a list of trashItems.

{
  "count": 2,
  "offset": 0,
  "items":[
    {
    "id": "NWM5ZTViMWMtOWMxNS00MDM3LWE5NjgtYTkzYzlhNTgzZjg4fDE0NjA5OTU4OTgwOTh8ZmlsZQ",
    "type": "file",
    "path": "/Private/asmith/2013-06-22 12.36.20.jpg",
    "size": 1733,
    "owner": {
      "_self":{
        "url": "/rest/public/1.0/users/1"
        },
      "id": 1,
      "username": "asmith",
      "firstName": "Ashley",
      "lastName": "Smith",
      "email": "asmith@abccompany.com",
      "typeName": "admin"
      },
    "name": "2013-06-22 12.36.20.jpg",
    "deleted_by": "Ashley Smith",
    "delete_date": "2016-04-18T16:11:38Z",
    "purge_date": "2016-05-19T00:00:00Z",
    "last_modified": "2016-04-18T16:11:09Z"
      },
      {
      "id": "Y2U3MDVlNmItOWJhYS00ZjA2LTk5Y2EtNTZlMzA4YjFmNTkzfDE0NjA5OTU4OTc4OTZ8ZmlsZQ",
      "type": "folder",
      "path": "/Shared/test1/sampleFolder",
      "deleted_by": "Cara de Freitas Bart",
      "delete_date": "2016-04-18T16:11:37Z",
      "purge_date": "2016-05-19T00:00:00Z",
      "name" : "sampleFolder"
      }],
  "has_more": false
}

Trash Total Count

This endpoint is used to list the total count of the trash in your domain. Since the v2 version of the listing only has a has_more boolean for pagination, this call should be made first if you need to determine the total count of your domain. This total_count was removed from the v2 endpoint

GET/pubapi/v2/fs/trash/totalcount

Sample Response Body

The response is a total count of the items in trash.

{
  "totalCount": 2
}

Restore Items from Trash

This endpoint is used to retrieve up 10 specified files, folders, and versions from the trash.

POST/pubapi/v1/fs/trash

Request Parameters

To restore multiple files and folders at once, send a request with a list of ids.

Parameter Description Required
action The type of action that should be performed on the selected files and folders. For this call, the action is RESTORE. Yes
ids The ids for each of the items to be restored as an array. Yes

Method-specific Response Codes

Error Code Error Message HTTP Code Troubleshooting
OK The request was successful. 200 The items have been restored from the trash.
Multi-Status Some of the request items were not restored successfully. 207 Check that the items that failed are in the trash.
Not Found Item not found. 404 Ensure that the requested item is in the trash.

Sample Request Body

Request up to 10 trashItems to restore.

{
  "action": "RESTORE",
  "ids": [
    "NWM5ZTViMWMtOWMxNS00MDM3LWE5NjgtYTkzYzlhNTgzZjg4fDE0NjA5OTU4OTgwOTh8ZmlsZQ",
    "Y2U3MDVlNmItOWJhYS00ZjA2LTk5Y2EtNTZlMzA4YjFmNTkzfDE0NjA5OTU4OTc4OTZ8ZmlsZQ"
  ]
}

Sample Response Body for 207 Status Code

{
  "resources": [
    {
      "id": "NWM5ZTViMWMtOWMxNS00MDM3LWE5NjgtYTkzYzlhNTgzZjg4fDE0NjA5OTU4OTgwOTh8ZmlsZQ",
      "code": "200"
    },
    {
      "id": "Y2U3MDVlNmItOWJhYS00ZjA2LTk5Y2EtNTZlMzA4YjFmNTkzfDE0NjA5OTU4OTc4OTZ8ZmlsZQ",
      "code": "404",
      "descriptions": Item not found"
    } 
  ]
}

Delete Items from Trash

This endpoint is used to permanently remove up to 10 specified files, folders, and versions from your account's trash.

POST/pubapi/v1/fs/trash

Request Parameters

To permanently delete multiple files and folders at once, send a request with a list of ids.

Parameter Description Required
action The type of action that should be performed on the selected files and folders. For this call, the action is PURGE. Yes
ids The ids for each of the items to be permanently deleted as an array. Yes

Method-specific Response Codes

Error Code Error Message HTTP Code Troubleshooting
OK The request was successful. 200 The items have been permanently deleted from the trash.
Multi-Status Some of the request items were not purged successfully. 207 Check that the items that failed are in the trash.
Not Found Item not found. 404 Ensure that the requested item is located in the trash.

Sample Request Body

Request up to 10 trashItems to permanently delete from the trash.

{
  "action": "PURGE",
  "ids": [
    "NWM5ZTViMWMtOWMxNS00MDM3LWE5NjgtYTkzYzlhNTgzZjg4fDE0NjA5OTU4OTgwOTh8ZmlsZQ",
    "Y2U3MDVlNmItOWJhYS00ZjA2LTk5Y2EtNTZlMzA4YjFmNTkzfDE0NjA5OTU4OTc4OTZ8ZmlsZQ"
  ]
}

Sample Response Body for 207 Status Code

{
  "resources": [
    {
      "id": "NWM5ZTViMWMtOWMxNS00MDM3LWE5NjgtYTkzYzlhNTgzZjg4fDE0NjA5OTU4OTgwOTh8ZmlsZQ",
      "code": "200"
    },
    {
      "id": "Y2U3MDVlNmItOWJhYS00ZjA2LTk5Y2EtNTZlMzA4YjFmNTkzfDE0NjA5OTU4OTc4OTZ8ZmlsZQ",
      "code": "404",
      "descriptions": Item not found"
    } 
  ]
}