How to Use Geolocation in Your Mobile App

Posted: May 30th, 2017Author:



Geolocation is one of the most widely used APIs in mobile apps today. From weather to Uber and Lyft, the device location is crucial information and many APIs use it to determine what services and products are available in a given location. When building a mobile app in, using the Geolocation API is simple. Apache Cordova library is built-in in every new app. Invoking Geolocation will return the latitude, longitude (and other) information which can then be passed to any REST API. The following two short videos show how to use and invoke Geolocation in an Ionic and jQuery Mobile apps:

Looking for more videos like that? Check out our YouTube channel for many more videos.

Moving App Logic to the Server: How to Query the Database from a Server Code Script

Posted: May 24th, 2017Author:

The Database provides storage for your mobile app data. You can store data such as users, orders, purchases, products or anything else. The Database is a cloud NoSQL database and provides a very simple and elegant REST API to work with the database.

One of the most common cases for an enterprise mobile app is to create/save a new item/record and then redisplay the list in the app with the newly created item.

Accessing the database directly from the client is fine but requires two requests to the database.

  1. A request to save the new item/record into the database.
  2. Once the 1st request completes, on its success, a request to get the updated list to display in the app.

A better approach is to do both the create and list in a single request from the app. This is very simple to do from Server Code script. The following script shows how to create a new record and then get the updated list:

In this simple script you first create a new Person object (line 8) and then do another query to get the updated list of people (line 14). The script response returns the updated list of people. This script automatically has a REST API which is the invoked from the app.

What’s most important, there is only a single request from the app to the Server Code script. A single request is usually better than two requests. Also, you can add additional logic to the script without impacting the app. For example, you can send an email when a new person is added. Or, you can send  Push Notification when a new person is added. All this can be done without impacting the app. That’s nice.

If you want to learn more about Server Code, check out our YouTube channel Server Code playlist.

How to Expose a SOAP Service as a REST API

Posted: May 18th, 2017Author:

apiexpress-soap API Express make it fast and simple to connect to an enterprise data source and expose it via a REST API. With API Express you can quickly create an API for:

  • A relational database
  • A WSDL service (SOAP)
  • An existing REST API

In this tutorial, I’m going to show how to expose an existing WSDL service as a REST API and then build a mobile app using the API.

Read the rest of this entry »

Learn How to Send an SMS with Twilio in 5 Minutes

Posted: May 4th, 2017Author:

Twilio is a wonderful communication as a service platform that allows sending SMS messages from your app via a REST API. In this blog post you will learn how to send an SMS message from the Server Code in about 5 minutes.

  1. Sign into your account (you will also need to have a Twilio account).
  2. Go to the Server Code page.
  3. Server Code has a built-in Twilio SMS plug-in. You just need to add it to your account. Go to the Plugins tab. You will see a list of Server Code plugins:

    Server Code plug-ins

    Server Code plug-ins

  4. Locate the Twilio plugin (Quickly send SMS message with Twilio) and click import. A script called Twilio_SendSMS that sends the SMS will be inserted in the Script panels. A library called Twilio_Base64_library that helps with authentication will also be inserted in the Library panel.
  5. Open the Twilio_SendSMS script:

    You need to set the accountSid, the authToken and your Twilio phone number. You can find this information in the Twilio console.

    Twilio SMS

    Twilio SMS

  6. Once you set those values you are ready to test the script. Switch to Script parameters tab.
  7. Add two parameters:
    1. to (that’s the number where the message will be sent)
    2. body (that’s the message)
      These are request parameters into the script (and the API) and are read on lines 9-10.
  8. Switch to Test tab and click the Save and run button.
Testing Twilio SMS API

Testing Twilio SMS API

And this is how it looks on the phone:

SMS message

SMS message

Once you tested the Server Code script, it can be quickly added to your app. Here is a video that shows how to import services into an app. Every Server Code script is also an automatically a REST API. To see the endpoint for this script switch to API information tab. To learn more about Server Code, check our the Server Code YouTube playlist where you will find many short videos.

ViewFence App Helps Home Buyers Review and Rate Homes They Visit

Posted: April 27th, 2017Author:

ViewFence Screenshot

About the Company

The ViewFence app was born as an effort to provide unbiased third party opinions about homes, before buyers decide to spend thousands of dollars on the purchase. ViewFence provides a platform where home buyers and real estate agents can write personalized reviews and share objective opinions about the homes they visit.

