How to call it in a third-party language, for example, in java, C sharp #7112

I want to use rclone in my own java or C sharp application, but not through the command line, how to achieve it

Hi, welcome to the forum.

You should check out librclone. The documentation is in GitHub only, here: https://github.com/rclone/rclone/tree/master/librclone.

There are no specific details for C# or Java, unfortunately. I have previously been trying it out in C# myself, and I've been meaning to make it into something worth adding to the official docs or making my example and notes public somewhere else, but did not get to that point last time I worked with it. Anyway, I may be able to help you get started with the technical details should you need it.

Other approach is to use rclone rcd

Some example in this thread:

Hi shyding,

Here is a thread with an example using C# to call the REST API exposed by rclone rcd:
https://forum.rclone.org/t/c-code-for-rclone-copy/33990/2

A similar approach can be used from Java.

PS: I suggest getting some hands-on experience with rclone rc/rcd before moving on to librclone having a similar interface.

1 Like

As others have said, there is librclone you could use.

For my uses, I decided it was better to make users have rclone installed and then use the API. Or do everything via command line calls that you construct.

I do not claim it is perfect, but you can take a look at my python code. I actually started out with doing everything via CLI but realized that I would greatly benefit from sessions and internal state so I moved to the HTTP API. Confusingly, my rcloneapi.py is the CLI and rclone.py is my RC interface.

I had to play with the many ways to interface between JSON, http queries, etc. I settled on queries at it let me also post data to mimick rcat. I still prefer the CLI for file listings since filters are easier

  • rcloneapi.py (link) - Again, confusingly, this is the CLI
  • rclone.py (link) - Uses the HTTP interface

CLI is not interesting.
Thx a bunch for a HTTP link

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