Skip to content
This repository has been archived by the owner on Feb 20, 2021. It is now read-only.

Latest commit

 

History

History
129 lines (96 loc) · 2.89 KB

file.md

File metadata and controls

129 lines (96 loc) · 2.89 KB

File

The first resource that needs to be created to upload a file is the Upload resource. After the upload is finished you need to create a new File resource that will published via real time to all the other members of the List you are creating the File in.

Get Files for a Task or List

GET a.wunderlist.com/api/v1/files

Params

name type notes
task_id integer required

or

name type notes
list_id integer required

Response

200 OK

json
[
  {
    "id": 123456,
    "url": "http://uploads-s3-wunderlist-production.com/43ht43-file.md",
    "task_id": 123,
    "list_id": 123,
    "user_id": 123,
    "file_name": "file.md",
    "content_type", "text/plain",
    "file_size": 1234124,
    "local_created_at": "2013-08-02T11:58:55.123Z",
    "created_at": "2013-08-02T11:58:55Z",
    "updated_at": "2013-08-02T11:58:55Z",
    "type": "file",
    "revision": 1
  }
]

Get a specific File

GET a.wunderlist.com/api/v1/files/:id

Response

200 OK

json
{
  "id": 123456,
  "url": "http://uploads-s3-wunderlist-production.com/43ht43-file.md",
  "task_id": 123,
  "list_id": 123,
  "user_id": 123,
  "file_name": "file.md",
  "content_type", "text/plain",
  "file_size": 1234124,
  "local_created_at": "2013-08-02T11:58:55.123Z",
  "created_at": "2013-08-02T11:58:55Z",
  "updated_at": "2013-08-02T11:58:55Z",
  "type": "file",
  "revision": 1
}

Create a File

For creating files we have introduced the :local_created_at from comments again. This attribute will help us later to sort the files and comments in the right order. The field needs to be send in the following format: 2013-08-02T11:58:55.123Z

POST a.wunderlist.com/api/v1/files

Data

name type notes
upload_id integer required
task_id integer required
local_created_at datetime optional

Response

201 Created

json
{
  "id": 123456,
  "url": "http://uploads-s3-wunderlist-production.com/43ht43-file.md",
  "task_id": 123,
  "list_id": 123,
  "user_id": 123,
  "file_name": "file.md",
  "content_type", "text/plain",
  "file_size": 1234124,
  "local_created_at": "2013-08-02T11:58:55.123Z",
  "created_at": "2013-08-02T11:58:55Z",
  "updated_at": "2013-08-02T11:58:55Z",
  "type": "file",
  "revision": 1
}

Destroy a File

DELETE a.wunderlist.com/api/v1/files/:id

Params

name type notes
revision integer required

Response

On Success:

204 No Content

On Failure:

400 Bad Request

json
{
  "errors": ["bad request"]
}