Skip to content

Latest commit

 

History

History
120 lines (77 loc) · 2.55 KB

trash.rst

File metadata and controls

120 lines (77 loc) · 2.55 KB

Trash /trash

/trash endpoint deals with trashcan contents management.

Main responsabilities of this endpoint:
  • show trashcan contents
  • view trashcan single content
  • restore object (remove from trashcan, restore to system)
  • delete object (remove from database)

Contents in trashcan

You can obtain trash contents by using GET /trash and GET /trash/(object_id) endpoint.

GET /trash returns response 200 OK and contents as array, in 'data', as described in following example.

Example request:

http

GET /trash HTTP/1.1 Host: example.com Accept: application/json, text/javascript

Example response:

http

HTTP/1.1 200 OK Content-Type: application/json

{
"data": [

],

}

GET /trash/(object_id) returns response 200 OK if content is found, 404 Not Found otherwise.

Example request:

http

GET /trash/154 HTTP/1.1 Host: example.com Accept: application/json, text/javascript

Example response:

http

HTTP/1.1 200 OK Content-Type: application/json

{
"data": {

},

}

Restore contents

You can restore contents by using PATCH /trash/(object_id) endpoint.

Example request (restore object 55920)

In this example, purpose is restoring object 55920.

http

PATCH /trash/55920 HTTP/1.1 Host: example.com Accept: application/vnd.api+json Content-Type: application/vnd.api+json

{
"data": {

"id": 55920, "type": "objects"

}

}

Response 204 No Content is expected. When object is not found in trashcan, response is 404 Not Found.

http

HTTP/1.1 204 No Content Content-Type: application/vnd.api+json

Delete contents

You can completely remove contents from system by using DELETE /trash/(object_id) endpoint.

Example request (delete object 55920):

http

DELETE /trash/55920 HTTP/1.1 Host: example.com

Expected response is 204 No Content. When object is not found in trashcan, response is 404 Not Found.

http

HTTP/1.1 204 No Content