Skip to content

Latest commit

 

History

History
126 lines (97 loc) · 2.68 KB

proto.md

File metadata and controls

126 lines (97 loc) · 2.68 KB

REQUESTS OVERVIEW

  • create:

    POST http://example.com/upload
    Content-Type: application/json; charset=UTF-8
    X-Upload-Content-Length: 2469036
    X-Upload-Content-Type: video/mp4
    
    {"name":"file.mp4","mimeType":"video/mp4","size":2469036,"lastModified":1497077951924}
    HTTP/1.1 201 Created
    Location: //example.com/upload?upload_id=471e97554f21dec3b8bb5d4602939c51
    Content-Length: 0

    If status code is 200, i.e. the file already exists, send a resume request

  • send chunk:

    PUT http://example.com/upload?upload_id=471e97554f21dec3b8bb5d4602939c51
    Content-Type: application/octet-stream
    Content-Range: bytes 0-262143/2469036
    Content-Length: 262144
    
    [BYTES 0-262143]
    HTTP/1.1 308 Resume Incomplete
    Range: bytes=0-262143
    Content-Length: 0
  • send last chunk:

    PUT http://example.com/upload?upload_id=471e97554f21dec3b8bb5d4602939c51
    Content-Length: 634028
    Content-Range: bytes 1835008-2469035/2469036
    Content-Type: application/octet-stream
    
    [BYTES 1835008-2469035]
    HTTP/1.1 200 OK
    Content-Length: 86
    Content-Type: application/json
    {"name":"file.mp4","mimeType":"video/mp4","size":2469036,"lastModified":1497077951924}
  • resume:

    PUT http://example.com/upload?upload_id=471e97554f21dec3b8bb5d4602939c51
    Content-Type: application/octet-stream
    Content-Range: bytes */2469036
    Content-Length: 0
    HTTP/1.1 308 Resume Incomplete
    Range: bytes=0-1835007
    Content-Length: 0
  • cancel:

    DELETE http://example.com/upload?upload_id=471e97554f21dec3b8bb5d4602939c51
    Content-Length: 0
    HTTP/1.1 204 No Content
    Content-Length: 0

EXTRAS (EXPERIMENTAL)

  • update:

    PATCH http://example.com/upload?upload_id=471e97554f21dec3b8bb5d4602939c51
    Content-Type: application/json; charset=UTF-8
    {"name":"file2.mp4"}
    HTTP/1.1 200 OK
    Content-Length: 87
    Content-Type: application/json
    {"name":"file2.mp4","mimeType":"video/mp4","size":2469036,"lastModified":1497077951924}
  • info:

    GET http://example.com/upload?upload_id=471e97554f21dec3b8bb5d4602939c51
    GET http://example.com/upload/471e97554f21dec3b8bb5d4602939c51
    HTTP/1.1 200 OK
    Content-Length: 87
    Content-Type: application/json
    [{"name":"videos/file.mp4","updated":"2021-04-19T12:19:46.132Z"}]
    GET http://example.com/upload
    HTTP/1.1 200 OK
    Content-Length: 130
    Content-Type: application/json
    [{"name":"videos/file.mp4","updated":"2021-04-19T12:19:46.132Z"},{"name":"videos/file2.mp4","updated":"2021-04-19T12:19:45.132Z"}]