TimeLinux1

Saturday, March 7, 2015

API, Web Services, SOAP, REST, etc

API - A piece of code that permits App-to-App communication, without low level user interaction.
In short, APIs permit 'seamless' end user experience.
eg: A ecomm web (site) app communicates with a Credit card web (site) app to complete a transaction without user needing to do anything to facilitate the communication between those two apps (except username/password etc)

XML - is the standard language by which Applications communicate over the Internet.
In Web apps, API itself is a piece of code written as a series of XML messages.
The messages call functions of the remote app.

SDK - is a Superset of API.
SDKs comprise API, supplementary tools, documentation etc.
SDKs are released by Application developer companies.
The business goal of SDKs is to enhance application adoption by making the job of developers easier.

SOAP - encodes XML messages in APIs so any OS on any network protocol can understand it.
(simple object access protocol)
originally developed by microsoft; exclusively XML based. bulky & complex.
came in response to the needs of the web apps which needed more than the previosly binary based APIs like com, DCOM, ActiveX, corba etc.

REST - REST uses a simple URL instead of XML messages (as in SOAP) to simplify things.
REST uses 4 http verbs or methods - GET, POST, PUT, DELETE.
REST based web services can output in csv, Json, RSS etc; sometimes even images may be returned.

Eg: Geocoder REST API to GET location info is as simple as typing this in the URL:

http://rpc.geocoder.us/service/csv?address=1600+Pennsylvania+Ave,+Washington+DC

and this outputs a Json response.

Advantages/Disadvantages: SOAP vs REST
-SOAP advantages:
.REST requires http, SOAP is lang, OS, protocol indep (eg works with http, https, smtp etc)
.standardized
.built in error-handling
-REST advantages:
.smaller, simpler
.not fixed on XML complicacies
.multiformat output, works better with web technologies like Javascript

note: very few web services (like amazon) support both SOAP and REST. its usually either/or.
REST services are identified and accessed via an URL.
SOAP is identified and accessed via XML based WSDL (web services description lang).
note: stateless vs stateful:
.stateless - any two requests (even if the same request twice) have no knowledge of each other
-eg http, REST, nfs, ip
.stateful - a request is dependent on its predecessor, ie requires knowledge of prev req
-eg ftp, tcp, database connection
note: -GET method - http request query string is sent as part of the URL; can be cached, bookmarked and less secure
-POST method- http request query string is sent as part of the request body; cant be cached,bkmkd and is more sec.
-PUT method - http request that replaces a resorce (doc, file, page etc) if present or creates if not present.
-DELETE meth- http request that deletes a specified resorce.
note: -idempotence- the phenomenon in which result does not change if action is repeated.
-eg: i = 4; is idempotent (bec i will always be 4, whenever this statement is executed) but
i++; is not idempotent (value of i will change everytime the statement is executed)
-in context of the four http methods in REST, all (GET, PUT, DELETE) except POST are idempotent.
note: -Resources on the web are identified and located using one of the following mechanisms:
.URI - Uniform Resource Identifier - identifies/locates a resource by either name or by location
.URN - Uniform Resource Name - identifies a resource by a name
.URL - Uniform Resource Locator - identifies and locates a resource by name and its access method.
-Both URN and URL are types of URI. But URL is most common.
Examples:
.URI - http://www.timedigit.com/index.html#one     - Name of a certain element on the page
.URN - www.timedigit.com/index.html   - resource name but WITHOUT access method (http)
.URL - http://www.timedigit.com/index.html - resource name WITH access method (http)

Tuesday, December 30, 2014

Unsupported Version of Google Chrome after Ubuntu update

Recently ran the 'Software Update' utility on my laptop running Ubuntu Linux 14.04 OS and ever since, I have been graced by this (un)friendly sort of error every time I use gmail app on my google chrome browser:

This version of Chrome is no longer supported. Please upgrade to asupported browserDismiss

This error suggests that the gmail app is not very happy with my browser version (which was v36, the latest version out there being v39). Now If I use 'Software Update' utility again, it tries to update a laundry list of all packages in my OS to update totaling upto about 600 Mb; which would be ok if I wasnt short on time. So a better solution for me would be to simply upgrade Chrome only and nothing else. And here is what I tried.

First, I tried to upgrade Google chrome via the browser settings menu but it came back and said its already at the latest! well that wasnt much help.
So I then, tried my next option of upgrading only Google chrome via the apt-get utility (as shown in the screen shot).




And that did it. Once apt-get completed its work, I restarted my browser and it on checking its version, it showed that it was upgraded to the new version (v39). And yes the error no longer shows up either! Hooray!

So, if you have been through this error yourself and wondering what to do, then you could follow the simple method of upgrading only Google chrome & get rid of that pesky error.