0% found this document useful (0 votes)
4 views88 pages

API Notes1

The document outlines the differences between APIs and web services, detailing communication protocols such as SOAP and REST, and the data formats used (XML and JSON). It describes various HTTP methods (GET, POST, PUT, PATCH, DELETE) and their respective functionalities, along with response codes and payloads. Additionally, it covers testing APIs using tools like Postman, the concept of microservices, and the use of Java for creating API interactions.

Uploaded by

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

API Notes1

The document outlines the differences between APIs and web services, detailing communication protocols such as SOAP and REST, and the data formats used (XML and JSON). It describes various HTTP methods (GET, POST, PUT, PATCH, DELETE) and their respective functionalities, along with response codes and payloads. Additionally, it covers testing APIs using tools like Postman, the concept of microservices, and the use of Java for creating API interactions.

Uploaded by

vbksaran
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as ODT, PDF, TXT or read online on Scribd

API use protocol for communication

business logic

WebService 2 different apps communicate and exchange data


apis that are hosted on web publicly using http protocal
every webservice is api
every api not web service
XML language to communicate – extensible markup language

webservice is highly weighted – communication through xml


API – light weight – json
web serice 2types- SOAP and REST

where to follow soap – if protocol is XML b/w client n server (xml is high weighted) only post no
retrive
REST communication in any protocol -json/xml (client and server diff protocol)
URI – URL+endpoint

usually features of apps is hosted in common server and accessed by client

microservice (exposes api)– every service develop indipendently and hosted in different server and
accessed through client

in rest api – along with http also use ftp and smtp protocol
– with internet and without internet we can test

get – access data/resource


post – create data
put- full update
patch – update partial data
delete – delete data

request – http request to server


whatever request data is passed is called – request payload
in response – we have status code and status message
200-299 – success response
100-199- informational
300-399 – redirectional
400-499 – client issue
500-599 – server issue

response payload – data from server


resource – any information available on the server
endpoint – address of resouce from the server
BaseUrl/resource/endpoint path parameter query parameter
UNIT Testing and API testing
API – broader sco
GET – retrieve info from server - can be tested in browser also
POST – create resource on server, pass url/endpoint and
requesest payload and response code will come – 201 - created
JSON format javascript object notation – inside {} key value pairs
PUT – update the info in server
PATCH – partial update no update on server, only update and we cannot delete some structure
collection in postman- group of request

Datatypes for json

number
string
boolean
null
arrary
ctrl+c – stop the server command
javascript declaration

var x= 10
var a=”hello”

[Link](“hello”);

pm- default postman object


basic pattern for writing code in postman-BDD chain pattern
chai library - assertion
[Link]

variables in postman

global – lowest priority

in postman →
environment→globals→ pvalue, 2
{{variable name}}

collection - 2nd priority


environment - highest priority

collection variable → if some part of the end point is common then set as coll variable
select the part from endpoint and set as variable name collection variable scope collection
3 dots→run collection
RUN
[Link]
[Link]
[Link]
4,using newman – for reports
[Link] mocking/monitoring – similar to schedule
RestAssuered - class
Response – interface

bdd style to be followed


Given – request payload precondition (header,cookies,auth,path n query parameter)
when – all the request to be passed (get post put delete patch)
then – assersion, json body response, status code
In Java, static import concept is introduced in 1.5 version. With the help of static import, we
can access the static members of a class directly without class name or any object. For
Example: we always use sqrt() method of Math class by using Math class i.e. [Link](),
but by using static import we can access sqrt() method directly.

WebDriver driver=new

creating a driver session


request goes to the selenium server and session is created with cromebrowser
for every window a seperate session id is generated
default timeout for selenium webdriver 0.5s
cookies client side information about user
session – server info
while communicating with client n server communication happens through json
java object covert to JSOn – serialization
from server side when JSOn to original obj the deserialization
SDET – QA
path and resource is the endpoit
resource- articlename
to create own api – node js – npm – using npm instal json server
run the json file
generate json schema
tvvalidator- library

order of execution
local var – pre request script
give bearer token
csv file
save the json file
file/files – keyword
Digest – encrypted
Git hub→settings→developer settings
generate new token
API key has to be created

You might also like