Help with Formatting HTTP Post Commands

What is the problem you are having with rclone?

I am new to RClone.
I currently have learned the direct command line usage, rclone -rcd and webrowser GUI and now I want to learn how to use the HTTP API POST requests.

I could use help understanding how to format commands for the HTTP API POST requests.
I am not ale to determine how I need to format the URL and parameters so RClone can identify the method I want to call.
And also how to know what variable names to use for parameters.

For example how might I translate the following directory listing request to a proper HTTP API POST request?
rclone rc core/command command=lsd -a TestGDrive:/_SubFolder1 -o max-depth=1

When I get error messages back saying it cannot identifty the "lsd" method.

However I did try an example with adding /copy/sync to the URL and that DID identify the method.
But I don't understand how to determine the formatting I need for each command.

I have been searching for documentation and guides on this but I haven't found anything yet. ( Maybe I am looking in the wrong places? )

Any suggestions or guidance would be appreciated.

Run the command 'rclone version' and share the full output of the command.

rclone v1.61.1

  • os/version: Microsoft Windows 10 Enterprise 21H2 (64 bit)
  • os/kernel: 10.0.19044.2604 (x86_64)
  • os/type: windows
  • os/arch: amd64
  • go/version: go1.19.4
  • go/linking: static
  • go/tags: cmount

Which cloud storage system are you using? (eg Google Drive)

Google Drive

Hi estegemoller,

This thread has some different examples that hopefully will get you started (just ignore the C# part):

Here is a search to find some of my other examples:

Just ask if the above examples are unclear or you need something else.

Happy POSTing :smile:

Hello Ole,

I was trying things with a basic PowerShell script:

This call works, I am able to get the list of remotes
$postParams = @{command='listremotes'}
Invoke-WebRequest -Uri -Method POST -Body $postParams -UseBasicParsing

This call DOES NOT work:
$postParams = @{command='ls'; arg='GDriveTest:'}
Invoke-WebRequest -Uri -Method POST -Body $postParams -UseBasicParsing

I can't seem to understand how it is wanting to denote the arguments list.

Hello estegemoller,

I also found it very difficult/confusing until I discovered the VS Code REST editor.

Here are the (slightly edited) Powershell commands generated by VS Code:

$headers.Add("user-agent", "vscode-restclient")
$headers.Add("content-type", "application/json")
$body='{"command": "ls", "arg": ["./testfolder", "--max-depth=1"]}'
Invoke-WebRequest -Uri '' -Method POST -Headers $headers -ContentType 'application/json' -Body $body

based on this request:

content-type: application/json

    "command": "ls",
    "arg": [ 

I replaced "GDriveTest:" by "./testfolder" and added "--max-depth=1" to better illustrate the arg list.

The above Powershell commands works fine for me, I think the important points are to add -ContentType and to send "arg" as a list.

Tip: Start rclone rcd with -vv and watch the output, it sometimes helps the troubleshooting.

Just wanted to so "Thank you!"
Using the help you provided I was able to get everything working and see how to build the API calls.
I also got VS Code with the REST Plugin setup and working ( a big help! )

You are welcome!

Glad you succeeded and like the VS Code REST plugin :slightly_smiling_face:

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