| Authentication and Authorization |
292
-i
Include the HTTP header in the output.
-X POST
Specify a POST request to the HTTP server, rather than the default
GET
request. (This option is not
required when
-d
is used, but is included here for completeness).
-u
node_username
:
node_user_password
Authenticate using the Node API username and password
that are associated with the transfer user who has been configured for token authorization.
-d
Send the specified data payload to the HTTP server. The payload can be entered in the command line, as it is
here, or stored in a file, as described below.
http(s)://...
The endpoint URL.
For example, the following request allows the user,
lion
, who is associated with the Node API username,
nodeuser
, and Node API password,
nodepassword
, to upload any files from the source to any location on the
destination,
serengeti.com
:
# curl -i -v -X POST -u nodeuser:nodepassword -d '{ "transfer_requests" :
[ { "transfer_request" : { "paths" : [{}], "destination_root" :
"/" } } ] }";' http://serengeti.com:9091/files/upload_setup
The response output is the following, from which you extract the token string
ATV7_HtfhDa-
JwWfc6RkTwhkDUqjHeLQePiOHjIS254_LJ14_7VTA
:
HTTP/1.1 200 OK
Cache: no-cache
Connection: close
Content-Type: application/x-javascript
{
"transfer_specs" : [{
"transfer_spec" : {
"paths" : [{}],
"source_root" : "",
"destination_root" : "/",
"token" : "ATV7_HtfhDa-JwWfc6RkTwhkDUqjHeLQePiOHjIS254_LJ14_7VTA",
"direction" : "send",
"target_rate_cap_kbps" : 100000,
"cipher" : "none",
"rate_policy_allowed" : "fair",
"rate_policy" : "fair",
"target_rate_kbps" : 45000,
"min_rate_kbps" : 0,
"remote_host" : "serengti.com",
"remote_user" : "lion",
"ssh_port" : 22,
"fasp_port" : 33001,
"http_fallback" : true,
"http_fallback_port" : 8080
}
}]
}
You can also specify the transfer request parameters in a file and refer to it in the curl command, which is particularly
useful for transfer requests that list many items for source content and destination. For example, the transfer request
file,
upload_setup.json
, could contain the following information for a file pair list:
{
"transfer_requests" : [
{
"transfer_request" : {
"destination_root" : "/",
"paths" : [
{
"destination" : "/archive/monday/texts/first_thing",
"source" : "/monday/first_thing.txt"