Creating a Mobile-Optimized REST API Using Mobile Cloud Service – Part 4 by Steven Davelaar

Posted: September 24, 2016 in Uncategorized
Tags: , , , , , , ,

image

Introduction

To build functional and performant mobile apps, the back-end data services need to be optimized for mobile consumption. RESTful web services using JSON as payload format are widely considered as the best architectural choice for integration between mobile apps and back-end systems. At the same time, many existing enterprise back-end systems provide a SOAP-based web service application programming interface (API). In this article series we will discuss how Oracle Mobile Cloud Service (MCS) can be used to transform these enterprise system interfaces into a mobile-optimized REST-JSON API. This architecture layer is sometimes referred to as Mobile Backend as a Service (MBaaS). A-Team has been working on a number of projects using MCS to build this architecture layer. We will explain step-by-step how to build an MBaaS, and we will  share tips, lessons learned and best practices we discovered along the way. No prior knowledge of MCS is assumed. In part 1 we discussed the design of the REST API, in part 2 we covered the implementation of the “read” (GET) resources, in part 3 we discussed implementation of the “write” resources (POST,PUT and DELETE). In this fourth part, we will look at how we can use MCS Storage collections to cache payloads, and while doing so, we will use some more advanced concepts like chaining promises to execute multiple REST calls in sequence.

Main Article

In this article we will implement the GET /jobs endpoint which returns a list of jobs. This list is static, and as such can be cached within MCS to reduce the number of backend calls and speed up overall performance. Obviously, app developers can also choose to cache this list on the mobile device to further enhance performance, but that is beyond the scope of this article. We will use the MCS Storage API to store and retrieve the cached list of jobs. We will use a boolean query parameter refreshCache to force an update of the jobs list in storage.

Setting up the Storage Collection

To store files in MCS, a so-called storage collection must be created. Access to a storage collection is handled through roles. When creating a new storage collection, you assign roles that have read and/or write privileges. Users with the appropriate role(s) can then store files in the collection and/or retrieve them. So, we first create a role named HRManager, by clicking on the Mobile User Management menu option, select the Roles tab, and then click on New Role.

After creating the role, we select the Storage menu option and click on New Collection to create the collection. Read the complete article here.

WebLogic Partner Community

For regular information become a member in the WebLogic Partner Community please visit: http://www.oracle.com/partners/goto/wls-emea ( OPN account required). If you need support with your account please contact the Oracle Partner Business Center.

Blog Twitter LinkedIn Forum Wiki

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s