Learn How to Perform Basic Database Operations: Create, Read, Update, and Delete

The Appery.io Backend Services consists of the following components:

  • Database – for storing any app data.
  • Server Code – for writing server-side app logic using JavaScript.
  • API Express – integrating with external systems and APIs.
  • Push Notifications – sending push messages to devices.
  • Web Hosting – publishing and hosting mobile web apps.

In this post, we will show you how a Server Code script integrates with the Database.

One of the most common questions we get is how to work with the database, how to create, edit and delete data. This makes sense as virtually any mobile app needs to store data in a database and perform these basic operations. To access the database, we are going to use Server Code script. Server Code allows writing app logic using JavaScript which will be executed on the server. For example, a script can access the database, send a Push Notification message, sort data and invoke an external REST API. We will start with the most basic operation: how to read data from the database.

The database collection used in this post looks like this:

crud_collection
Database collection.

This can be data collected from a form inside an app – a form that collects information about the user.

Reading Data

Server Code script has out-of-the-box API to access the database to perform all the basic operations. The following script reads all objects from the above collection.

var dbApiKey = "fe7c124b-f7c5-4764-9274-173b56a97102";
var result = Collection.query(dbApiKey, "Data");
Apperyio.response.success(result, "application/json");

One line 2, the script retrieves all the data.

One line 3, the script response is set. A Server Code script is invoked as a REST API. The code on this line defines the API response.

A script can be quickly tested from the Run tab where you can see the JSON data:

 

crud_test
Script testing.

 

Reading data from a database collection is fast and simple. Next, we are going to save data into the database.

Continue reading “Learn How to Perform Basic Database Operations: Create, Read, Update, and Delete”

What is Appery.io Tester App?

The Appery.io Tester app is a core component in the Appery.io platform and makes it simple and fast to test your hybrid app without installing it on the device.

The app is available for iOS and Android.

When you are creating a hybrid mobile app you need to test the app on the actual device. Using simulators is usually slow. Installing the app directly on the device each time you make a small change is also very time consuming. To solve this problem, Appery.io provides a special Tester app. When you sign into the app, you will see all the apps that you have created in Appery.io. You tap any app and launch it directly on the device. For example, if your app uses a native device API such as the camera, then you can easily test the app and the native API.

Make any change to your app, simply tap the app again in the Tester and the updated app will be downloaded and launched.

One way to sign into the Tester app where you see all the apps you have created. Another option to share the app with anyone, even if they don’t have an Appery.io account is to create a special share code.

As a developer, you can create a special share code, send it to your customer and they will be able to run and test the app by just entering the code. They don’t need to have an Appery.io account, they only need to download the free Tester app for iOS or Android.

You can create any number of share codes and also set expiration date for the code. For example, you can create one code for your external testers and another code for your internal test team, with different expiration dates.

This video shows who to test the app using the Tester app.

Happy coding and testing.

Got Questions on Building Mobile Apps? Come to Appery.io Office Hours

office-hours1

Next week (Wed, Jun 24, 2015 11:00 AM – 11:30 AM PDT) we are going to hold our first Appery.io Office Hours where you will be able to ask any questions about Appery.io platform. Register to reserve your space now!

The 7 Pains of Developing Mobile Apps (and How to Solve Them)

Mobile apps are on a trajectory the likes of which have yet to be charted. Digi-Capital forecasts that by 2017, the mobile app market will reach $70 Billion of global revenue, with non-game apps to double revenue share from 26% to 51%. This will be made possible by 2017’s expected 200 billion app downloads. Currently, mobile apps account for 82% of the overall time spent on daily media consumption. Needless to say, enterprises are scurrying to develop mobile apps to secure their share of this rapidly growing ecosystem. Due to haste, misguidance, and industry fragmentation, there are a number of pains plaguing the mobile app development process. Solving these problems is critical to developing apps with the potential for scalable success. Continue reading “The 7 Pains of Developing Mobile Apps (and How to Solve Them)”

How To Build Farmers Market Search Hybrid Mobile App

This video shows how to build a Farmers Market search app based on a zip code. The app has two pages. The first page allows to search for farmers markets by entering a zip code. The second page shows details for a selected farmers market.

Resources used:

Creating Enterprise Mobile App with Orchestrate Database and Appery.io Dev. Platform [Video]

This is a recording of the webinar we did with our friends from Orchestrate. This video shows how to build a Contacts mobile app in Appery.io connected to Orchestrate database.

Here’s what’s covered:

  • An overview of Orchestrate features and dashboard
  • Inserting sample data into the Orchestrate database from the dashboard
  • Appery.io platform overview
  • Creating app UI using the visual drag and drop editor
  • Connecting to the Orchestrate database via REST APIs
  • Binding the REST API services to pages using the visual binding editor
  • Testing the app
  • Publishing as a mobile web and building a binary for Android
  • Q&A

Learn How to Build Mobile Apps with Mashery APIs and Appery.io in New Jersey

What

