SlideShare a Scribd company logo
REST API TEST
By Anil Upadhyay
Test Case Creation
• Understanding the functionality of the API program and
clearly define the scope of the program
• Apply testing techniques such as equivalence classes,
boundary value analysis, and error guessing and write test
cases for the API
• Input Parameters for the API need to be planned and
defined appropriately
• Execute the test cases and compare expected and actual
results.
Basic Practice of API Testing
• Test cases should be grouped by test category
• On top of each test, you should include the declarations of the APIs being
called.
• Parameters selection should be explicitly mentioned in the test case itself
• Prioritize API function calls so that it will be easy for testers to test
• Each test case should be as self-contained and independent from
dependencies as possible
• Call sequencing should be performed and well planned
• To ensure complete test coverage, create test cases for all possible input
combinations of the API.
Automated Testing of APIs
using Java
• Plain Old Java Object (POJO)
• Serialisation & Deserialisation
• Rest-assured
• Any Java Assert Library
POJO
• Plain Old Java Object (POJO): Pojo in Java stands for Plain Old Java Object and they are
used for increasing the readability and re-usability of a program. They are normal java
objects, unbounded by special restrictions, other than the ones forced by the Java
Language Specification.
• In simpler terms, Pojo is defined as a pure data structure, containing the getter and setter
fields. It has the ability to override certain methods from Object or an interface such as
Serializable.
• A POJO must not :
• Extend pre-specified classes: Ex- public class Test extends javax.servlet.http.HttpServlet is
not considered to be a POJO class.
• Contain pre-specified annotations: Ex- @javax.persistence.Entity public class Test{..} is not
a pojo class.
• Implement prespecified interfaces: Ex- public class Test implements javax.ejb.EntityBean {
… } is not considered to be a POJO class.
Serialisation &
Deserialisation
• Serialisation is a mechanism of converting the state of an object into a byte stream. Deserialisation is the reverse process
where the byte stream is used to recreate the actual Java object in memory. This mechanism is used to persist the object.
HTTP METHODS
• HTTP defines a set of request methods to indicate the
desired action to be performed for a given resource.
Although they can also be nouns, these request methods
are sometimes referred as HTTP verbs. Each of them
implements a different semantic, but some common
features are shared by a group of them: e.g. a request
method can be safe, idempotent, or cacheable.
• GET : The GET method requests a representation of the
specified resource. Requests using GET should only
retrieve data.
HTTP METHODS
• POST: The POST method is used to submit an entity to
the specified resource, often causing a change in state or
side effects on the server.
• PUT: The PUT method replaces all current
representations of the target resource with the request
payload.
• DELETE: The DELETE method deletes the specified
resource.
• PATCH: The PATCH method is used to apply partial
modifications to a resource.
HTTP HEADERS
• HTTP headers let the client and the server pass additional
information with an HTTP request or response. An HTTP
header consists of its case-insensitive name followed by a
colon (:), then by its value. Whitespace before the value is
ignored.
• Headers can be grouped according to their contexts:
• General headers apply to both requests and responses, but
with no relation to the data transmitted in the body.
• Request headers contain more information about the resource
to be fetched, or about the client requesting the resource.
HTTP HEADERS
• Response headers hold additional information about the
response, like its location or about the server providing it.
• Entity headers contain information about the body of the
resource, like its content length or MIME type.
IMPORTANT
HEADERS
• Authorization
• Contains the credentials to authenticate a user-agent with a
server.
• Connection
• Controls whether the network connection stays open after the
current transaction finishes.
• Keep-Alive
• Controls how long a persistent connection should stay open.
IMPORTANT
HEADERS
• Accept
• Informs the server about the types of data that can be sent back.
• Accept-Language
• Informs the server about the human language the server is expected to send back. This is a
hint and is not necessarily under the full control of the user: the server should always pay
attention not to override an explicit user choice (like selecting a language from a dropdown)
• Content-Length
• The size of the resource, in decimal number of bytes.
• Content-Type
• Indicates the media type of the resource.
• https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers
The GET Method
• GET is used to request data from a specified resource.
• GET is one of the most common HTTP methods.
• GET requests can be cached
• GET requests remain in the browser history
• GET requests can be bookmarked
• GET requests should never be used when dealing with sensitive data
• GET requests have length restrictions
• GET requests are only used to request data (not modify)
The GET Method
Syntax
GET /index.html
The POST Method
• The HTTP POST method sends data to the server. The type of the
body of the request is indicated by the Content-Type header.
• The difference between PUT and POST is that PUT is idempotent:
calling it once or several times successively has the same effect
(that is no side effect), where successive identical POST may have
additional effects, like passing an order several times.POST
requests are never cached
• POST requests do not remain in the browser history
• POST requests cannot be bookmarked
• POST requests have no restrictions on data length
The POST Method
POST /test HTTP/1.1
Host: foo.example
Content-Type: application/x-www-form-urlencoded
Content-Length: 27
field1=value1&field2=value2
The PUT Method
• The HTTP PUT request method creates a new resource or replaces a representation of the target
resource with the request payload.
• The difference between PUT and POST is that PUT is idempotent: calling it once or several times
successively has the same effect (that is no side effect), where successive identical POST may
have additional effects, like passing an order several times.
The DELETE Method
• The HTTP DELETE request method deletes the specified
resource.

