0% found this document useful (0 votes)
5 views8 pages

API Notes

The document outlines the differences between APIs and web services, highlighting that all web services are APIs, but not all APIs are web services. It explains the communication protocols used, such as SOAP and REST, and details the various HTTP methods for interacting with resources. Additionally, it covers testing methodologies for APIs, including unit testing and the use of tools like Postman for managing requests and variables.

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)
5 views8 pages

API Notes

The document outlines the differences between APIs and web services, highlighting that all web services are APIs, but not all APIs are web services. It explains the communication protocols used, such as SOAP and REST, and details the various HTTP methods for interacting with resources. Additionally, it covers testing methodologies for APIs, including unit testing and the use of tools like Postman for managing requests and variables.

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

You might also like