Updated Filer Server API (markdown)

Chris Lu 2021-01-20 13:50:56 -08:00
parent 878f28ee73
commit f869610d66

@ -8,10 +8,15 @@ You can append to any HTTP API with &pretty=y to see a formatted json output.
# Basic Usage:
//create or overwrite the file, the directories /path/to will be automatically created
POST /path/to/file
PUT /path/to/file
//create or append the file
POST /path/to/file?op=append
PUT /path/to/file?op=append
//get the file content
GET /path/to/file
//create or overwrite the file, the filename in the multipart request will be used
POST /path/to/
PUT /path/to/
//return a json format subdirectory and files listing
GET /path/to/
Accept: application/json
@ -32,6 +37,7 @@ You can append to any HTTP API with &pretty=y to see a formatted json output.
| ttl | time to live, examples, 3m: 3 minutes, 4h: 4 hours, 5d: 5 days, 6w: 6 weeks, 7M: 7 months, 8y: 8 years | empty |
| maxMB | max chunk size | empty |
| mode | file mode | 0660 |
| op | file operation, currently only support "append" | empty |
| header: `Content-Type` | used for auto compression | empty |
| prefixed header: `Seaweed-` | example: `Seaweed-name1: value1`. Returned as `Seaweed-Name1: value1` in GET/HEAD response header. | empty |
@ -46,9 +52,15 @@ Examples:
{"name":"report.js","size":866,"fid":"7,0254f1f3fd","url":"http://localhost:8081/7,0254f1f3fd"}
> curl "http://localhost:8888/javascript/report.js" # get the file content
...
> curl -F file=@report.js "http://localhost:8888/javascript/new_name.js" # upload the file with a different name (The local report.js becomes new_name.js on the server side.)
> curl http://localhost:8888/test.yaml --upload-file test.yaml # upload file by PUT
{"name":"report.js","size":866,"fid":"3,034389657e","url":"http://localhost:8081/3,034389657e"}
> curl -F file=@report.js "http://localhost:8888/javascript/new_name.js" # upload the file to a different name
{"name":"report.js","size":5514}
> curl -T test.yaml http://localhost:8888/test.yaml # upload file by PUT
{"name":"test.yaml","size":866}
> curl -F file=@report.js "http://localhost:8888/javascript/new_name.js?op=append" # append to an file
{"name":"report.js","size":5514}
> curl -T test.yaml http://localhost:8888/test.yaml?op=append # append to an file by PUT
{"name":"test.yaml","size":866}
> curl -H "Accept: application/json" "http://localhost:8888/javascript/?pretty=y" # list all files under /javascript/
curl -H "Accept: application/json" "http://localhost:8888/javascript/?pretty=y"
{