It can at times be like looking for a 'needle in a haystack' when it comes to pinning down a specific method of getting your website to function in a specific way.
Like for instance, it occurred to me that there ought to be a 'standard way' to query (via some application programming interface or API call) a chunk of information concerning activity taken on the website, be it global website metadata, something about a post or collection of posts or about a specific author--stuff like that. (Credit image right: www.json.org)
Well, the bad news is, there really isn't one 'standard' way. The good news is, today at least, you have more than one way to obtain that information at your disposal. But that can create confusion.
In fact, if you do the requisite research as I have (in an effort to answer a few needs here on Linux Advocates), you might at first be overwhelmed by the sheer surplus of data, help websites, how-to's, 'know-it-all' posts that confront you, all bombarding your brain on a Google search adventure.
Fortunately, in the case of Blogger, the documentation for their web application programming interface is right at your fingertips here.
The methods you ultimately choose for reaching into your website's data cache will depend on which web engine you have chosen and which tools you employ.
For many website platforms, it might seem most direct to simply write a SQL to obtain the data needed on the backend database, used to store persistent data. And on many websites, that is frequently done.
As for Blogger, the web monkey (Me) doesn't have access to a database per se. The database, if there is one, isn't surfaced by Google. Instead, what they expose is the aforementioned API, JSON. A seemingly circuitous path, set of gymnastics a code monkey must contort into to get at the needed data.
Some things come more easily for dedicated programmers than the less initiated. For starters, having a higher threshold of 'pain' works to one's advantage--when I can't find an answer, I obsess for days, gnash teeth, fidget, until I hit on the answer--pretty routine masochistic self-imposed torture. Most programmers accept this as part of their occupation and resign themselves to pouring over on-line technical documentation, some better and some less so, all in a vengeful determined effort to divine the 'magic' to getting from point A (the problem) to point B (the solution)--returning the correct piece of data or desired function (behavior), hopefully.
So, after many starts and stops, interruptions, staring for long periods of time, ranging across the Internet (one time there was a sign 'You have reached the end of the Internet--turn around and go back'), I was finally feeling like I had decoded the 'Rosetta Stone' and came up with a subset of code which might be your 'prototypical' example for querying the JSON API:
Good Code Monkey. Now press the button and take the pellet. There.
Along the way, in my various readings, I came across this sterling article which summarizes quite well why JSON is revolutionizing the 'Internet of Things'. The author Luc Perkins keenly observes:
"...Ten years ago, XML was the primary data interchange format. When it came on the scene, it was a breath of fresh air and a vast improvement over the truly appalling SGML (Standard Generalized Markup Language). It enabled people to do previously unthinkable things, like exchange Microsoft Office documents across HTTP connections. With all the dissatisfaction surrounding XML, it’s easy to forget just how crucial it was in the evolution of the web in its capacity as a “Swiss Army Knife of the internet.”
I strongly believe that this transformation can be attributed to four broad trends, which I’ll discuss in turn:
1. APIs (application programming interfaces)
2. Big Data
3. The Internet of Things
So, during my journey learning JSON, I have reached the conclusion that in today's 'mash-up' Web 2.0 world where one website incorporates chunks of data from another unbeknownst to the average user, behind the scenes is most likely JSON at work.
Ten years ago, XML might have been the only solution for serializing and exchanging data over http.
Even more sophisticated today is using JSON over Websockets which is only beginning to turn up in some of the more advanced website coding practices.
JSON's lightweight nature requires far less effort than XML and integrates into most website frameworks now as a plugin architecture if not present in its default installation.
So, does this fit with your view on the 'Internet of Things' and experience with the newest programming paradigms? Please give your feedback!