API - List my files and folders

After authenticating with the OPSWAT Managed File Transfer API, you can interact with your files and folders. This section covers:

  • List root folder contents
  • List subfolder contents

Listing files and folders

We'll assume that you have some files and folders already upload from UI. If you don't do this step first so you'll be able to test your code. To list folder you need to to use /vault_rest/folder_content/{id}/{start}/{count} endpoint. You'll notice {id} that refers to folder_id, therefore first step is to get folder_idof your root folder.

In our next example we'll get our root folder ID using /vault_rest/root_folder endpoint. We assume you already successfully authenticate using instructions from our Hello World example.

Example of expected response:

JSON
Copy

We will find root folder ID in value of $response.folder_id of our response object. We'll use this value to in our next call to list folder.

Powershell
Copy

Now that we’ve successfully retrieved our root folder ID, we can use it to list all files and folders it contains. Each listed item will include its own ID, which can be used to further list contents or perform actions on those specific files and folders.

To list our root folder we'll use

  • {id} - folder ID, in this case root folder ID /vault_rest/folder_content/{id}/{start}/{count} endpoint.
  • {start} - integer number of starting file in list. 0 is for starting form fist file
  • {count} - number of files listed. We'll use 15 in this example.
Powershell
Copy

Now you can list any subfolder content by replacing root folder ID with one of folder IDs you just listed.

Type to search, ESC to discard
Type to search, ESC to discard
Type to search, ESC to discard