Introduction to APIs
VIBHAWA NIRMAL WIJERATHNA
Agenda
What is API ?
Types of API
What is web Service ?
Compare and Contrast API vs Web Services
SOAP Web Service?
REST Web Service?
Compare and Contrast SOAP vs REST
What is API ?
• API Stands for Application Programming Interface.
• API’s allows two applications to communicate with each other.
• It is a contract between the client and server.
• Client sends a request through the API and after performing the action the
API will send back a response to the client.
What is API ? Cont..
• APIs can be use for;
• Communication between services.
• Example : BankTransactions through third party apps.
• Access inbuilt hardware of a device.
• Example : access camera in a mobile.
Application API Assets
Types of Application Programming Interface (APIs)
• Private API
• Public API
• Partner API
Private API
• Private APIs are developed by own company to enhance the own products and
services.
• They have below characteristics ;
• Less Common.
• Exposed only to the internal systems.
• Used across internal development teams within the company.
Public API
• Public APIs are published publicly and that can be used by anyone(any third-party
user).
• They have below characteristics ;
• Publicly available without any access restriction.
• Used to communicate beyond the boundaries of the company.
• No need to necessarily have a business relationship with them.
Partner API
• Partner APIs are used by specific parties with whom the company agrees to share
data.
• They have below characteristics ;
• Are exposed to selected business partners.
• Used for communication between a company and its business partners.
What is Web Service ?
• Used for exchanging data between applications or systems with the
support of protocols and standards via internet.
• Main component of a web service is the data which is transferred
between the client and the server, and that is XML.
Web Service Architecture
Client Web ServerInternet
Client request services from web server and server response to client with the web service.
Compare and Contrast API vs Web Services
API Web Service
All APIs are not web services. All web services are APIs.
Responses are formatted using Web API's Media Type
Formatter into XML, JSON, or any other given format.
It supports XML.
Has a light-weight architecture. Does not have light-weight architecture.
Need a SOAP protocol to send or receive data over the
network.
Can be used by a client who understands JSON or XML. Can be used by any client who understands XML.
API can be used any style of communication. Web service uses three styles: REST, SOAP, and XML-RPC for
communication.
It provides support for the HTTP/s protocol: URL
Request/Response Headers, etc.
It provides supports only for the HTTP protocol.
Web Service API ?
• There are two major types of web services;
• SOAPWeb Services (Simple Object Access Protocol)
• REST Web Services (Representational StateTransfer )
What is SOAP?
• SOAP stands for Simple Object Access Protocol.
• A format for sending and receiving messages.
• SOAP is platform independent.
• Originally developed by Microsoft.
• The best way to communicate between applications is over HTTP.
• SOAP provides a way to communicate between applications running on different
operating systems, with different technologies and programming languages.
Building Blocks of SOAP?
• A SOAP message is an ordinary XML document which contains;
• An Envelope : identifies the XML document as a SOAP message
• A Header : contains header information
• A Body : contains call and response information
• A Fault : contains errors and status information
What is REST?
• REST stands for REpresentational StateTransfer.
• Relies on a stateless communications protocol most commonly, HTTP.
• REST structures data in XML,YAML, or any other format that is
machine-readable.
• Usually JSON is the most widely used format.
Basic REST Request?
• GET : read or retrieve data
• POST : add new data
• PUT : update existing data
• DELETE : delete data
Compare and Contrast SOAP vs REST
SOAP REST
Is a protocol. Is an architectural style.
SOAP can’t use REST because it is a protocol. REST can use SOAP web services because it is a concept
and can use any protocol like HTTP, SOAP.
Permits only XML. Permits many different data formats including plain text,
HTML, XML, and JSON.
Requires more bandwidth and more resources. Requires less bandwidth and less resources.
Supports both SMTP and HTTP protocols. Requires the use of HTTP only.
SOAP is more reliable than REST. REST is less secure than SOAP.
SOAP is faster than REST. REST is slower than SOAP.
SOAP defines its own security. RESTful web services inherit security measures from the
underlying transport.
Thank You
Vibhawa Nirmal Wijerathna

