User Tools

Site Tools


This is an old revision of the document!


API of sample file storage service

Support three operation: upload, delete, list

Code: https://github.com/onborodin/ng-lorem/blob/master/backend/routers/files.js

Upload

* Request: POST multipart form

curl -vk -F 'file=@'/home/ziggi/data.bin https://lorem.unix7.org/data/upload
  • Responce
{
  "jsonrpc": "2.0",
  "result": [
    {
      "id": 10,
      "fileName": "data.bin",
      "blobName": "blob-20190122021242-4665ba5033e74c02f7bef43805065847.png",
      "mimeType": "image/png",
      "createdAt": "2019-01-22T12:12:42.302Z",
      "updatedAt": "2019-01-22T12:12:42.302Z"
    }
  ],
  "id": "00b850a0-4949-4234-9c5b-d7d56e375f5e"
 }

Delete (Drop)

  • Request: GET
curl -vk https://lorem.unix7.org/data/drop/10
  • Responce
{
  "jsonrpc": "2.0",
  "result": true,
  "id": "e05d8f67-34f3-4eb1-987d-a2fc8f33844b"
}

List

  • Request: GET
curl -kv https://lorem.unix7.org/data/list
  • Responce
{
  "jsonrpc": "2.0",
  "result": [
    {
      "id": 6,
      "fileName": "qwe123.jpg",
      "blobName": "blob-20190117045711-ad29d87a4988d42ec856e9655e0b4a3f.jpg",
      "mimeType": "image/jpeg",
      "createdAt": "2019-01-17T14:57:11.934Z",
      "updatedAt": "2019-01-17T14:57:11.934Z"
    },
    {
      "id": 7,
      "fileName": "qwe123.jpg",
      "blobName": "blob-20190117045726-fc7670db29f3e1c400c2f02bf3420b2d.jpg",
      "mimeType": "image/jpeg",
      "createdAt": "2019-01-17T14:57:26.644Z",
      "updatedAt": "2019-01-17T14:57:26.644Z"
    },
    {
      "id": 8,
      "fileName": "feelings_about_angularjs_over_time.png",
      "blobName": "blob-20190117082949-9c2e8444cd90c6e26f6d1469fafaa2b8.png",
      "mimeType": "image/png",
      "createdAt": "2019-01-17T18:29:49.454Z",
      "updatedAt": "2019-01-17T18:29:49.454Z"
    },
    {
      "id": 9,
      "fileName": "IMG_20181224_193653.jpg",
      "blobName": "blob-20190118102434-a2d2b0622f6963a04a50534260ec1d27.jpg",
      "mimeType": "image/jpeg",
      "createdAt": "2019-01-18T08:24:35.176Z",
      "updatedAt": "2019-01-18T08:24:35.176Z"
    }
  ],
  "id": "5be81a08-4793-45fa-a3d9-ef432c8d6042"
}

First PagePrevious PageBack to overviewNext PageLast Page