How we handle your logos using S3 FileManager

Since the beginning, we added the capability to upload a logo to visually identify you and your API. In order to support this feature, we designed an interface defining basic operations on the uploaded images: load, save, move and delete.

The new S3 FileManager replaces Live server on laptop

Thankfully, our FileManager is no longer running like this
Image credit: https://flic.kr/p/4EsmJw

The first implementation was simple and fast to deliver: an abstraction of the local filesystem. This was fine during the development phase, on our laptops. However, it was not possible to scale with this solution as every server would have his own copy of the files locally.

Hence, I developed a new implementation, S3FileManager (based on the S3 library provided by http://www.jets3t.org), to store data directly on the awesome Amazon service that we are already using for our static web part (css/ images/ javascripts). We did not change a single line of code on our website, except for a configuration file (filemanager.properties). This is our design (which can be improved):

Singleton design pattern on FileManagerFactory, with a single static instance that creates an instance of FileManager based on the class name found in a text file (a Properties configuration file).

In this way, when we create different Tomcat instances, each of them will have a static FileManagerFactory to access the same storage.

While this simple library fits our needs for the project, it may not be the best fit in every case. In case you find it useful, check out the github repo here: https://github.com/Mashape/file-manager

One area of improvement would be using a dependency injection pattern instead of a singleton, or perhaps to avoid the fallback to the default filename  ”filemanager.properties” when a getInstance() is called.

If you like this, remember, to fork it!

CONSUME API NOW

About

Mashape is the largest API hub in the world where you can consume, distribute, monitor and monetize your public and private APIs. Mashape powers 10,000 public & private APIs in every major industry, including finance, healthcare, and entertainment. We’re a Series A startup backed by Jeff Bezos (Amazon), Eric Schmidt (Google), Stanford University and top tier VC firms including Index Ventures, NEA and CRV.

Introducing API Glossary by Mashape

  When it comes to APIs, there’s a lot of jargon out there. The meaning of certain terms isn’t always obvious, and API providers sometimes use different ones to

Using Unirest (Java) for your Android projects

This post will show you how to get Unirest-java running on your Android projects.  Unirest is a lightweight HTTP client library with port available in many languages. This is a

Installing unirest-java with the Maven Assembly Plugin

Managing dependencies for your Java applications is difficult, unless you have Maven!  Maven is an Apache build manager for Java projects.  In this post, we will use a Maven

30+ ways to make REST calls in Node.js, PHP, Python, Rails, Obj-C, .NET, and Java / Android

Here’s a list of resources on how to make REST calls in different languages.  (We also have this list of 40+ tutorials on how to create an API in