Facebook Parse API: An Introduction

Facebook's acquisition of Parse gives the social giant a big mobile boost by making it easier for developers to create apps for the Facebook platform. In a three-part series, we take a deep dive into Parse.

  • In this, the first installment of our series, we explain why this platform makes an excellent minimum viable product cloud solution that enables developers to focus on code instead of server infrastructure. We show you how to create a new project on Parse and explore the various dashboard features.
  • In the second part of our series, we integrate Parse into a sample iOS project, explaining the essential concepts of working with Parse objects and relationships.
  • In the final part of our series, we work with push notifications using Parse, as well as with Parse Analytics and Crash Reporting as we complete our sample iOS project.

What Is Parse?

Parse markets itself as the solution that securely and conveniently stores data in a managed cloud data store, without having to worry about server architecture, capacity and load. Aimed at cross-platform mobile developers, Parse lets developers focus on their core competencies while delegating the complexities of the back end to a proven scalable solution. However, Parse is evolving to provide more than just the handling of back-end servers, with the introduction of numerous goodies that aid mobile developers in creating a more robust app:

  • Parse Push delegates all the difficulties of setting up push notifications to Parse, simplifying the process of creating engaging notifications through a Web console.It also allows for sophisticated segmenting of push notifications based on various conditions.

 

  • Parse Analytics allows developers to track data points in apps in real time by monitoring stack traces in each distribution iteration, as well as through real-time API monitoring and analytics when Parse APIs are called and certain classes are accessed. Parse Analytics also lets developers analyze push campaigns to determine the effectiveness of segmentations, including open rate, and offers an overview of active users and retention data.

Why Choose Parse?

There are certainly other competing solutions out there, including Apple’s CloudKit Storage, which is free, and Orchestrate.io.

Orchestrate.io is quite a robust solution, as we noted in our review, but Parse provides for an all-in-one solution — from data storage to analytics to push notifications.

It comes down to price versus convenience, and when you are working on your minimum viable product (MVP), you usually want the quickest way to demonstrate your solution before you start to scale and acquire new series of funding. By not distracting yourself with the back-end infrastructure, you save time and cost by focusing on mobile app developers without the need (at least initially) to hire any database or server administrators.

Who Should Use Parse?

The Parse solution isn't for every business model. For startups that need to create a quick MVP to get through a first and second round of seeding, this is a great solution. Your user base is just starting to grow/mature. With that said, when your user base begins to grow, you'll probably need to look at alternative custom cloud solutions. But for a small team looking to get its product on the market, Parse is a good choice. Its Web interface is easy to use and intuitive, and, as you will see in the next two articles, interacting with objects in code is extremely easy, and working with push notifications requires no technical knowledge. Parse also allow you to export your data, so when you do look to make that move elsewhere, you aren't locked in to Parse.

Parse Pricing

Parse starts its users on a free tier, which affords up to:

  • 20 GB of storage
  • Push notifications for up to 1 million unique recipients
  • 1 TB of data transfer
  • One concurrent background job
  • Requests at 30 requests per second

Paid tiers increase in price by $100 increments, as the following table shows:

 

Sample Code

In putting together sample code, we decided not to create a new project from scratch but instead to "Parse-ify" an existing Apple project, TheElements, which can be downloaded here. TheElements is a sample application that provides access to all of the data contained in the periodic table of elements — all the known atomic elements in the universe. TheElements provides this data in multiple formats and allows users to sort by name, atomic number and an element's physical state at room temperature. We used TheElements because it is data-driven and uses localized plist files, which makes demonstrating the transition to cloud-based data access clearer and easier. We will begin to work with the code in the second article.

Note that we will be working with Objective-C, but that Parse.com supports Swift, Android, Windows Phone and JavaScript/Web apps.

Setting Up a Parse Account

To set up a free Parse account, go to the Parse Signup screen and fill out your details. You may also sign up with Facebook or a GitHub account.

When that’s done, create a new app called The Elements, after the Apple sample code we downloaded, then select the Core tab, just below it. You will then be presented with a blank dashboard.

Getting Familiar With the Dashboard

 

After following the steps in the previous section, you will be taken to the dashboard.

The dashboard's Core screen allows users to model data objects, classes and tables, along with columns and rows. If you needed any prepopulated data, you would create it here.

The Analytics screen, which we will look at more closely in the third article, is used for measuring app usage. This is the kind of data that, say, a startup's founders would take to their stakeholders and venture capitalists as proof of active usage and growth.

In the third article we will also look at the Push screen, which is the domain of the marketing team. With the Push screen, users work with analytics to track active engagement campaigns through push notifications.

Creating the Columns

Start by creating a new Custom class called AtomicElement consisting of the following columns:

  • atomicNumber - Number
  • name - String
  • symbol - String
  • state - String
  • flipperImageForAtomicElementNavigationItem - File
  • stateImageForAtomicElementTileView - File
  • stateImageForAtomicElementView - File
  • atomicWeight - String
  • group - Number
  • period - Number
  • discoveryYear - String

Populating the Rows

After creating the class and its associated columns, it’s time to add data. Currently, Apple’s sample app stores all its elements in a plist file for local on-device access. If you open up the Elements.plist in Xcode, you can see all the elements data, along with the attributes that we already set up in Parse.
 

Go ahead and add those elements from the plist to the class we created in Parse, one by one. For demonstration purposes, we are just going to add a few elements. We won't be working with relational objects, which is highly advanced (and certainly worth exploring as you gain familiarity with Parse).

Note that there are some system-generated columns — such as objectid, createdAt, updatedAt and ACL — which you should leave as is. Also, we won’t fill in certain fields right away. For example, we will generate image columns in code and add them to the cloud later on.

Other Dashboard Features

We won’t go into analytics and push until the last article of our series, but within the Parse Core Web interface, where we are at now, Parse provides numerous useful features. For example, you can calibrate the security level of the class and which fields can be writable.

The little filter icon allows you to filter data by specific columns and values, if you want to home in on something specific. If you had data in .json or .csv that you wanted to import, there’s a nifty import feature.
 

 

Next

One nice touch with Parse is that if you decide later on to leave Parse for your own custom solution, you can export all your data, which is quite liberating. This is why Parse is considered one of the best cloud solutions for MVP. CloudKit and many others don't let you do that, at least not at the press of a button. At the end of the day, get your app out quicker and worry about saving costs when you raise the money you need to have a dedicated systems and database administrator.

Next, we will start working with Xcode and integrating the Parse library, and start interacting with Parse objects.

Doron Katz A keen passion for emerging technologies, practices and methodologies, Doron embraces the vision of lean development with continuous customer development. Consultant for various startups, as a Project and Product Manager, with a mobile engineering background in iOS, and over 10 years of professional web development experience.

Comments