Wait, what’s an API and why would I use WordPress as an API?
What the heck is a BYOFE, and what does it have to do with WP?
Why are there so many acronyms?!?! 😉
- Probably your own laptop to work along
- Refer to or download this Git repository.
- Install LocalWP.com, cross platform, available for Linux, Windows, and Mac
- Postman app or Insomnia app installed, cross platform, available for Linux, Windows, and Mac (or you can use the web version of Postman.
- Knowledge and experience with Git, PHP, and maybe some JS
- LocalWP (from LocalWP.com, or a similar local development environment, but I won’t be helping debug it so they should install and test it before they come)
- Postman (https://www.postman.com/): they can download the app or use the web app. The need create an account. (preferred, I’ll be using this in the workshop)
- Insomnia (https://insomnia.rest/download )
- Extra Credit: NodeJS installed for the feed reader.
It would be good if you were familiar with at least PHP and JS (you don’t have to be experts, I think intermediate is fine, there will be code they can copy/paste). If they were familiar with Git and Github, that would be good too.
- Setup, import, first example (10 minutes)
- WP REST API (30 – 40 minutes)
- GET and POST with posts/pages
- Meta, ACF
- Custom endpoints
- Authentication methods (20 minutes)
- None (already covered)
- API Key/APP Password
- Repeat some of the above with with WPGraphQL (15 minutes)
- Postman (10 minutes)
- Extra Credit (15 minutes)
- Set up basic React app
- “Feed Reader”
- JWT Login and Auth for creating post types.
In 2020, I gave a different version of this talk to our local WP meetup via Zoom or Google or whatever we were using in those “early pandemic days”… Below are the abstract, recording, and slides for that presentation…
WordPress is an incredibly flexible platform on which to build websites and web apps. Traditionally, WP has been used for blogs, publishing platforms, business websites and more. It offers an all-in-one package.
But what if you want to use a framework like Gatsby (or Gridsome), NextJS (or NuxtJS), 11ty, MERN, Laravel, Ruby on Rails, RedwoodJS, etc. to build an application, but long for the WordPress editing experience?
Or, what if you have a client that already has a web application running, and would like to incorporate a blog using WordPress to that application?
There are many ways to “couple” other technologies with a “decoupled” WordPress publishing experience.
In this talk, we’ll explore:
- What an API is and to use WordPress as an API
- Look at other BYOFEs (bring your own front-end), and how WordPress offers the same or more out of the box
- How we can easily create custom post types and custom fields to manage our data in WordPress for API consumption
- How we can use other frameworks to read and publish WordPress data (I’ll be using examples from Create React App and Gatbsy mostly, but this will apply to any framework that can consume an API
- Some caveats and how to address those.
This will be a jam-packed, Jam-stacky talk, so BYO-lunch and BYO-curiosity as we discover how we can use WP as an API instead of other BYOFE (ok, I’ll stop with the acronyms now!).