Developer Console

RESTful API Trash

Soft delete a node

Trash API  

This API lets you trash nodes and put them in the recycle bin. You can also get all of the nodes in the recycle bin and restore nodes them from their previous state.

Method Http Request Description
add PUT : /trash/{id} Add to trash
list GET : /trash List nodes in trash
restore POST : /trash/{id}/restore Restore from trash

Add to Trash

To add a node to a trash:

PUT : /trash/{id}

Returns

The metadata information of the node which was trash.

Sample Request

To trash a node with id "iQ4EDxXhNfPXVPHgWM3PS5" it will be:

PUT : https://cdws.us-east-1.amazonaws.com/drive/v1/trash/iQ4EDxXhNfPXVPHgWM3PS5

cURL Request

curl -v -X PUT --data '{"kind":"FILE", "name":"renameFileTest"}'
https://cdws.us-east-1.amazonaws.com/drive/v1/trash/161kKftTTTuRee1hicOhAw
--header "Authorization: Bearer
Atza|IQEBLjAsAhQ5zx7pKp9PCgCy6T1JkQjHHOEzpwIUQM"

Sample JSON Response

HTTP /1.1 200 OK.

{
    "id": "iQ4EDxXhNfPXVPHgWM3PS5"
    "name": "foo.zip"
    "kind": "FILE",
    "version": 1,
    "modifiedDate": "2014-03-07T22:31:12.173Z",
    "creationDate": "2014-03-07T22:31:12.173Z",
    "labels": ["ZIP File"]
    "description": "All My Data".
    "createdBy": "ApplicationId2",
    "status": TRASH "restricted": false
}

Response codes

Code Description
200 OK.
401 The client passed in the invalid Auth token. Client should refresh the token and then try again.
403 Forbidden.
404 Resource Not Found.
500 Servers are not working as expected. The request is probably valid but needs to be requested again later.
503 Service Unavailable.

List Trash

List all the nodes which are in trash. List limit of 200 per page.

GET : /trash

Returns

The metadata information of the nodes which are in trash.

Sample Request

GET : https://cdws.us-east-1.amazonaws.com/drive/v1/trash

cURL Request

curl -v
"https://cdws.us-east-1.amazonaws.com/drive/v1/trash" --header
"Authorization: Bearer
Atza|IQEBLjAsAhQ5zx7pKp9PCgCy6T1JkQjHHOEzpwIUQM"

Sample JSON Response

HTTP /1.1 200 OK

{
    "count": 123,
    "nextToken": "asdrevdsdsdqewefewfew",
    "data": [{
            "id": "dzJZtGS9MNrxYsQDdhlRjU"
            "name": "Camera"
            "kind": "FOLDER",
            "version": 1,
            "modifiedDate": "2014-03-07T22:31:12.173Z",
            "creationDate": "2014-03-07T22:31:12.173Z",
            "labels": ["ALBUM"],
            "createdBy": "ApplicationId1",
            "parents": ["wrYfdhwOezz842YN0YBwvY", "bUWtqrNhjSgTVb4NDG8oJC"],
            "status": TRASH,
            "restricted": false
        },
        {
            "id": "5UvlwgPdnCOP_vsOBGCdD4"
            "name": "foo.zip"
            "kind": "FILE",
            "version": 1,
            "modifiedDate": "2014-03-07T22:31:12.173Z",
            "creationDate": "2014-03-07T22:31:12.173Z",
            "labels": ["ZIP File"]
            "description": "All My Data".
            "createdBy": "ApplicationId2",
            "status": "TRASH"
        }, ...
    ]
}

Response codes

Code Description
200 OK.
401 The client passed in the invalid Auth token. Client should refresh the token and then try again.
403 Forbidden.
500 Servers are not working as expected. The request is probably valid but needs to be requested again later.
503 Service Unavailable.

Restore

To restore the node from the trash:

POST : /trash/{id}/restore

Returns

The metadata information of the node which was restore.

Sample Request

POST : https://cdws.us-east-1.amazonaws.com/drive/v1/trash/eUtFdWyPZNMP0ydPw5DQ1f/restore

cURL Request

curl -v -X POST
https://cdws.us-east-1.amazonaws.com/drive/v1/trash/161kKftTTTuRee1hicOhAw/restore
--header "Authorization: Bearer
Atza|IQEBLjAsAhQ5zx7pKp9PCgCy6T1JkQjHHOEzpwIUQM"

Sample JSON Response

HTTP /1.1 200 OK

{

    "id": "eUtFdWyPZNMP0ydPw5DQ1f"
    "name": "foo.zip"
    "kind": "FILE",
    "version": 1,
    "modifiedDate": "2014-03-07T22:31:12.173Z",
    "creationDate": "2014-03-07T22:31:12.173Z",
    "labels": ["ZIP File"],
    "description": "All My Data",
    "createdBy": "ApplicationId2",
    "status": "AVAILABLE",
    "restricted": false
}

Response codes

Code Description
200 OK.
400 The id is not present in the system.
401 The client passed in the invalid Auth token. Client should refresh the token and then try again.
403 Forbidden.
500 Servers are not working as expected. The request is probably valid but needs to be requested again later.
503 Service Unavailable.

Support

If you have any questions, see the Developer Forum.