Why why API?

I was looking at a page on the IBM website last week when something odd happened. Half the page loaded, then there was a spinning circle (a.k.a. a throbber) for a second or so, then the rest of the page loaded. The page itself is a few paragraphs of very boring text plus a menu. So why the drama with the throbber for a page like that?

If you check the source code, you find that instead of just sending a page with the words on it, IBM sent a heap of JavaScript code which runs in your browser and reads the data from the server using a thing called an API (Application Program Interface), and then formats it for the screen.

This has become a very common technique called an  - API-Based site or Single-Paged App (SPA) . For example, Twitter is an SPA. The data is being continually being updated so the page needs to be reading data all the time to keep the page current. 

But there are downsides. I have seen performance used to justify this approach. But given that there is about 3k of text on the IBM page and it loaded around twelve meg of JavaScript I don’t see it. 

How about dynamic content. This page hasn’t changed for about a year, and I wonder why it was changed so recently. The topic of the page was an ancient IBM access method was obsolete several decades ago. 

As an aside, the source code has several references to ‘walkme’ and I was curious as to what this is. I had a look at the Walkme website where I learned that  "WalkMe’s Digital Adoption Platform (DAP) is a no-code software platform that enables organizations to measure, drive, and act to ultimately maximize the impact of their digital transformation and accelerate the return on their software investment.".  So I still don’t know what they do.  I am sure it is wonderful. But back to the subject in hand...

An API has its uses on any site. On my lockdown project sudsjs.com I used an API to drive the autocomplete function for example. But websites that are completely dependent on APIs are very common now.   The user thinks that they are looking at many pages, but it is just different content being served up to the same page.

To support this, JavaScript libraries have been created called ‘frameworks’. For example, Vue and React. These help make the website dynamic as data is downloaded or uploaded via an API. Using these tools you can build really impressive web pages that are not just giving information, but are complex applications in their own right. 

But. There is always a but.  

  • Na├»ve users like me hit the back button and get taken out of the page entirely. I swear and spend the next five minutes trying to retrace my steps.  Then I notice little light grey arrow that the designer is provided to go back within the page logic. 
  • Google seems to be able to scan the IBM page OK (I checked). But there have to be SEO difficulties with large single-paged sites. How do links from Google searches work?  
  • Then there is that 12 meg of JavaScript to download. 
  • And for sites with adverts, each new page is an opportunity to present another ad.

This sort of site is becoming the default option. But for business sites that just need to server up boring technical data? I am not so sure.

No comments:

Post a Comment