The Problem

ViewFence recognized that it is important for home buyers to organize, track, evaluate and compare homes as part of the viewing process. Some of the flexibility the app needed to provide included:

  • Clean and consistent interface across multiple mobile devices and platforms
  • Real-time access to unbiased third party opinions and
  • Ability to take photos and share reviews with family and friends

The company was looking to support a rapidly evolving user experience based on feedback from initial beta users. They were looking for a platform that would enable them to innovate faster and incorporate user feedback.


ViewFence evaluated several mobile application development platforms (MADP). stood out for the following reasons:

Intuitive interface and accelerated learning: The online interface and the usage of standard JavaScript constructs enabled the team to quickly get comfortable with the platform. This also eliminated the need for any specialized mobile platform training for the developers.

Quick turnaround time between releases: The companion Tester app on iOS and Android platforms enabled the team to rapidly test features on various devices. The “write once deploy everywhere” development approach allowed the team to simultaneously and seamlessly release the app on multiple App stores and seek feedback from the beta users.

Exceptional support: A comprehensive knowledge base, an active online support forum and responsive support staff ensured timely resolutions to development issues.

ViewFence for Android

ViewFence for Android

ViewFence app was built using App Builder for jQuery Mobile, Database and Server Code.

Looking Ahead

With the help of, ViewFence has been able to launch the app and is looking to further enrich its offering by expanding features to include REST API integration with real estate content providers including MLS and

Install and use the app today at Apple Store and Google Play at the following links:

Apple Store: get the app

Google Play: get the app

Website: Newsletter (March 2017) – Platform Update, Stored Procedure as an API and Sending Faxes

Posted: April 14th, 2017Author:

The March newsletter.

April Platform Update

In early March, we rolled out a third platform update for 2017. This was a small update consisting of primarily infrastructure updates and bug fixing. Here is a short list of new benefits:

  • Upgrade to MongoDB version 3.2. This version improves stability and performance for the Database
  • The API Express SDK test page is now using the Ace Editor instead of a plain text area. This will help with better output formatting
  • The API Express service test page has been updated with larger output areas (JSON output). It’s now easier to view the service response
  • The scheduled job execution time limit for Server Code is now the same as the regular (non-scheduled) script execution time limit
  • The Plugins tab and its content has been moved inside the Apps tab. A plug-in is always created from an app so it makes sense to list the plug-ins inside the Apps tab

How to Send a Fax Using the Twilio Fax API

Twilio launched a new API that allows sending faxes. From the very start the platform made it very simple to connect to any external REST API. We love the Twilio API and their Fax API is just as elegant and simple to use. In this blog post you will learn how to send a fax using the Twilio Fax API from a Server Code script. It’s fun.

How to Expose a Database Stored Procedure and a Function as a REST API API Express makes it easy to expose a SQL query as a REST API. Just as easily you can expose a database stored procedure or a database function as a REST API. The following two blogs posts will teach you how to do that:

If you would rather watch a video on how to do this, here is an 8-minute video on how to expose a stored procedure and a function as a REST API.

Learn How Helped Deliver: HABITat, an AI-powered Personal Change App

As the market has filled up with trackers of daily habits, Enkr8ia was looking for a cost-effective and intelligent solution to go beyond the tedious stats. Demand for a clean interface and off-line support was prioritized as well as a virtual coach that would require some tricky API integration. Learn how Enkr8ia used the platform to build their app.

From Our Services Team: How We Try to Make Our Customers Happy

Read the blog post on how the services team works.

Plus, learn how the services team reduced Server Code script testing by 50%.

How to Send a Fax Using Twilio Fax API

Posted: April 6th, 2017Author:


Last week Twilio launched a new API that allows to send faxes. From the very start platform made it very simple to connect to any external REST API. We love Twilio API and have an example and video on how to use the SMS API. The Fax API is as elegant and simple to use. In this blog post you will learn how to send a fax using the Twilio Fax API from a Server Code script.

Create a new Server Code script and copy the following script:

The script is simple and does a POST request to the Twilio Fax API.

Line 1 is the Twilio Fax API endpoint.

Line 2 and 3 are Twilio Account SID and Auth Token. You can get both from the console dashboard.

Line 4 is where to send the fax (number).

Line 5 is your Twilio number.

Line 6 is a link to a document you want to fax. You can set it to any PDF file accessible via a direct link (or use the sample one provided by Twilio).