More Related Content

Similar to restapitest-anil-200517181251.pdf

Servlet.ppt
Servlet.pptServlet.ppt
Servlet.ppt
kstalin2
 
Servlet1.ppt
Servlet1.pptServlet1.ppt
Servlet1.ppt
KhushalChoudhary14
 
Api security-testing
Api security-testingApi security-testing
Api security-testing
n|u - The Open Security Community
 
Best Practices in Web Service Design
Best Practices in Web Service DesignBest Practices in Web Service Design
Best Practices in Web Service DesignLorna Mitchell
 
Overview of REST - Raihan Ullah
Overview of REST - Raihan UllahOverview of REST - Raihan Ullah
Overview of REST - Raihan Ullah
Cefalo
 
Ch 3: Web Application Technologies
Ch 3: Web Application TechnologiesCh 3: Web Application Technologies
Ch 3: Web Application Technologies
Sam Bowne
 
CNIT 129S: Ch 3: Web Application Technologies
CNIT 129S: Ch 3: Web Application TechnologiesCNIT 129S: Ch 3: Web Application Technologies
CNIT 129S: Ch 3: Web Application Technologies
Sam Bowne
 
RESTful Services
RESTful ServicesRESTful Services
RESTful Services
Jason Gerard
 
CNIT 129S - Ch 3: Web Application Technologies
CNIT 129S - Ch 3: Web Application TechnologiesCNIT 129S - Ch 3: Web Application Technologies
CNIT 129S - Ch 3: Web Application Technologies
Sam Bowne
 
Overview of java web services
Overview of java web servicesOverview of java web services
6 Months Industrial Training in Spring Framework
6 Months Industrial Training in Spring Framework6 Months Industrial Training in Spring Framework
6 Months Industrial Training in Spring Framework
Arcadian Learning
 
(ATS6-PLAT04) Query service
(ATS6-PLAT04) Query service (ATS6-PLAT04) Query service
(ATS6-PLAT04) Query service
BIOVIA
 
ASP.NET Mvc 4 web api
ASP.NET Mvc 4 web apiASP.NET Mvc 4 web api
ASP.NET Mvc 4 web api
Tiago Knoch
 
REST & RESTful Web Service
REST & RESTful Web ServiceREST & RESTful Web Service
REST & RESTful Web Service
Hoan Vu Tran
 
API-Testing-SOAPUI-1.pptx
API-Testing-SOAPUI-1.pptxAPI-Testing-SOAPUI-1.pptx
API-Testing-SOAPUI-1.pptx
amarnathdeo
 
Mule soft RAML API Designing
Mule soft RAML API DesigningMule soft RAML API Designing
Mule soft RAML API Designing
Raja Reddy
 
Research Topics in Machine Hypermedia
Research Topics in Machine HypermediaResearch Topics in Machine Hypermedia
Research Topics in Machine Hypermedia
Michael Koster
 
SOAP vs REST
SOAP vs RESTSOAP vs REST
SOAP vs REST
Nadia Boumaza
 
