Based on this HN discussion, which I discussed a while back, I looked at how to set up WP as a CRUD database accessible via API.
It wasn’t hard. Steps:
- Install WordPress (I used ec2 and the Cloudformation sample template)
- Install the following plugins
- I also installed the following optional plugins
- Json Basic Auth to protect the API during development
- Registered Users Only to protect the entire website
- I created a custom post type of ‘todo’ and added a couple of custom fields.
- I was able to get the todos by going to these URLs (apparently you can have the API live at wp-json, but that required some rejiggering of url permalinks).
- http://host/wordpress/?rest_route=/wp/v2/todo/8
- http://host/wordpress/?rest_route=/wp/v2/todos
Here’s an example of the output:
{
"id": 8,
"date": "2018-03-05T02:38:26",
"date_gmt": "2018-03-05T02:38:26",
"guid": {
"rendered": "http://host/wordpress/?post_type=todo&p=8"
},
"modified": "2018-03-05T02:40:01",
"modified_gmt": "2018-03-05T02:40:01",
"slug": "auto-draft",
"status": "publish",
"type": "todo",
"link": "http://host/wordpress/todo/auto-draft/",
"title": {
"rendered": "Buy Milk"
},
"template": "",
"acf": {
"": false,
"due_date": "20180308",
"description": "please buy milk.",
"who_owns_it": {
"ID": "1",
"user_firstname": "",
"user_lastname": "",
"nickname": "mooreds",
"user_nicename": "mooreds",
"display_name": "mooreds",
"user_email": "...",
"user_url": "",
"user_registered": "2018-03-05 02:21:36",
"user_description": "",
"user_avatar": "..."
},
"done": false
},
"_links": {
"self": [
{
"href": "http://host/wordpress/wp-json/wp/v2/todo/8"
}
],
"collection": [
{
"href": "http://host/wordpress/wp-json/wp/v2/todo"
}
],
"about": [
{
"href": "http://host/wordpress/wp-json/wp/v2/types/todo"
}
],
"wp:attachment": [
{
"href": "http://host/wordpress/wp-json/wp/v2/media?parent=8"
}
],
"curies": [
{
"name": "wp",
"href": "https://api.w.org/{rel}",
"templated": true
}
]
}
}
The custom post fields are all under the ACF key, and you can see that there was an expansion of the who_owns_it field. If you are going to do this, make sure have the the normal title tag be part of the custom post, otherwise the WP UX for editing the custom posts won’t be much use.
Not perfectly restful, but a super simple way to set up an API that non technical folks can use to create, update or delete records and that you can consume in other systems.
This article on
Sometimes you have a list of locations in a Google spreadsheet and want to visualize where the locations using a map. Google Fusion tables lets you do just that, for free, with no technical expertise needed.
I have written before about
If you aren’t an avid follower of
A friend recently shared a letter from Hunter S. Thompson on
Leaving a company in a way that is fair to both you and your company can be difficult. When employed, we spend a large portion of our waking hours at work. You may be leaving a group of people you loved, a toxic environment, a place you’ve outgrown, or a place you’ve loved and just need to move on from for personal reasons. Because of the amount of time invested and the multiplicity of emotional circumstances, it can be difficult to leave well. Below are some thoughts on this career transition, however, I’m not writing about why you should leave, just how the process should go once you’ve made that decision. (Note that some of these apply to transitioning positions within a company.)
RDS
A few years ago I was working on an API that my client was going to make available to some of their clients. I used
Looks like the 