0% found this document useful (0 votes)
243 views

API Basics

API stands for application programming interface. It allows two applications to communicate and exchange data without user intervention. There are different types of APIs including open, partner, internal, and composite APIs. A web API is an API that uses HTTP and is accessed via the internet. Common examples include Google Maps API, YouTube API, and Twitter API. API testing tools like Postman allow testing APIs manually. Web services are software modules that perform tasks over a network. The two main types are SOAP and RESTful web services. SOAP uses XML and HTTP, while RESTful uses HTTP requests and response. Key elements of RESTful services include resources identified by URLs, HTTP request verbs, request and response bodies, and response status codes.

Uploaded by

Srinivas Bathula
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
243 views

API Basics

API stands for application programming interface. It allows two applications to communicate and exchange data without user intervention. There are different types of APIs including open, partner, internal, and composite APIs. A web API is an API that uses HTTP and is accessed via the internet. Common examples include Google Maps API, YouTube API, and Twitter API. API testing tools like Postman allow testing APIs manually. Web services are software modules that perform tasks over a network. The two main types are SOAP and RESTful web services. SOAP uses XML and HTTP, while RESTful uses HTTP requests and response. Key elements of RESTful services include resources identified by URLs, HTTP request verbs, request and response bodies, and response status codes.

Uploaded by

Srinivas Bathula
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 6

API Basics

Session : 3 Part-1
API ?

•is a collection of software functions or


procedures (accessed/executed) that allows
two different applications to communicate and
exchange data with each other without any
user intervention.

•It offers products or services to communicate


with other products and services without
having to know how they’re implemented.
             
Types of API? Web API?

•Open APIs: These types of APIs are publicly available to use like •A Web API is an application programming interface which is used either for
web server or a web browser.
OAuth APIs from Google. It has also not given any restriction to
•Two types of Web APIs are 1) Server-side API 2) Client-side API
use them. So, they are also known as Public APIs.

•Partner APIs: Specific rights or licenses to access this type of 1.Server-side:


• consist of one or more publicly exposed endpoints to a defined request–
API because they are not available to the public. response message system. It is typically expressed in JSON or XML

•Internal APIs: Internal or private. These APIs are developed by 2.Client-side:


• helps to extend functionality within a web browser or other HTTP client.
companies to use in their internal systems. It helps you to

enhance the productivity of your teams. Examples of web API:


•Google Maps API’s allow developers to embed Google Maps on webpages by using a JavaScript or
Flash interface.
•Composite APIs: This type of API combines different data and
•YouTube API allows developers to integrate YouTube videos and functionality into websites or
applications.
service APIs           •Twitter offers two APIs. The REST API helps developers to access Twitter data, and the search API
provides methods for developers to interact with Twitter Search.
•Amazon’s API gives developers access to Amazon’s product selection. 
API Testing tools: Postman, PingAPI, vRest & Web
service
Postman:
•Postman is a plugin in Google Chrome, and it can be used for
testing API services. It is a powerful HTTP client to check web
services. For manual or exploratory testing, Postman is a good
choice for testing API. With Postman, almost all modern web API
data can be extracted. It Helps you to write Boolean tests within
Postman Interface. You can create a collection of REST calls and
save each call as part of a collection for execution in future. For
transmitting and receiving REST information, Postman is more
reliable. Download link: https://www.postman.com/

Web service:

•Web service is a standardized medium to propagate


communication between the client and server applications on the
WWW (World Wide Web).
•A web service is a software module that is designed to perform a
certain set of tasks.
•Web services in cloud computing can be searched for over the
network and can also be invoked or requested by the client via RPC
accordingly.
•When invoked, the web service would be able to provide the
functionality to the client, which invokes that web service.
Web services: XML based, loosely coupled, synchronous
and asynchronous functionality and RPC supported
•There are mainly two types of web services.
• SOAP web services:
• is an XML-based protocol (language, platform, and o/s independent) for
accessing web services over HTTP.
• So, the SOAP protocol can work any programming language-based
applications on both Windows and Linux platform.
• It works on the HTTP protocol, which is the default protocol used by all web
applications.
• Whenever a client application calls a method in the web service, the web
service will automatically generate a SOAP message which will have the
necessary details of the data which will be sent from the web service to the
client application. •Message Format: (Header for client detail and Body for response)
•WSDL (Web services description language): By using the WSDL document, the client
• RESTful web services: application would be able to understand where the web service is located and how it
• is a lightweight, maintainable, and scalable service that is built on the REST can be utilized. The WSDL file contains the location of the web service and the
architecture. Restful Web Service, expose API from your application in a methods which are exposed by the web serv
secure, uniform, stateless manner to the calling client. The calling client can
perform predefined operations using the Restful service. The underlying
protocol for REST is HTTP. REST stands for REpresentational State Transfer. •It consists of message (input & output), port (operation which is performed by web
service and bind means protocol as HTTP)
• REST is a way to access resources which lie in a particular environment. For
example, you could have a server that could be hosting important documents •Universal Description, Discovery, and Integration (UDDI): how can a client application
or pictures or videos. All of these are an example of resources. If a client, say a locate a WSDL file to understand the various operations offered by a web service?
web browser needs any of these resources, it has to send a request to the
server to access these resources. Now REST services defines a way on how •So UDDI is the answer to this and provides a repository on which WSDL files can be
these resources can be accessed. hosted. So the client application will have complete access to the UDDI, which acts as a
database containing all the WSDL files.
key elements of a RESTful implementation
•Resources – Let assume that a web application on a server has records of
several employees. Let’s assume the URL of the web application is
http://demo.guru99.com. Now in order to access an employee record
resource via REST services, one can issue the command
http://demo.guru99.com/employee/1 – This command tells the web server to
please provide the details of the employee whose employee number is 1.
•Request Verbs – These describe what you want to do with the resource. A
browser issues a GET verb to instruct the endpoint it wants to get data.
However, there are many other verbs available including things like POST,
PUT, and DELETE. So in the case of the example
http://demo.guru99.com/employee/1 , the web browser is actually issuing a
GET Verb because it wants to get the details of the employee record.
•Request Headers – These are additional instructions sent with the request.
These might define the type of response required or the authorization details.
•Request Body – Data is sent with the request. Data is normally sent in the
request when a POST request is made to the REST web services. In a POST
call, the client actually tells the REST web services that it wants to add a
resource to the server. Hence, the request body would have the details of the
resource which is required to be added to the server. 1. Heterogeneous languages and environments, you really don’t need to know what is the
•Response Body – This is the main body of the response. So in our RESTful API underlying layer for the device. Since all Cloud-based architectures work on the REST
example, if we were to query the web server via the request principle, it makes more sense for web services to be programmed on the REST
http://demo.guru99.com/employee/1 , the web server might return an XML services-based architecture to make the best use of Cloud-based services.
document with all the details of the employee in the Response Body. 2. State and functionality are divided into distributed resources – This means that every
•Response Status codes – These codes are the general codes which are resource should be accessible via the normal HTTP commands of GET, POST, PUT, or
returned along with the response from the web server. An example is the
code 200 which is normally returned if there is no error when returning a
DELETE.
response to the client. RESTFul Principles and Constraints
•Let’s assume that we have a RESTful web service is defined at the location. 1) Client-Server
http://demo.guru99.com/employee . When the client makes any request to 2) Stateless
this web service, it can specify any of the normal HTTP verbs of GET, POST, 3) Cache
DELETE and PUT. Below is what would happen If the respective verbs were
sent by the client.
4) Layered System
5) Interface/Uniform Contract

You might also like