Add new attachment

Only authorized users are allowed to upload new attachments.

This page (revision-16) was last changed on 25-Oct-2018 04:31 by Ben Spink

This page was created on 25-Oct-2018 04:31 by Ben Spink

Only authorized users are allowed to rename pages.

Only authorized users are allowed to delete pages.

Difference between version and

At line 1 changed one line
CrushFTP supports REST style operations for file transfer. All you need is an auth header with BASIC auth, or a logged in cookie token.\\
CrushFTP supports REST style operations for file transfer. All you need is an auth header with BASIC auth, or a logged in cookie token. If issuing a POST command, and using the CrushAuth cookie, you must also specify the c2f parameter. The c2f is the last 4 characters of the CrushAuth cookie.\\
\\
The base URL on all of these is simply http://domain.com/\\
At line 5 added one line
!!LOGIN\\
At line 13 added one line
!!DOWNLOAD/UPLOAD\\
At line 12 changed 2 lines
GET /myfiles/file1.txt
PUT /anotherfolder/file2.txt
GET /myfiles/file1.txt HTTP/1.1
Authorization: Basic QWxhZGRpbjpPcGVuU2VzYW1l
At line 15 changed one line
{{{
PUT /anotherfolder/file2.txt HTTP/1.1
Authorization: Basic QWxhZGRpbjpPcGVuU2VzYW1l
}}}
At line 25 added one line
!!RENAME\\
At line 20 changed one line
MOVE /myfiles/file1.txt
MOVE /myfiles/file1.txt HTTP/1.1
At line 30 added one line
Authorization: Basic QWxhZGRpbjpPcGVuU2VzYW1l
At line 28 removed one line
* As with all POST scenarios, the c2f is required if using a CrushAuth cookie token. The c2f is the last 4 characters of the CrushAuth cookie.\\
At line 39 added 14 lines
!!MAKEDIR\\
A make directory can be done via the MKCOL HTTP command, or via a POST with more parameters:\\
{{{
MKCOL /myfiles2/ HTTP/1.1
Authorization: Basic QWxhZGRpbjpPcGVuU2VzYW1l
}}}
Or POST:\\
{{{
command=makedir&path=/myfiles2/&c2f=ABCD
}}}
* This is the same command issued via our WebInterface, so you can always inspect with Chrome for other commands on how we do it.\\
\\
\\
!!DELETE\\
At line 33 changed one line
DELETE /myfiles/file1.txt
DELETE /myfiles/file1.txt HTTP/1.1
Authorization: Basic QWxhZGRpbjpPcGVuU2VzYW1l
At line 39 removed one line
* As with all POST scenarios, the c2f is required if using a CrushAuth cookie token. The c2f is the last 4 characters of the CrushAuth cookie.\\
At line 42 changed one line
Multipart from uploading is also possible, but far more complex of a topic. You should already be familiar with how multipart works. The parameters for uploading are:\\
!!LIST\\
Directory listings have no REST command, so POST must be used:\\
At line 67 added 23 lines
command=getXMLListing&path=/anotherfolder/&format=stat_dmz&c2f=ABCD
}}}
\\
*Format can be one of these types:json,jsonobj,stat,stat_dmz. stat_dmz is the most commonly used format type. It contains some summary info about the current directory's permissions followed by the listing for that directory.\\
\\
\\
!!STAT\\
Getting info about a single file can be done with HTTP HEAD, or more info from STAT:\\
{{{
HEAD /myfolder/file1.txt HTTP/1.1
Authorization: Basic QWxhZGRpbjpPcGVuU2VzYW1l
}}}
Or POST:\\
{{{
command=stat&path=/anotherfolder/file1.txt&format=stat_dmz&c2f=ABCD
}}}
\\
*Format can be one of these types:json,jsonobj,stat,stat_dmz. stat_dmz is the most commonly used format type. It contains some summary info about the current directory's permissions followed by the listing for that directory.\\
\\
\\
!!UPLOAD MultiPart\\
Multipart form uploading is also possible, but far more complex of a topic. You should already be familiar with how multipart works. The parameters for uploading are:\\
{{{
At line 53 changed one line
* As with all POST scenarios, the c2f is required if using a CrushAuth cookie token. The c2f is the last 4 characters of the CrushAuth cookie.\\
\\
!!LOGOUT\\
A logged in session with a CrushAuth cookie can be logged out so anything pending the logout will be triggered.\\
{{{
command=logout&c2f=ABCD
}}}
!!!EXAMPLES\\
\\
Upload a file:\\
{{{
curl -T KB2.txt -u user:pass http://127.0.0.1:8080/KB2.txt
}}}
Download:\\
{{{
curl -u user:pass http://127.0.0.1:8080/KB2.txt -o KB2.txt
}}}
Delete:\\
{{{
curl --data "command=delete&names=/KB2.txt" -u user:pass http://127.0.0.1:8080/
}}}
Rename:\\
{{{
curl --data "command=rename&path=/&name1=KB2.txt&name2=/KB3.txt" -u user:pass http://127.0.0.1:8080/
}}}
MakeDir:\\
{{{
curl --data "command=makedir&path=/myfiles2/" -u user:pass http://127.0.0.1:8080/
}}}
List:\\
{{{
curl --data "command=getXMLListing&path=/&format=jsonobj" -u user:pass http://127.0.0.1:8080/
}}}
Version Date Modified Size Author Changes ... Change note
16 25-Oct-2018 04:31 4.427 kB Ben Spink to previous
15 25-Oct-2018 04:31 4.313 kB Ben Spink to previous | to last
14 25-Oct-2018 04:31 4.208 kB Ben Spink to previous | to last
13 25-Oct-2018 04:31 4.106 kB Ben Spink to previous | to last
12 25-Oct-2018 04:31 4.023 kB Ben Spink to previous | to last
11 25-Oct-2018 04:31 3.9 kB Ben Spink to previous | to last
10 25-Oct-2018 04:31 3.793 kB Ben Spink to previous | to last
9 25-Oct-2018 04:31 3.728 kB Ben Spink to previous | to last
8 25-Oct-2018 04:31 3.755 kB Ben Spink to previous | to last
7 25-Oct-2018 04:31 3.436 kB Ben Spink to previous | to last
6 25-Oct-2018 04:31 2.959 kB Ben Spink to previous | to last
5 25-Oct-2018 04:31 2.914 kB Ben Spink to previous | to last
4 25-Oct-2018 04:31 2.209 kB Ben Spink to previous | to last
3 25-Oct-2018 04:31 2.213 kB Ben Spink to previous | to last
2 25-Oct-2018 04:31 1.387 kB Ben Spink to previous | to last
1 25-Oct-2018 04:31 1.058 kB Ben Spink to last
« This page (revision-16) was last changed on 25-Oct-2018 04:31 by Ben Spink
G’day (anonymous guest)
CrushFTP9 | What's New

Referenced by
API

JSPWiki