This week we learned about APIs, or Application Programming Interfaces. I got the simple and straightforward analogy from this video, “What is an API?,” comparing APIs to waiters, but I am missing the big picture. APIs connect requests to data outputs, but what is the nature of the request and what is the data used for? Essentially, what is their purpose? In this video, “REST API concepts and examples,” we see how we can request data from YouTubes’s Facebook page and see how many likes it has, but you can see that simply by viewing the Facebook page… I know there is a lot more data that can be requested though, so is that the main point of APIs? Also, why would someone send a request to my website, “A Life Surfeited,” and should I concern myself with this? How can I use API to serve my customers?
I have spent most of today customizing my website and making Project notes in GitHub of things I want to do, change, add, etc. I also have many questions so am looking forward to our workshop class on Wednesday. The biggest thing I’m stuck on right now if finding the correct files to alter. I know I need to copy my theme files and put them in a child theme folder, but I’ve opened every file and am not sure where to begin. For example, I want to alter the padding around my website title/header, but I can’t find the right code in the theme header file. Or, I want to remove “author” as a column on my posts, but I can’t find the code for it anywhere in the post file. I’m sure I am going about it incorrectly:/ And google isn’t helping with this one – I keep reading that I should be adding my own CSS files (who knows, that might be right!).
I think once I get past this hurdle, I will be in a good place to knock out all the modifications I want to make. Then it will be on to testing on the live site and eventually posting live! In the interim, however, I plan to spend each day adding content to the site because mine is a travel blog, my goal is to have 6 total posts with images from places I have been recently. I also need to focus on adding and modifying a widget for my interactive map. I have narrowed it down to 3 options and will have to choose which is best based on the code (once I figure out how to find it!).
Wednesday night can’t come soon enough! 😛
These are good API questions to ask in class, so for now I’ll just say the API is — like much of what we’ve learned — is a helpful abstraction. Using your example, you could just request specific data en masse from an API instead of needing to look at each individual page.
To find how to alter the padding, you’ll want to use your browser’s inspector to find the element, related classes or ids, CSS file and line in the CSS file.
If you want to remove something, you’ll need to find out what template it’s part of, copy that template into your child theme and then remove it. Remember that a child theme is based on a parent theme — not just a complete copy of it. You should only be copying over files you want to override/modify.