Line 8 is where the POST request is invoked with all the information.

Twilio Fax API uses Basic Authentication so the Account SID and Auth Token need to be encoded as Base64. There is an out-of-the-box plug-in that you can add to your account. The plug-in has a function to encode a string as Base64.

  1. Open the dropdown list (on the left) and select Back to list.
  2. Open the Plugins tab.
  3. Find the EncodeBase64 plugin and click insert to add it to your account. The plugin will be listed in the Library section. You can now use it in any other script.
  4. One more step is to add this library as a dependency for your script. Open that script you created. Go to Dependencies tab and click on EncodeBase64_Library.

You are ready to test the script.

Go back to the Script tab and open the Run tab (on the right). Click on Save and run button to invoke the API and send the fax.

The response should look like this:

You can navigate to the URL set in the url attribute – there you will be able to see the status of the sent fax (the browser will ask you to login, use the Account SID and Auth Token values).

It can take a few minutes for the fax to be delivered, keep that in mind when testing.

To learn more about Server Code check out our YouTube playlist. Happy faxing.


How to Expose a Database Stored Procedure as a REST API

Posted: April 3rd, 2017Author:

In an earlier blog post I showed you how to expose a relational database function as a REST API. In this blog post you are going to learn how to expose a database store procedure as a REST API.

If you have an existing stored procedure you can use it. If you don’t have a stored procedure, I will show you how to create two simple tables and then create a stored procedure.

The database used in this example is MySQL. The stored procedure will insert the same data into two different tables. The first step is to create two tables.

Here is SQL to create the first table:

And here is SQL to create the second table:

This is the SQL for the stored procedure. The stored procedure inserts the same information into both tables – performing two inserts.

It’s a simple but good example. You can make the stored procedure as complex as you need but the process of exposing it as a REST API is the same and is shown next.

To expose the stored procedure as a REST API, create a custom API Express service with one SQL component:



In the SQL component, call the message_and_backup stored procedure passing in the message input. That’s it.

Right away you can test the API Express service:



In this blog post you learned how to expose a stored procedure as a REST API. You can as easily expose a custom SQL query or a function as a REST API. To learn more about API Express please visit our YouTube channel.


How to Expose a Relational Database Function as a REST API

Posted: March 29th, 2017Author: API Express provides an easy way to expose a SQL query as a REST API. You can as easily expose a relational database function as a REST API. In this blog post you will learn how to do that.

A user-defined function is created with CREATE FUNCTION statement. We will use a simple function, one the increments the entered number by 1.

Here is an example for PostgreSQL database:

And this is an example for MySQL database:

To invoke the increment function use this SQL query:

To expose this function as a REST API, create the following API Express service:


Using the SQL component

It uses the SQL component and invokes the same SQL query.

Now you can easily test the API Express service. Entering 100 will return 101:


Testing the service


As you can see, invoking and exposing a custom SQL query as a REST API is simple. Now you also know how to expose a database function as a REST API.

To learn more about API Express and how to integrate with external resources (SQL database, REST API, web service), please go to our API Express YouTube playlist where we have many videos to help you build faster.

Cutting Server Code Script Testing by 50%

Posted: March 23rd, 2017Author:

Testing your mobile app is hard. You need to test the app UI (client) and app backend.

The Services team has built hundreds of apps for our clients and to help testing the app backed has come up with a powerful testing approach and tool.

In this blog post you will learn about this approach.

The services team has successfully developed and used a tool to streamline unit testing of hybrid mobile apps that are hooked up with Server Code scripts. Server Code allows to develop custom server-side business logic (using JavaScript) without the need to build or maintain server infrastructure.

It is common for a Server Code script to access and query the Database. This tool gives the benefits of testing such scripts without impacting the database. On top of that, supporting data driven testing by this tool empowers streamlining resources for regression checking. In addition, the time-consuming database “dropping and recreating” is a thing of the past.

The tool has a GUI and a set of shell scripts integrated with the platform via REST API services. GUI for testing Server Code scripts

GUI for testing Server Code scripts

The testing preparation is as easy as preparing valid input parameters and verifiable output results.

Once everything is configured, testing is started by clicking the Run button and can be completed as many times as necessary.

Since all the communication is done using JSON format, updating input parameters and reviewing outputs can be easily done with a built-in text editor.

Using this tool testing is done twice as fast.

Right now this tool is used by the Services team. If you would like to use it for testing with your app or learn more, please email us.