we need add http header "Accept:application/json" to get json format file list or we will get a html page

xh_78 2017-11-21 09:48:58 +08:00
parent 175555c83f
commit 46db3b6b40

@ -14,6 +14,7 @@ You can append to any HTTP API with &pretty=y to see a formatted json output.
POST /path/to/ POST /path/to/
//return a json format subdirectory and files listing //return a json format subdirectory and files listing
GET /path/to/ GET /path/to/
Accept: application/json
``` ```
Examples: Examples:
```bash ```bash
@ -24,7 +25,7 @@ Examples:
... ...
> curl -F file=@report.js "http://localhost:8888/javascript/new_name.js" # upload the file with a different name > curl -F file=@report.js "http://localhost:8888/javascript/new_name.js" # upload the file with a different name
{"name":"report.js","size":866,"fid":"3,034389657e","url":"http://localhost:8081/3,034389657e"} {"name":"report.js","size":866,"fid":"3,034389657e","url":"http://localhost:8081/3,034389657e"}
> curl "http://localhost:8888/javascript/?pretty=y" # list all files under /javascript/ > curl -H "Accept: application/json" "http://localhost:8888/javascript/?pretty=y" # list all files under /javascript/
{ {
"Directory": "/javascript/", "Directory": "/javascript/",
"Files": [ "Files": [