RESTful HATEOAS standards using Java based Katharsis
RESTful HATEOAS standards using Java based KatharsisRESTful HATEOAS standards using Java based Katharsis
RESTful HATEOAS standards using Java based Katharsis
Keith Moore
 

Similar to restapitest-anil-200517181251.pdf (20)

Servlet.ppt
Servlet.pptServlet.ppt
Servlet.ppt
 
Servlet1.ppt
Servlet1.pptServlet1.ppt
Servlet1.ppt
 
Api security-testing
Api security-testingApi security-testing
Api security-testing
 
Best Practices in Web Service Design
Best Practices in Web Service DesignBest Practices in Web Service Design
Best Practices in Web Service Design
 
Overview of REST - Raihan Ullah
Overview of REST - Raihan UllahOverview of REST - Raihan Ullah
Overview of REST - Raihan Ullah
 
Ch 3: Web Application Technologies
Ch 3: Web Application TechnologiesCh 3: Web Application Technologies
Ch 3: Web Application Technologies
 
CNIT 129S: Ch 3: Web Application Technologies
CNIT 129S: Ch 3: Web Application TechnologiesCNIT 129S: Ch 3: Web Application Technologies
CNIT 129S: Ch 3: Web Application Technologies
 
RESTful Services
RESTful ServicesRESTful Services
RESTful Services
 
CNIT 129S - Ch 3: Web Application Technologies
CNIT 129S - Ch 3: Web Application TechnologiesCNIT 129S - Ch 3: Web Application Technologies
CNIT 129S - Ch 3: Web Application Technologies
 
Overview of java web services
Overview of java web servicesOverview of java web services
Overview of java web services
 
6 Months Industrial Training in Spring Framework
6 Months Industrial Training in Spring Framework6 Months Industrial Training in Spring Framework
6 Months Industrial Training in Spring Framework
 
(ATS6-PLAT04) Query service
(ATS6-PLAT04) Query service (ATS6-PLAT04) Query service
(ATS6-PLAT04) Query service
 
ASP.NET Mvc 4 web api
ASP.NET Mvc 4 web apiASP.NET Mvc 4 web api
ASP.NET Mvc 4 web api
 
REST & RESTful Web Service
REST & RESTful Web ServiceREST & RESTful Web Service
REST & RESTful Web Service
 
API-Testing-SOAPUI-1.pptx
API-Testing-SOAPUI-1.pptxAPI-Testing-SOAPUI-1.pptx
API-Testing-SOAPUI-1.pptx
 
Mule soft RAML API Designing
Mule soft RAML API DesigningMule soft RAML API Designing
Mule soft RAML API Designing
 
Java part 3
Java part  3Java part  3
Java part 3
 
Research Topics in Machine Hypermedia
Research Topics in Machine HypermediaResearch Topics in Machine Hypermedia
Research Topics in Machine Hypermedia
 
SOAP vs REST
SOAP vs RESTSOAP vs REST
SOAP vs REST
 
RESTful HATEOAS standards using Java based Katharsis
RESTful HATEOAS standards using Java based KatharsisRESTful HATEOAS standards using Java based Katharsis
RESTful HATEOAS standards using Java based Katharsis
 

More from mrle7

abc1.pptx
abc1.pptxabc1.pptx
abc1.pptx
mrle7
 
abc1.pptx
abc1.pptxabc1.pptx
abc1.pptx
mrle7
 
abc1.pptx
abc1.pptxabc1.pptx
abc1.pptx
mrle7
 
abc1.pptx
abc1.pptxabc1.pptx
abc1.pptx
mrle7
 
abc1.pptx
abc1.pptxabc1.pptx
abc1.pptx
mrle7
 
App Connect v12. Unit testing with a Pipeline Example. Trevor Dolby Architect...
App Connect v12. Unit testing with a Pipeline Example. Trevor Dolby Architect...App Connect v12. Unit testing with a Pipeline Example. Trevor Dolby Architect...
App Connect v12. Unit testing with a Pipeline Example. Trevor Dolby Architect...
mrle7
 

More from mrle7 (6)

abc1.pptx
abc1.pptxabc1.pptx
abc1.pptx
 
abc1.pptx
abc1.pptxabc1.pptx
abc1.pptx
 
