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)
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)