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

Api Presentation

API stands for Application Programming Interface. It allows different applications and services to communicate and share data. There are two main types of APIs - SOAP and REST. SOAP uses XML format over HTTP, while REST uses HTTP with JSON or XML formats. API testing is important as it tests the business logic layer separately from the user interface. Common API testing tools include Postman which allows sending HTTP requests and validating responses.

Uploaded by

pcuserant
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
349 views

Api Presentation

API stands for Application Programming Interface. It allows different applications and services to communicate and share data. There are two main types of APIs - SOAP and REST. SOAP uses XML format over HTTP, while REST uses HTTP with JSON or XML formats. API testing is important as it tests the business logic layer separately from the user interface. Common API testing tools include Postman which allows sending HTTP requests and validating responses.

Uploaded by

pcuserant
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 30

API

WHAT IS API ?

• Application Programming Interface (API) is a small piece of code that


enables different applications and services to communicate and share
information with each other.
• •API also called Web Service.
API
API

• There are 2 types of API


1. SOAP ( Simple Object Access Protocol)
2. REST(Representational State of Transfer)
SOAP

• Soap (Simple Object Access Protocol)


• SOAP is for communication between applications
• SOAP is a format for sending messages
• SOAP communicates via internet
• SOAP is platform independent
• SOAP is based on XML
SOAP API
HOW DO WEB SERVICES COMMUNICATE WITH
EACH OTHER?
RESTWEB SERVICES

• REST(Representational State of Transfer) is a lightweight option for


developing web services using the HTTP protocol.
• It can structure data into XML or any other machine readable format, but usually
JSON
• Rest is very data driven, compared to SOAP, which is strongly function driven.
API
SOAP VS REST

• SOAP is not popular anymore


• •80% of the market is using REST
• •SOAP is XML Response, REST IS XML and JSON
• •REST is purely http protocol
• We can hit the link on the browser and see the results.
API
API(MICROSERVICES)

Web
Search Inventory

Account Shipment

DB
SHORT 2
WHAT IS AN API TESTING?

• API testing is entirely different from GUI testing and mainly concentrates on
the business logic layer of the software architecture. This testing won't
concentrate on the look and feel of an application.

• Instead of using standard user inputs(keyboard) and outputs, in API Testing,


you use software to send calls to the API, get output, and note down the
system's response.
WHAT IS AN API TESTING?

API Testing requires an application to interact with API. In order to test an API,
you will need to
1.Use Testing Tool to drive the API
2.Write your own code to test the API
API
WHY API TESTING IS IMPORTANT?

• Faster to test than GUI testing


• Without a UI, it can be tested earlier in the life cycle
• Becoming more popular in the industry
• Time Efficiency vs. functional and validation testing
• Cost Effective / Reduces Testing Cost
HOW TO SEND A REQUEST ?

• When we send request, we need to know the API methods/endpoints that


are available:
• - read documentation about api methods
• - Swagger tool, that has API methods and descriptions
TYPES OF HTTP REQUESTS

• GET –Retrieves the data from a specified source


• POST-Sends new data to a specified source
• PUT-Updates info for a specified source
• DELETE-Removes data from a specified source
POSTMAN

• Is a RESTAPI client tool that helps to test REST API urls.


• It is popular for both developers and testers.
• We can use both manual and automation purposes.
POSTMAN
HTTP STATUS CODE

• 200 -> OK
• 400 -> CLIENT'S ERROR
• 500 -> SERVER/API'S ERROR
FIRST TEST CASE

• When I send a GET request to


• http://54.204.128.200:8000/api/spartans
• Then Response STATUS CODE must be 200
• And I Should see all Spartans data in JSON format
HEADERS

• Additional information about request and response.


• It works like a map key&value structure
What we send with the headers ?
• Content types (application/json, application/xml, ...)
• Credentials, Authentication, ( username, password, different types)
REQUEST HEADERS

• Credentials, Authentication, ( username,password, different types)


• Accept, application/json à hey api, please send me json respond.
• Accept, application/xml à please send me xml response
RESPONSE HEADERS

• Content-type, application/json àhey client, I am sending you json body


• Content-type, application/xml àhey client, I am sending you xml body
EXAMPLE TEST CASE

Given Accept type application/xml


When user send GET request to api/spartans end point
Then response Content Type must be application/xml
And response body should be xml format
PARAMETERS

• Parameters are options you can pass with the endpoint to influence the
response
• •2 Types of Parameters
• Query Parameters
• Path Parameters
PATH PARAMETER

• is a part of URL and followed by the end of full resource url


• 54.204.128.200:8000/api/spartans/{id}

Path parameter
QUERY PARAMETERS

• •It is NOT part of url and passed in key+value format


• ? means and of url

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy