Instant APIs for your ESB: MuleSoft & DreamFactory

People reviewing notes about MuleSoft and DreamFactory APIs

Did you know the DreamFactory API management platform can enhance your MuleSoft ROI by up to 30%? This article highlights how DreamFactory can serve up instant APIs to your Mulesoft instance, accelerating development and increasing efficiency of your Mulesoft platform. In particular, we'll discuss the following topics:

  1. What is MuleSoft?
  2. Automatic API Generation
  3. Accessing Stored Procedures Through a REST API
  4. How DreamFactory Enables Mulesoft

Did you know you can generate a full-featured, documented, and secure REST API in minutes using DreamFactory? Sign up for our free 14 day hosted trial to learn how! Our guided tour will show you how to create an API using an example MySQL database provided to you as part of the trial!

Create Your RESTful API Now

What is MuleSoft?

MuleSoft diagram

MuleSoft is regarded as “the most widely used integration platform for connecting SaaS & enterprise applications in the cloud and on-premise.” The company’s flagship product is the Anypoint platform, an iPaaS (integration platform as a service) solution that makes it easier to connect your enterprise data, software, and systems.

MuleSoft offers an enterprise service bus (ESB), a useful tool for weaving together multiple data formats and communication protocols (such as SMTP, IIOP, and MQ/JMS). However, there are a great many use cases which might otherwise be resolved using a REST API. You can create a REST API using Mulesoft’s Anypoint Platform, which is the primary mechanism for API creation, found in the API Design sub system. Within API Design there are several steps to building an API:

  1. Create Specification
    • Add title, version, protocols and a description
    • Create a data type to be referenced in the API’s RAML file
    • Add properties to the data type
    • Create a new resource (e.g. an API endpoint)
    • Add endpoint access rules
    • Define responses and media types.

  2. Test the API- via Postman or the internal Mocking service.
  3. Publish the API to Exchange, the Mulesoft marketplace for connectors and APIs.
  4. Import your API from Exchange into Anypoint Studio.

From here you are required to create a new project in Anypoint Studio, find your newly created API in Exchange, import the API, generate documentation and then configure the connection with the database you are trying to access. Next the API will need to be published to CloudHub and managed via API Manager if you want to apply rate limits. As is probably apparent, this is a pretty involved process involving quite a few moving parts and does not enable the creation of instant APIs for MuleSoft deployments.

There is however an easier way to generate these REST APIs, and in fact many Mulesoft users run this solution alongside their environment as a Mulesoft-enabler. This solution is called DreamFactory, and it’s used by thousands of companies around the globe. In particular, DreamFactory offers great functionality for developing instant APIs for MuleSoft.

Automatic API Generation

DreamFactory is an API management platform for mobile, web, and IoT applications. Available both in the cloud and on-premise, DreamFactory can instantly generate standardized, secure and fully documented REST APIs, without users having to write a single line of code. 

DreamFactory allows you to generate, mount and manage any number of APIs all through a single low code platform. Native security controls ensure APIs cannot be deployed without accompanying authorization controls, and of particular interest to enterprise users, DreamFactory offers native integrations with all common authentication tools. Within a single interface you can create, secure and publish an API within minutes.

In order to create a database API (using MySQL as an example) with DreamFactory a user will need to:

  1. Create a name, label and description (for identification purposes later)
  2. Input database credentials including:
    • Host
    • Port Number
    • Database Name
    • Username 
    • Password

  3. Click Create

At this point in time, DreamFactory has just automatically generated all database endpoints including stored procedures in Open API specifications (live example below). Your API is now ready to be secured via role based access control prior to publishing, all under the one platform view.

DreamFactory API generation diagram

In addition to the expected CRUD (Create-Retrieve-Update-Delete) endpoints, DreamFactory will also generate endpoints for interacting with the schema and executing stored procedures. This latter capability is often of great interest to larger enterprises and is central to the creation of instant APIs for MuleSoft deployments.

Accessing Stored Procedures Through a REST API

Stored procedures are groups of SQL code that can be repeatedly used by several clients using different input data but without having direct access to the database tables. This has obvious benefits when you can grant execute rights without giving write permission to underlying tables thus increasing security against SQL injection and maintaining data integrity over large user groups.

One global consulting firm employs both Mulesoft and DreamFactory within their environment. Asked why the team preferred this approach, the team lead stated:

“For tools that don't offer an API and where the database is the main point of integration, use DreamFactory. We are also a Mulesoft customer, but the overhead of exposing a stored procedure or table in that system is too much. If not doing a large ETL we're not going to bother with Mulesoft We will build the API in DreamFactory and then expose that API to Mulesoft.”

Developer Team Lead

 This feature gives development teams the best of both worlds: the ability to encapsulate complicated query logic within a stored procedure while having the flexibility to call that stored procedure over a secure REST API.

Did you know you can generate a full-featured, documented, and secure REST API in minutes using DreamFactory? Sign up for our free 14 day hosted trial to learn how! Our guided tour will show you how to create an API using an example MySQL database provided to you as part of the trial!

Create Your RESTful API Now

How DreamFactory Enables Mulesoft

The DreamFactory platform does not offer many of the advanced functions you would expect of an ESB such as Mulesoft however it does a tremendous job of quickly generating secure REST APIs which can then be bolted onto Mulesoft. This dual threat offering allows large enterprise teams to take advantage of Mulesoft’s advanced capabilities while dramatically decreasing time to market thanks to DreamFactory’s streamlined API generator. Importantly, DreamFactory offers a seamless and efficient method of generating instant APIs for MuleSoft deployments of any scale.