abc1.pptx
abc1.pptxabc1.pptx
abc1.pptx
 
abc1.pptx
abc1.pptxabc1.pptx
abc1.pptx
 
abc1.pptx
abc1.pptxabc1.pptx
abc1.pptx
 
App Connect v12. Unit testing with a Pipeline Example. Trevor Dolby Architect...
App Connect v12. Unit testing with a Pipeline Example. Trevor Dolby Architect...App Connect v12. Unit testing with a Pipeline Example. Trevor Dolby Architect...
App Connect v12. Unit testing with a Pipeline Example. Trevor Dolby Architect...
 

Recently uploaded

Accpac to QuickBooks Conversion Navigating the Transition with Online Account...
Accpac to QuickBooks Conversion Navigating the Transition with Online Account...Accpac to QuickBooks Conversion Navigating the Transition with Online Account...
Accpac to QuickBooks Conversion Navigating the Transition with Online Account...
PaulBryant58
 
Global Interconnection Group Joint Venture[960] (1).pdf
Global Interconnection Group Joint Venture[960] (1).pdfGlobal Interconnection Group Joint Venture[960] (1).pdf
Global Interconnection Group Joint Venture[960] (1).pdf
Henry Tapper
 
FINAL PRESENTATION.pptx12143241324134134
FINAL PRESENTATION.pptx12143241324134134FINAL PRESENTATION.pptx12143241324134134
FINAL PRESENTATION.pptx12143241324134134
LR1709MUSIC
 
Brand Analysis for an artist named Struan
Brand Analysis for an artist named StruanBrand Analysis for an artist named Struan
Brand Analysis for an artist named Struan
sarahvanessa51503
 
Digital Transformation in PLM - WHAT and HOW - for distribution.pdf
Digital Transformation in PLM - WHAT and HOW - for distribution.pdfDigital Transformation in PLM - WHAT and HOW - for distribution.pdf
Digital Transformation in PLM - WHAT and HOW - for distribution.pdf
Jos Voskuil
 
Introduction to Amazon company 111111111111
Introduction to Amazon company 111111111111Introduction to Amazon company 111111111111
Introduction to Amazon company 111111111111
zoyaansari11365
 
India Orthopedic Devices Market: Unlocking Growth Secrets, Trends and Develop...
India Orthopedic Devices Market: Unlocking Growth Secrets, Trends and Develop...India Orthopedic Devices Market: Unlocking Growth Secrets, Trends and Develop...
India Orthopedic Devices Market: Unlocking Growth Secrets, Trends and Develop...
Kumar Satyam
 
Putting the SPARK into Virtual Training.pptx
Putting the SPARK into Virtual Training.pptxPutting the SPARK into Virtual Training.pptx
Putting the SPARK into Virtual Training.pptx
Cynthia Clay
 
20240425_ TJ Communications Credentials_compressed.pdf
20240425_ TJ Communications Credentials_compressed.pdf20240425_ TJ Communications Credentials_compressed.pdf
20240425_ TJ Communications Credentials_compressed.pdf
tjcomstrang
 
Meas_Dylan_DMBS_PB1_2024-05XX_Revised.pdf
Meas_Dylan_DMBS_PB1_2024-05XX_Revised.pdfMeas_Dylan_DMBS_PB1_2024-05XX_Revised.pdf
Meas_Dylan_DMBS_PB1_2024-05XX_Revised.pdf
dylandmeas
 
Affordable Stationery Printing Services in Jaipur | Navpack n Print
Affordable Stationery Printing Services in Jaipur | Navpack n PrintAffordable Stationery Printing Services in Jaipur | Navpack n Print
Affordable Stationery Printing Services in Jaipur | Navpack n Print
Navpack & Print
 
Sustainability: Balancing the Environment, Equity & Economy
Sustainability: Balancing the Environment, Equity & EconomySustainability: Balancing the Environment, Equity & Economy
Sustainability: Balancing the Environment, Equity & Economy
Operational Excellence Consulting
 
Search Disrupted Google’s Leaked Documents Rock the SEO World.pdf
Search Disrupted Google’s Leaked Documents Rock the SEO World.pdfSearch Disrupted Google’s Leaked Documents Rock the SEO World.pdf
Search Disrupted Google’s Leaked Documents Rock the SEO World.pdf
Arihant Webtech Pvt. Ltd
 
