/ WordPress

WordPress as a back-end data store using the WP REST API

I'm just starting to experiment with the WP REST API and it has the potential to make WordPress the back-end for my non-WordPress coding projects.

For zack.pizza I can make a new post type of Pizza, give it any fields I want and add more as needed, then make a small project to call that data and push it to GitHub Pages. I'm enjoying using WordPress as the database because it makes use of some of my favorite things about WordPress,

  • Open source
  • I own my own data (I could hook up to the Foursquare API but then they own my check-ins)
  • It leverages the WordPress admin dashboard to manage the data. This point is probably the most important since WordPress has a mature editor with a focus on content managment.

Setting up a database for a new coding project is always annoying and slows down getting to the fun part of using the data to create the app/bot/site. With WordPress and a couple plugins, Custom Post Types UI to create the pizza post type and Advanced Custom Fields to add the fields, it's quick and easy to make the new data type. WordPress also gives me the ability to move things around, add, edit, delete, and rename fields while I'd figuring out how I want the API to be structured. If the project expands and needs something more robust, then I know exactly how the data should be modeled when making a stand alone solution.

I already added another post type to simply list the songs that get stuck in my head.

Earworm screenhot

If I start singing some tune to myself I make a new post in 'Earworm', add the name and a link in the 'YouTube' field. I don't know exactly how I'll use the data yet. Maybe a module on my blog, graph it by genre, add a field for lyrics, or link to the Genius music API. But now that the data is there in a form I can see and not just in a data store I'll rarely look at, it's making me antsy to get to work and do something with it.