How to use FTP Server using Rest API

Adarsh Sharma
3 min readMay 5, 2020

--

In this tutorial, we will see how we can directly communicate with FTP server using REST API.

It solve’s problem like using FTP server from salesforce or other platforms using http callouts.

Introduction

FTP API is designed for people who need to perform actions like DOWNLOAD, UPLOAD, DELETE and TRANSFER on the FTP server using REST API’s.

In these API’s lets you control nearly all aspects of your FTP server operations programatically. These API’s are based on GET, POST and DELETE operations.

How to Use FTP API’s

UPLOAD: This API allow us to upload files on FTP Server. User can upload single or multiple files in a single API call.

File object contains three parameters : path , filename and body. Body should be provided in Base64 encoding.

HTTP Request

POST https://www.ftp-api.com/ftp/upload

DELETE : This API allow to delete files on FTP server. Specify the files to be deleted, by passing file-name and it’s path on FTP server.

HTTP Request

DELETE https://www.ftp-api.com/ftp/delete

DOWNLOAD: This API allow to download files from the FTP server. This is a GET API. This operation can be performed in two ways, depending on the number of files you needed.

First, the user can get all the files from the FTP server.

Second, the user can specify the files which are needed, so the API will return only the specified files. This API is further enhanced based on single or multiple files.

HTTP Request

GET https://www.ftp-api.com/ftp/download

TRANSFER: This API allows user to transfer multiple files from one FTP server to another FTP server without downloading files.

HTTP Request

POST https://www.ftp-api.com/ftp/transfer

Note: This API requires both source and destination FTP server authentication.

In addition to the GitHub sample code snippets, the full repository can be found here.

And if you enjoyed this post, share it.

Related Post

How to use SFTP Server using Rest API

--

--