Jason Gilmore - January 10, 2024
Diagram showing how to create a SFTP REST API

Our team regularly holds detailed technical discussions with some of the largest companies in the world. From these many discussions it’s become quite apparent that lying somewhere beneath the fancy logo and glitzy commercials you’ll find IT departments relying on tried-and-true technologies and protocols to get the job done.

YouTube player

Why are SFTP APIs Important?

SFTP, or Secure File Transfer Protocol, is a popular solution for transferring files from one device to another. Its simplicity belies its popularity, with the vast majority of actions involving either sending (uploading) or receiving (downloading) files. Files are typically transferred between a FTP client such as FileZilla and an FTP server, although in many cases programmatic solutions involve transferring files from one server to another.

One particularly prominent workhorse is SFTP. The Secure File Transfer Protocol is a secure version of FTP, and it transfers data over SSH. Because developers often desire to build features capable of securely transferring files to some server, DreamFactory offers an SFTP connector capable of generating a full-featured REST API for transferring and retrieving files and directories.

An SFTP REST API removes the need for an FTP client or specialized file transfer library by providing developers with a series of endpoints used to upload and download files. With communication occurring over SSL, and all requests accompanied by a specially designated API key, developers can be assured files are being securely transferred away from the prying eyes of malicious third parties. DreamFactory makes this process easy through the no-code instant creation of an SFTP REST API to make all your file transfer requirements a breeze.

How to Create SFTP REST APIs

In this section, we’ll start by covering how to create your own SFTP REST API.

1. Install DreamFactory

The fastest way to create SFTP REST APIs is through DreamFactory. Once you install DreamFactory, you’ll be able to create secure, fully documented APIs for almost any datasource.

2. Navigate to the Services Tab

Then, in order to initiate the creation of a new service, you’ll have to navigate to the Services tab and head to the ‘create’ option.

On this page, you’ll find a service type dropdown and all the connectors that DreamFactory offers.

Select the SFTP connector which can be found under the ‘files’ tab. DreamFactory also supports other data sources from Azure, FTP, Snowflake, MySQL, or even SQL Server!

3. Give Your API a Name

Once you have selected SFTP, you’ll be prompted with the Service Overview window. The Label and Description tags are optional, but the Name is necessary to create the REST URL structure.

After filling in those fields, the only thing left is to make sure the ‘Active’ button remains checked.

4. Configuring the API

Next, you’ll need to enter the authentication credentials you use to connect to your SFTP source. The only 5 required fields are Host, Port, Username, Password, and Root Folder.

After filling those out, navigate to the ‘API Docs’ tab to view your newly configured service.

5. Testing the SFTP Service

Once you’ve navigated to the API Docs tab, find your. newly created SFTP service. You should find several new endpoints you can test on your SFTP server. These endpoints are live, so any changes will immediately impact your server.

If your Root folder already contains a few files, navigate down to the GET/folderpath endpoint. Once you click this, find the ‘Try out’ button. Set the folder you are looking for and click execute.

The following output should be all of the files or data from within those directories in the form of a REST API.

Just like that, we’ve created a fully documented and secure REST API for SFTP!

Building SFTP REST APIs with DreamFactory

Connecting your application to SFTP can be a time consuming process. Building the custom API, creating documentation, and securing the connection can lead to a long development cycle. DreamFactory is able to help manage your existing APIs and instantly generate custom REST APIs for SFTP while ensuring your data is secure at all times. You can even use your stored procedures via the API with no coding required!

Want to try it for yourself? Talk to our engineers here or start your own free trial!

Related reading:

Reusable REST API Platform Strategies

Create A Salesforce API

Create A MySQL API

Create A SQL Server API

Learn more about this feature in our newly published section of the Getting Started with DreamFactory guide.