How to submit sync/copy job via http post in rclone RC mode?

Hello experts,

I m new to Rclone, trying to use rclone with apache nifi for sftp/cloud(s3/blob/gcp) to cloud files transfer.

Tried rclone RC mode with command line commands like below and it works fine -

rclone rc sync/copy srcFs=LocalSFTP:newdirectory dstFs=LocalSFTP:target10jan123 recursive=true --rc-addr 127.0.0.1:5572 _async=true
and able to see status with below end point with postman.
http://127.0.0.1:5572/job/status?jobid=31

Now i want to submit this sync/copy operation through http post (like status check above) instead of command line.
I could not find real example for this, can some one help me with http post example for this?

also wondering if i can point different .conf file than default one for this copy operation
(for non rc mode i can use --config option, similar option i m looking for RC with http api mode)

Hi Mahendra,

Here is a recent sync/sync example:
https://forum.rclone.org/t/rclone-rc-http-call-with-config-flag-fails/26001/6
you can probably find more by searching the forum.

Here is the documentaion on http post:
https://rclone.org/rc/#api-http

1 Like

In javascript, something like:
let rclone_options = { srcFs: "source_path", dstFs: "destination_path"};
let url = your_rclone_url + "/sync/copy";
axios.post(url, rclone_options)

2 Likes

@Ole - Thank you so much, forum link helped me out.
Able to submit the job over http post.
But still could not find way to point non default .config file while using RC mode (http mainly)

1 Like

Great, happy to hear!

I think it can be done with the _config option described here:
https://rclone.org/rc/#setting-config-flags-with-config

The example linked above used it to set the --dry-run parameter.

Not sure what the exact key is, but I guess you get find it with options/get described here:
https://rclone.org/rc/#options-get

@notclickable Can you confirm/supplement/correct me?

@Ole that's correct, check rclone rc options/get for the correct form for the config, then pass it into your POST as part of your json body , e.g "_config":{"CheckSum": true. "DryRun": true}. Generally they are CamelCase forms of the associated command line flags.

1 Like

Combined with the axios post above that would be:
let rclone_options = { srcFs: "source_path", dstFs: "destination_path", "_config":{"CheckSum": true. "DryRun": true}};

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.