Taurus Zodiac Sign_ Personality Traits and Sign Dates.pptx
Taurus Zodiac Sign_ Personality Traits and Sign Dates.pptxTaurus Zodiac Sign_ Personality Traits and Sign Dates.pptx
Taurus Zodiac Sign_ Personality Traits and Sign Dates.pptx
my Pandit
 
What are the main advantages of using HR recruiter services.pdf
What are the main advantages of using HR recruiter services.pdfWhat are the main advantages of using HR recruiter services.pdf
What are the main advantages of using HR recruiter services.pdf
HumanResourceDimensi1
 
Premium MEAN Stack Development Solutions for Modern Businesses
Premium MEAN Stack Development Solutions for Modern BusinessesPremium MEAN Stack Development Solutions for Modern Businesses
Premium MEAN Stack Development Solutions for Modern Businesses
SynapseIndia
 
Attending a job Interview for B1 and B2 Englsih learners
Attending a job Interview for B1 and B2 Englsih learnersAttending a job Interview for B1 and B2 Englsih learners
Attending a job Interview for B1 and B2 Englsih learners
Erika906060
 
3.0 Project 2_ Developing My Brand Identity Kit.pptx
3.0 Project 2_ Developing My Brand Identity Kit.pptx3.0 Project 2_ Developing My Brand Identity Kit.pptx
3.0 Project 2_ Developing My Brand Identity Kit.pptx
tanyjahb
 
Pitch Deck Teardown: RAW Dating App's $3M Angel deck
Pitch Deck Teardown: RAW Dating App's $3M Angel deckPitch Deck Teardown: RAW Dating App's $3M Angel deck
Pitch Deck Teardown: RAW Dating App's $3M Angel deck
HajeJanKamps
 
chapter 10 - excise tax of transfer and business taxation
chapter 10 - excise tax of transfer and business taxationchapter 10 - excise tax of transfer and business taxation
chapter 10 - excise tax of transfer and business taxation
AUDIJEAngelo
 

Recently uploaded (20)

Accpac to QuickBooks Conversion Navigating the Transition with Online Account...
Accpac to QuickBooks Conversion Navigating the Transition with Online Account...Accpac to QuickBooks Conversion Navigating the Transition with Online Account...
Accpac to QuickBooks Conversion Navigating the Transition with Online Account...
 
Global Interconnection Group Joint Venture[960] (1).pdf
Global Interconnection Group Joint Venture[960] (1).pdfGlobal Interconnection Group Joint Venture[960] (1).pdf
Global Interconnection Group Joint Venture[960] (1).pdf
 
FINAL PRESENTATION.pptx12143241324134134
FINAL PRESENTATION.pptx12143241324134134FINAL PRESENTATION.pptx12143241324134134
FINAL PRESENTATION.pptx12143241324134134
 
Brand Analysis for an artist named Struan
Brand Analysis for an artist named StruanBrand Analysis for an artist named Struan
Brand Analysis for an artist named Struan
 
Digital Transformation in PLM - WHAT and HOW - for distribution.pdf
Digital Transformation in PLM - WHAT and HOW - for distribution.pdfDigital Transformation in PLM - WHAT and HOW - for distribution.pdf
Digital Transformation in PLM - WHAT and HOW - for distribution.pdf
 
Introduction to Amazon company 111111111111
Introduction to Amazon company 111111111111Introduction to Amazon company 111111111111
Introduction to Amazon company 111111111111
 
India Orthopedic Devices Market: Unlocking Growth Secrets, Trends and Develop...
India Orthopedic Devices Market: Unlocking Growth Secrets, Trends and Develop...India Orthopedic Devices Market: Unlocking Growth Secrets, Trends and Develop...
India Orthopedic Devices Market: Unlocking Growth Secrets, Trends and Develop...
 
Putting the SPARK into Virtual Training.pptx
Putting the SPARK into Virtual Training.pptxPutting the SPARK into Virtual Training.pptx
Putting the SPARK into Virtual Training.pptx
 
