Alex Bowen - August 11, 2016

In recent posts about DreamFactory power user Crystal Taggart, we highlighted the ways she uses our open source platform to quickly build effective app architecture and add features on the fly. By using the power of Appery.io and Dreamfactory together she gets a useful visual interface for building apps in days instead of months.

Appery.io and DreamFactory test harness workflow

“One of my favorite things about DreamFactory is that it provides a test harness and documentation to connect your data. Not only does DreamFactory give you APIs, but also a fantastic test harness. So I can build things in Appery.io and test it in DreamFactory. I will never need to code a REST service ever again.”

Crystal chose to install DreamFactory on Google Cloud. DreamFactory then automatically generated API documentation for her API. In the Admin Console, API Docs is a top-level tab. Let’s take a dive into her process so you can set it up for yourself.

DFUserView.png

User APIs automatically generated in the Live API Docs.

Let’s start with how it looks in Appery.io. To create a service, add a new service within the Appery.io panel. The URL for the service maps to the DreamFactory API Endpoint. In this example this is a POST transaction to register a new user account.

ServiceSetup-1.png

Set up Headers for the DreamFactory service under the Request tab, under Headers.

The X-DreamFactory-Application-Name enables you to specify which DreamFactory API you are connecting to and the services available to it. The X-DreamFactory-Api-Key allows you to connect to that service in your app. In Appery.io you can specify Settings which allow you to store your URLs and credentials in a central location. In the screen below Crystal has the {app_name} and {api_key} stored as settings. This made it easy to change her URL endpoints from an IP address as she was testing to an SSL url so she can protect her user information.

ApperySetupHeaders.png

DreamFactory Service set up in Appery.io.

In the Body of these new Headers, set up the REST API parameters for the app. To add new parameters for your service, just click the Add button and it’s that easy to enhance your REST API.

Appery_SettingParameters.png

Parameters for a REST API.

With the power of DreamFactory and Appery.io, their are two ways to test REST API endpoints: either in the DreamFactory instance or in the Appery.io service. By testing in the Appery.io service, you can import the response JSON making it easy to map your service through the Appery.io GUI.

Appery_DreamFactoryServiceTesting.png

In Appery.io, you can test your DreamFactory Service.

Appery.io makes it very easy to map your DreamFactory service. You can setup custom API calls based on different events – either a page load, button click, or any HTML-driven event. For events, you can use the Appery.io mapping tools to send data from your screen into a service and process the results. In the screenshot below, the left side of the screen shows the fields and local variables from the form, the right side of the screen shows the mappings to the DreamFactory services. If you can drag and drop, you can create a REST endpoint with no coding!

Appery_DreamFactoryMapping.png

This is the service mapping for the Create Account. DreamFactory’s User API also automatically detects if the email account is in use for the user and sends back an error response.

userError.png

Example Error Message from DreamFactory User API

The Appery.io Service automatically catches the error event and allows for custom scripting to handle the error.

handleError.png

Crystal opted for a javascript library that maps the error message returned from the jqXHR service back to a ‘user friendly’ error message. Tools such as Appery.io don’t limit you to GUI only integrations. When it’s time to add custom code, they can be powerful platforms to iterate fast.

As with any frontend platform, having a versatile and well constructed backend is critical for the flow of development. DreamFactory empowered Crystal to focus on building her app, instead of getting bogged down in technical debt and infrastructure issues.