User Tools

Site Tools


Differences

This shows you the differences between two versions of the page.

Link to this comparison view

lorem-rpc [2019-06-21 14:14]
lorem-rpc [2020-02-15 00:57] (current)
Line 1: Line 1:
 +
 +=====API of sample file storage service=====
 +
 +Support three operation: upload, delete, list
 +
 +Code: [[https://​github.com/​sadsoldier/​ng-lorem/​blob/​master/​backend/​routers/​files.js]]
 +
 +====Upload====
 +
 + * Request: POST multipart form 
 +
 +<​code>​
 +curl -vk -F '​file=@'/​home/​user/​data.bin https://​lorem.unix7.org/​files/​upload
 +</​code>​
 +
 +  * Responce
 +
 +<​code>​
 +{
 +  "​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"​
 + }
 +</​code>​
 +
 +====Delete (Drop)====
 +
 +  * Request: GET 
 + 
 +<​code>​
 +curl -vk https://​lorem.unix7.org/​files/​drop/​10
 +</​code>​
 +
 +  * Responce
 +
 +<​code>​
 +{
 +  "​jsonrpc":​ "​2.0",​
 +  "​result":​ true,
 +  "​id":​ "​e05d8f67-34f3-4eb1-987d-a2fc8f33844b"​
 +}
 +</​code>​
 +
 +====List====
 +
 +  * Request: GET
 +
 +<​code>​
 +curl -kv https://​lorem.unix7.org/​files/​list
 +</​code>​
 +
 +  * Responce
 +
 +<​code>​
 +{
 +  "​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"​
 +}
 +
 +</​code>​
 +
 +----
 +[<>]