20240425_ TJ Communications Credentials_compressed.pdf
20240425_ TJ Communications Credentials_compressed.pdf20240425_ TJ Communications Credentials_compressed.pdf
20240425_ TJ Communications Credentials_compressed.pdf
 
Meas_Dylan_DMBS_PB1_2024-05XX_Revised.pdf
Meas_Dylan_DMBS_PB1_2024-05XX_Revised.pdfMeas_Dylan_DMBS_PB1_2024-05XX_Revised.pdf
Meas_Dylan_DMBS_PB1_2024-05XX_Revised.pdf
 
Affordable Stationery Printing Services in Jaipur | Navpack n Print
Affordable Stationery Printing Services in Jaipur | Navpack n PrintAffordable Stationery Printing Services in Jaipur | Navpack n Print
Affordable Stationery Printing Services in Jaipur | Navpack n Print
 
Sustainability: Balancing the Environment, Equity & Economy
Sustainability: Balancing the Environment, Equity & EconomySustainability: Balancing the Environment, Equity & Economy
Sustainability: Balancing the Environment, Equity & Economy
 
Search Disrupted Google’s Leaked Documents Rock the SEO World.pdf
Search Disrupted Google’s Leaked Documents Rock the SEO World.pdfSearch Disrupted Google’s Leaked Documents Rock the SEO World.pdf
Search Disrupted Google’s Leaked Documents Rock the SEO World.pdf
 
Taurus Zodiac Sign_ Personality Traits and Sign Dates.pptx
Taurus Zodiac Sign_ Personality Traits and Sign Dates.pptxTaurus Zodiac Sign_ Personality Traits and Sign Dates.pptx
Taurus Zodiac Sign_ Personality Traits and Sign Dates.pptx
 
What are the main advantages of using HR recruiter services.pdf
What are the main advantages of using HR recruiter services.pdfWhat are the main advantages of using HR recruiter services.pdf
What are the main advantages of using HR recruiter services.pdf
 
Premium MEAN Stack Development Solutions for Modern Businesses
Premium MEAN Stack Development Solutions for Modern BusinessesPremium MEAN Stack Development Solutions for Modern Businesses
Premium MEAN Stack Development Solutions for Modern Businesses
 
Attending a job Interview for B1 and B2 Englsih learners
Attending a job Interview for B1 and B2 Englsih learnersAttending a job Interview for B1 and B2 Englsih learners
Attending a job Interview for B1 and B2 Englsih learners
 
3.0 Project 2_ Developing My Brand Identity Kit.pptx
3.0 Project 2_ Developing My Brand Identity Kit.pptx3.0 Project 2_ Developing My Brand Identity Kit.pptx
3.0 Project 2_ Developing My Brand Identity Kit.pptx
 
Pitch Deck Teardown: RAW Dating App's $3M Angel deck
Pitch Deck Teardown: RAW Dating App's $3M Angel deckPitch Deck Teardown: RAW Dating App's $3M Angel deck
Pitch Deck Teardown: RAW Dating App's $3M Angel deck
 
chapter 10 - excise tax of transfer and business taxation
chapter 10 - excise tax of transfer and business taxationchapter 10 - excise tax of transfer and business taxation
chapter 10 - excise tax of transfer and business taxation
 