Introduction to APIs (Application Programming Interface)

  • 1.
  • 2.
    Agenda What is API? Types of API What is web Service ? Compare and Contrast API vs Web Services SOAP Web Service? REST Web Service? Compare and Contrast SOAP vs REST
  • 3.
    What is API? • API Stands for Application Programming Interface. • API’s allows two applications to communicate with each other. • It is a contract between the client and server. • Client sends a request through the API and after performing the action the API will send back a response to the client.
  • 4.
    What is API? Cont.. • APIs can be use for; • Communication between services. • Example : BankTransactions through third party apps. • Access inbuilt hardware of a device. • Example : access camera in a mobile. Application API Assets
  • 5.
    Types of ApplicationProgramming Interface (APIs) • Private API • Public API • Partner API
  • 6.
    Private API • PrivateAPIs are developed by own company to enhance the own products and services. • They have below characteristics ; • Less Common. • Exposed only to the internal systems. • Used across internal development teams within the company.
  • 7.
    Public API • PublicAPIs are published publicly and that can be used by anyone(any third-party user). • They have below characteristics ; • Publicly available without any access restriction. • Used to communicate beyond the boundaries of the company. • No need to necessarily have a business relationship with them.
  • 8.
    Partner API • PartnerAPIs are used by specific parties with whom the company agrees to share data. • They have below characteristics ; • Are exposed to selected business partners. • Used for communication between a company and its business partners.
  • 9.
    What is WebService ? • Used for exchanging data between applications or systems with the support of protocols and standards via internet. • Main component of a web service is the data which is transferred between the client and the server, and that is XML.
  • 10.
    Web Service Architecture ClientWeb ServerInternet Client request services from web server and server response to client with the web service.
  • 11.
    Compare and ContrastAPI vs Web Services API Web Service All APIs are not web services. All web services are APIs. Responses are formatted using Web API's Media Type Formatter into XML, JSON, or any other given format. It supports XML. Has a light-weight architecture. Does not have light-weight architecture. Need a SOAP protocol to send or receive data over the network. Can be used by a client who understands JSON or XML. Can be used by any client who understands XML. API can be used any style of communication. Web service uses three styles: REST, SOAP, and XML-RPC for communication. It provides support for the HTTP/s protocol: URL Request/Response Headers, etc. It provides supports only for the HTTP protocol.
  • 12.
    Web Service API? • There are two major types of web services; • SOAPWeb Services (Simple Object Access Protocol) • REST Web Services (Representational StateTransfer )
  • 13.
    What is SOAP? •SOAP stands for Simple Object Access Protocol. • A format for sending and receiving messages. • SOAP is platform independent. • Originally developed by Microsoft. • The best way to communicate between applications is over HTTP. • SOAP provides a way to communicate between applications running on different operating systems, with different technologies and programming languages.
  • 14.
    Building Blocks ofSOAP? • A SOAP message is an ordinary XML document which contains; • An Envelope : identifies the XML document as a SOAP message • A Header : contains header information • A Body : contains call and response information • A Fault : contains errors and status information
  • 15.
    What is REST? •REST stands for REpresentational StateTransfer. • Relies on a stateless communications protocol most commonly, HTTP. • REST structures data in XML,YAML, or any other format that is machine-readable. • Usually JSON is the most widely used format.
  • 16.
    Basic REST Request? •GET : read or retrieve data • POST : add new data • PUT : update existing data • DELETE : delete data
  • 17.
    Compare and ContrastSOAP vs REST SOAP REST Is a protocol. Is an architectural style. SOAP can’t use REST because it is a protocol. REST can use SOAP web services because it is a concept and can use any protocol like HTTP, SOAP. Permits only XML. Permits many different data formats including plain text, HTML, XML, and JSON. Requires more bandwidth and more resources. Requires less bandwidth and less resources. Supports both SMTP and HTTP protocols. Requires the use of HTTP only. SOAP is more reliable than REST. REST is less secure than SOAP. SOAP is faster than REST. REST is slower than SOAP. SOAP defines its own security. RESTful web services inherit security measures from the underlying transport.
  • 18.