Offloading Mobile Storage

Share and secure files with the Oracle Mobile Cloud Service Storage API.

By Chris Muir

January/February 2016

Seasoned developers know that even trivial requirements can cause major headaches, especially when new platforms such as mobile are being introduced into an established enterprise landscape. Take the small but common requirement in a mobile app of sharing pictures or files between mobile users. With on-premises enterprise solutions, architects might suggest provisioning a centralized file server to share the content, building REST APIs, and much more. The Oracle Mobile Cloud Service out-of-the-box Storage API simplifies the solution for this requirement. The Storage API enables mobile developers to store text and binary files in the cloud without having to build out and maintain substantial on-premises infrastructure.

This article focuses on creating and configuring two different types of Storage API collections by using the Oracle Mobile Cloud Service portal: a shared collection that enables all mobile users of an app to share objects and an isolated collection where users can place objects that should not be seen by other mobile users of an application. For brevity’s sake, this article does not cover how to access collections from a specific mobile platform (Android, iOS, JavaScript, Oracle Mobile Application Framework, Windows) but, rather, describes how to create and test the APIs by using the Oracle Mobile Cloud Service portal’s test pages.

Getting Ready

To follow the steps in this article, you first must obtain an Oracle Mobile Cloud Service trial account. Click Try It, and then follow the prompts to create your trial account. You’ll receive a confirmation email with details about how to access your Oracle Cloud account and activate your Oracle Mobile Cloud Service instance. Follow the linked documentation to complete your sign-up and activate and access Oracle Mobile Cloud Service.

Create a Test Role and Two Test Users

Given this article’s goal of exploring storage that enables mobile users to share some content and to protect other content in their own collections, it’s necessary to set up a test role and two mobile users to demonstrate these respective functions. The instructions start from the Oracle Mobile Cloud Service portal.

  1. At the top left of the page, click the “hamburger” icon (the icon with three horizontal stripes) and then Applications -> User Management.
  2. From the middle menu, select Roles.
  3. Click New Role.
  4. In the New Role dialog box, enter OraMagTestRole for Role Name and then click Create.
  5. From the middle menu, select Users.
  6. Click New User.
  7. In the Create User dialog box, enter
    Username: joedoe
    Email: an email address you own
    First Name: Joe
    Last Name: Doe
    Roles: OraMagTestRole
  8. Click Create. At this point, a verification email for mobile user joedoe is sent to the email address you specified.
  9. Follow the instructions embedded in the email to change the password for new mobile user joedoe.
  10. Create another new user (as in step 7), but with these details: Username: janeroe
    Email: an email address you own but different from the one used previously
    First Name: Jane
    Last Name: Roe
    Roles: OraMagTestRole
  11. Be sure to use an email address that’s different from the one you used for joedoe.
  12. Follow the steps in the verification email to set user janeroe’s password.

    Figure 1. Creating a user and assigning a role

With the test role and users ready, you can now create the other Oracle Mobile Cloud Service design-time artifacts to test the storage.

Create a Mobile Back End

For each mobile application you want to provide with storage capability through Oracle Mobile Cloud Service, you must define a mobile back end to expose the storage to the mobile app. The mobile back end acts as the gatekeeper to which services each application and its mobile users can access.

  1. At the top left of the page, click the hamburger icon and then Applications -> Mobile Backends.
  2. Click New Mobile Backend.
  3. In the New Mobile Backend dialog box, enter OraMagTestBackend for Name.
  4. Click Create.
Create Two Collections

With the mobile back end created, you can now set up the two different types of storage collections. First you’ll create the collection for storing files shared among all mobile users of an app, and then you’ll set up an isolated collection to protect and isolate files in a personal collection for each user of the mobile app.

  1. With the Mobile Backend page open, select the Storage option to the left.
  2. Click New Collection.
  3. In the New Collection dialog box, enter the following: Collection Name: OraMagSharedCollection
    Collection Type: Shared
  4. Click Create.
  5. Click New Collection.
  6. On the Properties page, set the Read-Write permission to OraMagTestRole.
  7. Click Save.
  8. In the breadcrumb trail at the top of the page, click OraMagTestBackend.
  9. Create a second collection (repeat steps 20 through 23), but this time enter these details: Collection Name: OraMagIsolatedCollection
    Collection Type: User Isolated
    Read-Write: OraMagTestRole
  10. Return to the Mobile Backend page, and reopen the Storage page.
  11. Click the Storage API link (near the top of the page) to get ready for the next section. (Also, in the top left area, click the left arrow to minimize the floating menu back into its hamburger icon for greater page visibility.)

    Figure 2. Creating a collection

At this point, you’ve set up all the design-time artifacts needed to demonstrate the storage collection’s capabilities, so you can next explore the storage API’s runtime behavior and its supported REST APIs.

Understanding the Storage REST APIs

The Oracle Mobile Cloud Service Storage API is built around a set of REST endpoints based on the collections you’ve already defined and their objects. Externally, your mobile applications and their predefined mobile users interact with the collections and objects through the REST endpoints, using the usual set of HTTP verbs: GET, PUT, POST, DELETE, and so on.

The Oracle Mobile Cloud Service user interface provides a built-in test facility that mobile developers can use to examine and test the REST endpoints and their functionality without building a complete mobile application. First watch this video to learn how you can explore the collections.

Now take a look at a second video that demonstrates working with objects in the collections. You’ll see how objects can be shared among mobile users via the OraMagSharedCollection and how objects stored in the OraMagIsolatedCollection are accessible only by the owning user.

As you learned from the videos, a shared collection has a single instance that is shared by all mobile users who have privileges for that collection. So any objects uploaded to that single shared collection are immediately visible to all such users. On the other hand, for an isolated collection, an instance of the isolated collection is created for each mobile user who has privileges for the isolated collection. And any objects uploaded by a user remain in that user’s isolated collection and are secure, preventing other mobile users from seeing and accessing those files.


This article introduced the lightweight Storage API provided by Oracle Mobile Cloud Service and demonstrated its two primary use cases: providing file sharing for your app’s mobile users (using a shared collection) and providing private storage for individual mobile users (using an isolated collection). Oracle Mobile Cloud Service provides this storage mechanism so mobile developers can easily add off-device file storage without provisioning that storage on existing enterprise on-premises infrastructure. Oracle Mobile Cloud Service developers who want heavyweight storage—that is, storage that’s supported by the full power of SQL—should look into the Oracle Mobile Cloud Service Database API.

Next Steps

TRY Oracle Mobile Cloud Service.

READ more about Oracle Mobile Cloud Service.

WATCH Oracle Mobile Cloud Service YouTube training.

JOIN the Oracle Mobile Platform Google+ community.


Photography by Raw Pixel, Unsplash