How we used WP-API to populate an iPhone App

One of the advantages of the WP-API is that you can quickly extract data from your existing WordPress site and use that data in different ways. We run a fitness site at that offers a food and nutrition log. Our food database has over 10,000 foods and recipes that include foods from USDA, restaurant meals, and user created content. These food items are custom post types or CPTs inside of WordPress. We extended the WP-API to expose these CPTs so we create, edit, and read the data.

Using WP-API in the Simply Smoothies App

Simply Smoothies App Using the WP-API

We launched our first iPhone app in 2015 called Simply Smoothies. You can create custom smoothie recipes just by selecting your favorite ingredients. After you click Save, we select the best proportions of ingredients and calculate the nutritional content of your recipe! The app includes a curated list of over 150 ingredients. Each ingredient includes all the information that you would find on the Nutritional Facts label–which is a ton of metadata. We needed to seed our Core Data database with data that we already had in our website, just in a different format. The WP-API allowed us to quickly expose the data in a JSON format that we could then import into our iPhone app therefore saving a significant amount of time to develop the app.  Now whenever we need to add an ingredient to our app, we just make a GET request to our site and import the new ingredient!

Keep in mind that the WP-API doesn’t expose custom post types by default and if you have any serialized data you will need to write your own code to create, update, and read the data.  AppsWP is happy to provide custom work to our clients.  Please use the contact us page to get in touch!

Welcome to AppsWP

We are excited to launch our first iPhone app template in the coming month.  This blog template will easily turn your WordPress blog into a native iOS app for the iPhone.  The template will include easy ways for a non-programmer to change fonts, colors, layouts, and more!  If you are a developer, the template will give you a jumpstart in creating your first iPhone app for the WordPress REST API that will soon be included in WordPress core. Stayed tuned!