Skip to content

Commit e33d56a

Browse files
committed
Merge pull request #28 from joni2back/packaging-optimization
Packaging optimization
2 parents 010f8d6 + 95a201f commit e33d56a

20 files changed

+414
-284
lines changed

API.md

Lines changed: 205 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,205 @@
1+
## angular-filemanager API docs
2+
3+
#### Listing
4+
URL: fileManagerConfig.listUrl, Method: POST
5+
##### JSON Request content
6+
```json
7+
{ "params": {
8+
"mode": "list",
9+
"onlyFolders": false,
10+
"path": "/public_html"
11+
}}
12+
```
13+
##### JSON Response
14+
```json
15+
{ "result": [
16+
{
17+
"name": "joomla",
18+
"rights": "drwxr-xr-x",
19+
"size": "4096",
20+
"date": "2015-04-29 09:04:24",
21+
"type": "dir"
22+
}, {
23+
"name": "magento",
24+
"rights": "drwxr-xr-x",
25+
"size": "4096",
26+
"date": "17:42",
27+
"type": "dir"
28+
}, {
29+
"name": "index.php",
30+
"rights": "-rw-r--r--",
31+
"size": "549923",
32+
"date": "2013-11-01 11:44:13",
33+
"type": "file"
34+
}
35+
]}
36+
```
37+
--------------------
38+
#### Rename / Move
39+
URL: fileManagerConfig.renameUrl, Method: POST
40+
##### JSON Request content
41+
```json
42+
{ "params": {
43+
"mode": "rename",
44+
"path": "/public_html/index.php",
45+
"newPath": "/public_html/index2.php"
46+
}}
47+
```
48+
##### JSON Response
49+
```json
50+
{ "result": { "success": true, "error": null } }
51+
```
52+
--------------------
53+
#### Copy
54+
URL: fileManagerConfig.copyUrl, Method: POST
55+
##### JSON Request content
56+
```json
57+
{ "params": {
58+
"mode": "copy",
59+
"path": "/public_html/index.php",
60+
"newPath": "/public_html/index-copy.php"
61+
}}
62+
```
63+
##### JSON Response
64+
```json
65+
{ "result": { "success": true, "error": null } }
66+
```
67+
--------------------
68+
#### Remove
69+
URL: fileManagerConfig.removeUrl, Method: POST
70+
##### JSON Request content
71+
```json
72+
{ "params": {
73+
"mode": "delete",
74+
"path": "/public_html/index.php",
75+
}}
76+
```
77+
##### JSON Response
78+
```json
79+
{ "result": { "success": true, "error": null } }
80+
```
81+
--------------------
82+
#### Edit file
83+
URL: fileManagerConfig.editUrl, Method: POST
84+
##### JSON Request content
85+
```json
86+
{ "params": {
87+
"mode": "savefile",
88+
"content": "<?php echo random(); ?>",
89+
"path": "/public_html/index.php",
90+
}}
91+
```
92+
##### JSON Response
93+
```json
94+
{ "result": { "success": true, "error": null } }
95+
```
96+
--------------------
97+
#### Get content of a file
98+
URL: fileManagerConfig.getContentUrl, Method: POST
99+
##### JSON Request content
100+
```json
101+
{ "params": {
102+
"mode": "editfile",
103+
"path": "/public_html/index.php"
104+
}}
105+
```
106+
##### JSON Response
107+
```json
108+
{ "result": "<?php echo random(); ?>" }
109+
```
110+
--------------------
111+
#### Create folder
112+
URL: fileManagerConfig.createFolderUrl, Method: POST
113+
##### JSON Request content
114+
```json
115+
{ "params": {
116+
"mode": "addfolder",
117+
"name": "new-folder",
118+
"path": "/public_html"
119+
}}
120+
```
121+
##### JSON Response
122+
```json
123+
{ "result": { "success": true, "error": null } }
124+
```
125+
--------------------
126+
#### Set permissions
127+
URL: fileManagerConfig.permissionsUrl, Method: POST
128+
##### JSON Request content
129+
```json
130+
{ "params": {
131+
"mode": "changepermissions",
132+
"path": "/public_html/index.php",
133+
"perms": "653",
134+
"permsCode": "rw-r-x-wx",
135+
"recursive": false
136+
}}
137+
```
138+
##### JSON Response
139+
```json
140+
{ "result": { "success": true, "error": null } }
141+
```
142+
--------------------
143+
#### Compress file
144+
URL: fileManagerConfig.compressUrl, Method: POST
145+
##### JSON Request content
146+
```json
147+
{ "params": {
148+
"mode": "compress",
149+
"path": "/public_html/compressed.zip",
150+
"destination": "/public_html/backups"
151+
}}
152+
```
153+
##### JSON Response
154+
```json
155+
{ "result": { "success": true, "error": null } }
156+
```
157+
--------------------
158+
#### Extract file
159+
URL: fileManagerConfig.extractUrl, Method: POST
160+
##### JSON Request content
161+
```json
162+
{ "params": {
163+
"mode": "extract",
164+
"destination": "/public_html/extracted-files",
165+
"path": "/public_html/compressed.zip",
166+
"sourceFile": "/public_html/compressed.zip"
167+
}}
168+
```
169+
##### JSON Response
170+
```json
171+
{ "result": { "success": true, "error": null } }
172+
```
173+
--------------------
174+
#### Upload file
175+
URL: fileManagerConfig.uploadUrl, Method: POST, Content-Type: multipart/form-data
176+
Unlimited file upload, each item will be enumerated as file-1, file-2, etc.
177+
##### Http post params
178+
```
179+
[fileManagerConfig.uploadUrl]?destination=/public_html/image.jpg&file-1={..}&file-2={...}
180+
```
181+
##### JSON Response
182+
```json
183+
{ "result": { "success": true, "error": null } }
184+
```
185+
--------------------
186+
#### Download / Preview file
187+
URL: fileManagerConfig.downloadFileUrl, Method: GET
188+
##### Http query params
189+
```
190+
[fileManagerConfig.downloadFileUrl]?mode=download&preview=true&path=/public_html/image.jpg
191+
```
192+
##### Response
193+
```
194+
-File content
195+
```
196+
--------------------
197+
##### Errors / Exceptions
198+
Any backend error should be with an error 500 HTTP code.
199+
Btw, you can also report errors with a 200 response both using this json structure
200+
```json
201+
{ "result": {
202+
"success": false,
203+
"error": "Access denied to remove file"
204+
}}
205+
```

0 commit comments

Comments
 (0)