restapitest-anil-200517181251.pdf

  • 1. REST API TEST By Anil Upadhyay
  • 2. Test Case Creation • Understanding the functionality of the API program and clearly define the scope of the program • Apply testing techniques such as equivalence classes, boundary value analysis, and error guessing and write test cases for the API • Input Parameters for the API need to be planned and defined appropriately • Execute the test cases and compare expected and actual results.
  • 3. Basic Practice of API Testing • Test cases should be grouped by test category • On top of each test, you should include the declarations of the APIs being called. • Parameters selection should be explicitly mentioned in the test case itself • Prioritize API function calls so that it will be easy for testers to test • Each test case should be as self-contained and independent from dependencies as possible • Call sequencing should be performed and well planned • To ensure complete test coverage, create test cases for all possible input combinations of the API.
  • 4. Automated Testing of APIs using Java • Plain Old Java Object (POJO) • Serialisation & Deserialisation • Rest-assured • Any Java Assert Library
  • 5. POJO • Plain Old Java Object (POJO): Pojo in Java stands for Plain Old Java Object and they are used for increasing the readability and re-usability of a program. They are normal java objects, unbounded by special restrictions, other than the ones forced by the Java Language Specification. • In simpler terms, Pojo is defined as a pure data structure, containing the getter and setter fields. It has the ability to override certain methods from Object or an interface such as Serializable. • A POJO must not : • Extend pre-specified classes: Ex- public class Test extends javax.servlet.http.HttpServlet is not considered to be a POJO class. • Contain pre-specified annotations: Ex- @javax.persistence.Entity public class Test{..} is not a pojo class. • Implement prespecified interfaces: Ex- public class Test implements javax.ejb.EntityBean { … } is not considered to be a POJO class.
  • 6. Serialisation & Deserialisation • Serialisation is a mechanism of converting the state of an object into a byte stream. Deserialisation is the reverse process where the byte stream is used to recreate the actual Java object in memory. This mechanism is used to persist the object.
  • 7. HTTP METHODS • HTTP defines a set of request methods to indicate the desired action to be performed for a given resource. Although they can also be nouns, these request methods are sometimes referred as HTTP verbs. Each of them implements a different semantic, but some common features are shared by a group of them: e.g. a request method can be safe, idempotent, or cacheable. • GET : The GET method requests a representation of the specified resource. Requests using GET should only retrieve data.
  • 8. HTTP METHODS • POST: The POST method is used to submit an entity to the specified resource, often causing a change in state or side effects on the server. • PUT: The PUT method replaces all current representations of the target resource with the request payload. • DELETE: The DELETE method deletes the specified resource. • PATCH: The PATCH method is used to apply partial modifications to a resource.
  • 9. HTTP HEADERS • HTTP headers let the client and the server pass additional information with an HTTP request or response. An HTTP header consists of its case-insensitive name followed by a colon (:), then by its value. Whitespace before the value is ignored. • Headers can be grouped according to their contexts: • General headers apply to both requests and responses, but with no relation to the data transmitted in the body. • Request headers contain more information about the resource to be fetched, or about the client requesting the resource.
  • 10. HTTP HEADERS • Response headers hold additional information about the response, like its location or about the server providing it. • Entity headers contain information about the body of the resource, like its content length or MIME type.
  • 11. IMPORTANT HEADERS • Authorization • Contains the credentials to authenticate a user-agent with a server. • Connection • Controls whether the network connection stays open after the current transaction finishes. • Keep-Alive • Controls how long a persistent connection should stay open.
  • 12. IMPORTANT HEADERS • Accept • Informs the server about the types of data that can be sent back. • Accept-Language • Informs the server about the human language the server is expected to send back. This is a hint and is not necessarily under the full control of the user: the server should always pay attention not to override an explicit user choice (like selecting a language from a dropdown) • Content-Length • The size of the resource, in decimal number of bytes. • Content-Type • Indicates the media type of the resource. • https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers
  • 13. The GET Method • GET is used to request data from a specified resource. • GET is one of the most common HTTP methods. • GET requests can be cached • GET requests remain in the browser history • GET requests can be bookmarked • GET requests should never be used when dealing with sensitive data • GET requests have length restrictions • GET requests are only used to request data (not modify)
  • 15. The POST Method • The HTTP POST method sends data to the server. The type of the body of the request is indicated by the Content-Type header. • The difference between PUT and POST is that PUT is idempotent: calling it once or several times successively has the same effect (that is no side effect), where successive identical POST may have additional effects, like passing an order several times.POST requests are never cached • POST requests do not remain in the browser history • POST requests cannot be bookmarked • POST requests have no restrictions on data length
  • 16. The POST Method POST /test HTTP/1.1 Host: foo.example Content-Type: application/x-www-form-urlencoded Content-Length: 27 field1=value1&field2=value2
  • 17. The PUT Method • The HTTP PUT request method creates a new resource or replaces a representation of the target resource with the request payload. • The difference between PUT and POST is that PUT is idempotent: calling it once or several times successively has the same effect (that is no side effect), where successive identical POST may have additional effects, like passing an order several times.
  • 18. The DELETE Method • The HTTP DELETE request method deletes the specified resource.