We the People API, Creating HTML5 Mobile App Over Lunch

The United States Government is offering 100s of APIs as part of its Next.Data.Gov iteration:

As I navigated the site I came across Government APIs page:


I always love trying new APIs and wanted to see what kind of API “We the People” provides. The API seemed to be pretty straight forward and next I figured let me try and build a mobile app that shows the petitions as well as details for each petition using Appery.io platform. I literally finished the app within 35 minutes or during my lunch.

Creating the pages

After creating a new app in Appery.io, I designed the Petition page:

Petition list page
  • A List component with a Label inside to display the petition name is used. 

Next is Details page:

Petition details page
  • The Label at the top displays the petition name (only border is shown)
  • The Collapsible Block has three sections:
    • Details – petition texst
    • Signatures – signature threshold, signature cound, and signtaures needed
    • More Info – link to petition page

The last page is Settings (popup):

Settings page
  • Allows to select how many petitions to show

Defining REST API services

Two services are used in this app:

  1. Service to get a list of all petitions
  2. Service to get petition details

The service to get all petitions:

Petitions API

The service has one request parameter to determine how many petitions to load:

Petition service request parameters

Service response:

Petition service response parameters

The other service is to load petition details:

Petition details service
  • The {id} is the petition id which was selected

To learn more about We the People API.

Binding services and pages

Once we get all the petitions, we map the data returned to the page:

Petition service to page mapping

On Details page we show information about a particular petition and thus get the petition id from local storage (it was stored when the petition was selected from the list). Request mapping is shown:

Mapping local storage variable to service request

The response mapping for Details page looks like this:

Petition details service mapping to page

Invoking the service

Once the service-page bindings are done, the last step is to invoke the service. For Petitions page, the service is invoked on ‘page load’ event:

Invoking service

For Details page, the service is also invoked on ‘page load’ event.

Testing the app

Testing is as simple as clicking the Test button:

Testing the app in browser

It’s as easy to test the app on the device by scanning the QR code.

Publishing the app

Appery.io comes with instance app hosting feature:

HTML5 app hosting

Go ahead and try the app: http://wethepeople.app.appery.io.

An app over lunch?


Gone are the days when you had to spend days downloading and configuring dev. tools. Gone are the days when you had to spend days downloading and configure software. With a cloud platform such Appery.io you can quickly build a real HTML5 mobile app, connected to real API, and host the app.

Published by

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 )

Facebook photo

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

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.