Amit Jotwani (Mashery), and I will be at CodeJunkies meetup (Livingston, NJ) to show you how to build to build mobile apps with Mashery APIs and the Appery.io cloud development platform. Amit will describe the Mashery API management platform. And Max will then build an HTML5/PhoneGap mobile app connected to Mashery-managed APIs, and show the available API plugins. We will then build/deploy the app. This is a live coding session where attendees will be able to test the app as it’s being built.

When

Thursday, August 28, 2014
6:45pm

Want to go

Join and RSVP

Rapid Mobile App to API Integration

This article originally posted on SOA Software blog by Ryan Bagnulo

Register to attend the web lecture on this topic at 1 PM ET on August 26, 2014.

Wireframes for user interface design are still a good idea when communicating requirements to others, however lately I would rather create them as a HTML5 prototype that is usable across heterogeneous devices with various screen sizes and resolutions. One such tool that I prefer is from Appery.io, which is a browser based jQuery and PhoneGap powered mobile application development studio. Appery.io offers a faster path to publish an application in an App Store because once the HTML5 prototyping, user acceptance testing and usability work is complete, it can also generate the Android apk and IOS binaries without the need to port to Objective C manually. This feature alone is a major time saver, and so is the drag and drop JSON API response test message to UI component designer that creates a wireframe that will also generate the runtime code.

Let’s say you have your APIs ready to consume and you know what data elements need to be displayed to the user. Perhaps some of the APIs are SOAP/XML and others are REST/JSON and they are secured with different authentication protocols.

To simplify the user interface design process, let’s agree to transform the SOAP services to REST APIs using an API Gateway to also transform the XML to/from JSON. Then configure the API gateway to mediate the authentication on the client app side from OpenID & OAuth to the various different security protocols required for the downstream APIs being consumed. This avoids the need to require different credentials for each API in the client application code, and improves the security of the system by limiting the connections to the APIs to only the API gateways, greatly reducing the attack vector and lowering the risk of system outages and malformed requests that reach the application/data tier.

Now that security and API transformation is in place, we are ready to begin mobile application client development. First the developer will request an application ID and secret from the API developer portal that is linked to the API gateway cluster’s policy decision point. The app id will be used in an Authorization header by the client app in order to begin the OAuth process to authenticate the user and receive a token, thus avoiding the need to send user credentials with each API call and simplifying the authorization process to restrict which API operations can be used based on the “scope” of the token. The user will only be prompted to authenticate when the token has expired and there is no valid refresh token.

When creating the HTML5 client application using Appery.io the process is to first configure a GET API request for an authorization code from the OAuth server then to submit a POST request for the access and refresh tokens. These values will be parsed and stored into variables that can later be accessed using JavaScript to insert the tokens into the Authorization header for each subsequent API call that the application will make.

Next add the APIs that will be used by the application to retrieve the data requested by the user of the mobile app and save the response of each test call. After placing the fields on the canvas that will display the data returned, the data tab of the UI designer is used to visually wire (drag and link) the field in the JSON response payload to the field on the user interface that will display that string of text. Once all of the input and output fields are mapped, test the app to view the HTML5 version in your browser using the QR code that links to the app sandbox URL. In under an hour you’ve now got alpha wireframes and a secured prototype that is ready to share.

Experiment with portrait vs landscape given that not all users share the same perspective and adjust for inconsistencies across device type. Begin the UAT process and iterate iterate iterate.

Appery.io and SOA Software are partnering because SOA makes it easy to configure the API security properly and the SOA policy manager and API gateway make it easy to debug the API requests, and the Community Manager API portal is a turnkey solution that will generate client application IDs that are linked to SLA Quality of Service policies with reports to track how the mobile apps are consuming the various APIs.

Register for Appery.io/SOA Software joint webinar 

Accelerating Digital Transformation with Integrated APIs and Rapid Mobile Development

Tuesday, August 26th, 2014 – 10 AM Pacific Time/1PM Eastern

Register now

Webinar: Learn How To Debug Mobile Apps Created in Appery.io

What
Debugging Best Practices with Appery.io

When
Wednesday, June 25, 11am Pacific Time

What you will learn
Learn How To Debug Mobile Apps Created in Appery.io

Register
Register for this webinar

Bootstrap Week 4/23: Build a Complete Mobile App with AT&T APIs in Appery.io

What:
AT&T Bootstrap Week Online Tutorial

When:
Wednesday, April 23, 11–12 PM Pacific Time

Session:
Appery.io is the only cloud-based platform with visual development tools and integrated backend services. In this live coding session you will learn how to build a complete mobile app with Appery.io We will create the app UI, add a cloud database, push notifications, and use AT&T APIs. We will then build the app binary with PhoneGap.

What you will learn:

  • How to build a jQuery Mobile/PhoneGap mobile app in Appery.io cloud platform
  • How to integrate with AT&T APIs
  • How to integrated with Appery.io mobile backend (mBaaS)
  • How to test, build and deploy the mobile app

Register:
Register for this online tutorial