With the release of WordPress version 4.7, the REST API is now included in the core therefore you no longer need to install a plugin to use it.
Per Automattic, “WordPress is moving towards becoming a fully-fledged application framework, and we needed new APIs. This project was born to create an easy-to-use, easy-to-understand and well-tested framework for creating these APIs, plus creating APIs for core.”
We wanted to see how easy it is to build an application using the new REST API. So, we looked to solve a long-time pet peeve – finding a decent movie to watch on the many premium cable channels available. You probably thought we’d focus our attention on some revolutionary way we did business or launched websites. Nope. We try to optimize our free time just as much as we do our work day hours.
We were tired of scrolling through the hundreds of movies streaming through our cable packages and not being able to find a decent movie to watch.
Yes, it is true your cable box will allow you to sort movies by genre but not by rating and the rating that is used is not quite accurate, where do those ratings come from anyway? We’ve found IMDB and RottenTomatoes to be more reliable metrics and yes, we have had personal differences of opinion with IMDB but for the most part, the ratings are fairly accurate.
Problem to solve: Hundreds of movies are available to stream via HBO, Showtime and Netflix. Make it easy to find a well-rated movie in the genre of your choosing starring the actors of your choosing.
Answer to problem: movies.siteessential.com
Resources:
- Guidebox’s free movie, TV and video API.
- WPAPI a JavaScript Client for the WordPress REST API.
- The OMDb API is a RESTful web service to obtain movie information.
- Advanced Custom Fields WordPress Plugin
Explanation: We found the Guidebox API and we were delighted that it offered the information we needed – movie title, network, movie description, poster image, IMDB link and Rotten Tomatoes link.
Using the results from our requests to the Guidebox API as the driver, we added or updated posts in our WordPress installation with movie details. The second step was to make calls to the OMDb API to retrieve the ratings from IMDB and RottenTomatoes.
Users of the site can query by Network and/or Title and/or Actor and/or IMDB rating to find the movie of their choice.
Thoughts about the REST API
We loved it! We absolutely loved working with the REST API!
Searching posts using Advanced Custom Fields can require complex query strings when you are faced with multiple search criteria. We found searching posts using the REST API easy. Even populating posts with Advanced Custom Fields was made easy by using the REST API.
If you are building an AJAX application and want to make use of the REST API, you must install WPAPI – JavaScript Client for the WordPress REST API. This Javascript library is well maintained and documented and will remove the headache of accessing the WordPress tables.
We have been using movies.siteessential.com and happy with the results.