SlideShare a Scribd company logo
UNDERSTANDING AND TESTING
RESTFUL WEB SERVICES
PLEASE INSTALL
POSTMAN - REST Client
POSTMAN Interceptor
www.getpostman.com
www.getpostman.com/features#interceptor
Created by /Mark Winteringham @mwtestconsult
ABOUT ME...
-
-
-
www.mwtestconsultancy.co.uk
@mwtestconsult
linkedin.com/in/markwinteringham
WORKSHOP GOALS
Explore the basics of a RESTful WebServices
Build requests to query and manipulate data
Try out different test design techniques
Going forward with the skills you've learnt
WELCOME TO 'THE BEST AT REST LTD'
Creators of RESTFUL-BOOKER
A restful webservice that allows hotels
to store booking details about their
guests
RESTFUL-BOOKER REQUIREMENTS
1. Must be able to create, read, update and
delete bookings
2. Bookings must be searchable
3. Bookings must store the following items
Guests name
The price of their booking
Whether they have paid a deposit
The dates of their booking
Any additional needs
GITHUB REPOS
Restful booker:
Slides:
www.github.com/mwinteringham/restful-booker
www.github.com/mwinteringham/reveal.js
POSTMAN
Our test tool for the workshop
RESTFUL WEB SERVICE
WEB SERVICE
'A Web service is a software system designed to support
interoperable machine-to-machine interaction over a network.'
http://www.w3.org/TR/2004/NOTE-ws-gloss-20040211/#webservice
Mobile to Web Service
UI Backend
Web Service to Web Service
Reports Search
A service-oriented architecture
WHAT MAKES A SERVICE RESTFUL?
Stateless
Cacheable
Uniform Interface
Client-Server
Layered System
Code on Demand
Identify a resource
Manipulate a resource
URIs
HTTP
A web service has to use
specific standards to:
http://c2.com/cgi/wiki?RestArchitecturalStyle
A RESTFUL WEB SERVICE EXAMPLE
http://adrianmejia.com/blog/2014/10/01/creating-a-restful-api-tutorial-with-nodejs-and-mongodb/
REST-REPORTER
https://github.com/mwinteringham/restful-booker
rest-reporter is a C.R.U.D. service
CREATE
READ
UPDATE
DELETE
READ
A TYPICAL HTTP READ REQUEST
URI Path
RI Host
UNIFORM RESOURCE IDENTIFIERS
Resource
Booking resource 1
_id:
5534e8cdbb97c77e0eb7ae51
Something the service exposes to
the end user to interact with such
as an image, video, html, text, etc.
GET /booking/5534e8cdbb97c77e0eb7ae51
UNIFORM RESOURCE IDENTIFIERS
scheme ://host :port /resource ?queryString
http://localhost:3001/booking?name=mary
QUERY STRINGS
A query string indicates additional actions you might
want to apply to the resource/resources you want
Returns all bookings between two dates whereas:
GET /booking?checkin=2014-03-13&checkout=2014-05-21
Returns all the bookings
GET /booking
CREATING QUERY STRINGS
Query strings start with a ? after the resource path
Are declared as key=value
Multiple query declarations are joined using &
For example:
GET /booking?checkin=2014-03-13&checkout=2014-05-21
A TYPICAL HTTP READ REQUEST
HTTP Verb
HTTP VERBS
HTTP methods indicate an action the user would like to
do on a resource
CREATE = POST
READ = GET
UPDATE = PUT
DELETE = DELETE
VERBS IN ACTION
GET - Returns current bookings
POST - Creates a new booking
http://localhost:3001/booking
http://localhost:3001/booking
OPTION http://localhost:3001/booking
Returns which Verbs can be used on a URI
A TYPICAL HTTP READ REQUEST
eaders
HTTP HEADERS
Define the operating parameters of an HTTP request such as:
What is requesting the resource
What format the resource should be in
Authorisation that the resource can be requested
And more: https://en.wikipedia.org/wiki/List_of_HTTP_header_fields
HTTP HEADERS
Adding headers can alter the behaviour of the service and its response
Key: Value Outcome
Accept: application/json JSON is returned
Accept: application/xml XML is returned
A TYPICAL HTTP RESPONSE
HTTP Status code
HTTP STATUS CODES
Indicator of how the server has responded to the request you've sent
1xx Informational
2xx Success
3xx Redirection
4xx Client Error
5xx Server Error
https://en.wikipedia.org/wiki/List_of_HTTP_status_codes
TYPICAL HTTP STATUS CODES
200 Server has carried out its actions successfully
404 URI path doesn't exist
403 You're not authorised to access the path
500 Server error
503 Service is unavailable
A TYPICAL HTTP RESPONSE
Payload
TYPES OF PAYLOADS
JSON
id":"5534e8cdbb97c77e0eb7ae65",
irstName":"Jim",
astName":"Wilson",
otalPrice":787,
epositPaid":false,
dditionalNeeds": "Breakfast",
ookingDates":{
"checkIn":"2013-08-10T22:34:22",
"checkOut":"2015-03-23T14:00:00"
XML
<_id>5534e8cdbb97c77e0eb7ae65</_id>
<firstName>Jim</firstName>
<lastName>Wilson</lastName>
<totalPrice>787</totalPrice>
<depositPaid>false</depositPaid>
<additionalNeeds>Breakfast</additionalNeeds
>
<bookingDates>
<checkIn>2013-08-10T22:34:22</checkIn>
<checkOut>2015-03-23T14:00:00</checkOut
>
</bookingDates>
HTML
<p>5534e8cdbb97c77e0eb7ae65</p>
<p>Jim</p>
<p>Wilson</p>
<p>787</p>
<p>false</p>
<p>breakfast</p>
<ul>
<li>2013-08-10T22:34:22</li>
<li>2015-03-23T14:00:00</li>
</ul>
ITERATION ONE - INVESTIGATING READ
USERS STORIES
As a user of restful-booker
I want to be able to view all
current booking IDs
So that I can choose an ID to view
the booking of
GET /booking
As a user of restful-booker
I want to be able to search on the
booking dates
So that I can filter the relevant
booking IDs I require
GET /booking?
checkin=*&checkout=*
As a user of restful-booker
I want to be able to retrieve a
booking using its ID
So that I can view the details of
that booking
GET /booking/{id}
API can be found at: github.com/mwinteringham/restful-booker
What did you learn?
CREATE
A TYPICAL HTTP CREATE REQUEST
Change in HTTP Verb
ayload
PAYLOAD
A representation of the resource you want to create
through the service
The parameters and the structure of the payload have
strict rules.
Which can also be known as a 'contract'
XML PAYLOADS
<booking>
<firstName>Mark</firstName>
<lastName>test</lastName>
<totalPrice>300.00</totalPrice>
<depositPaid>true</depositPaid>
<additionalNeeds>Breakfast</additionalNeeds>
<bookingDates>
<checkIn>11/11/2014</checkIn>
<checkOut>12/11/2014</checkOut>
</bookingDates>
</booking>
https://en.wikipedia.org/wiki/XML
JSON PAYLOADS
{
"firstName": "Mark",
"lastName": "test",
"totalPrice": 300.00,
"depositPaid": true,
"additionalNeeds": "Breakfast",
"bookingDates": {
"checkIn": "11/11/2014",
"checkOut": "12/11/2014"
}
}
http://json.org/
DATA TYPES
{
"firstName": "Mark",
"lastName": "test",
"totalPrice": 300.00,
"depositPaid": true,
"additionalNeeds": "Breakfast",
"bookingDates": {
"checkIn": "11/11/2014",
"checkOut": "12/11/2014"
}
}
String
Number
Boolean
Dates (String)
ROBUSTNESS PRINCIPLE
`Be conservative in what you do, be liberal in what you accept from others`
Postel's law
When sending a payload the service should conform to the contract being sent
When receiving a payload the service should accept invalid data without error
POST RELATED HEADERS
Key Value
Content-Type: application/json, text/xml
Content-Length: 157
ITERATION TWO - INVESTIGATING
CREATE
USER STORIES
As a user of restful-booker
I want to be able to create
So that I can choose an ID to view
the booking of
POST /booking
API can be found at: github.com/mwinteringham/restful-booker
What did you learn?
UPDATE/DELETE
AUTHORISATION
Services generally have one or more layers of security
such as:
Basic access authentication
Cookie based authentication
This isn't an exhaustive list
There may be other layers of security in place
HTTP HEADERS - COOKIES
Cookies are also a type of header and can be added to a
request
Cookie: COOKIEVAL1=abc; COOKIEVAL2=def;
BASIC ACCESS AUTHENTICATION
Comes in the form of a header
Authorization Basic Base64(username:password)
Authorization Basic dXNlcm5hbWU6cGFzc3dvcmQ=
https://en.wikipedia.org/wiki/Basic_access_authentication
COOKIE BASED AUTHENTICATION
POST /auth
{
username: admin,
password: password123
}
Response
Set-Cookie: token=abc123
DELETE
/booking/{id}
Cookie: token=abc123
PUT
Similar to POST but rather than create it updates
However, in the real world that might not be the case:
PUT vs POST in REST
DELETE
Similar to GET but it deletes rather than reads the
resource
ITERATION THREE - INVESTIGATING
UPDATE / DELETE
USER STORIES
As a user of restful-booker
I want to be able to protect create
and delete functions
So that I can protect the bookings
from being changed or deleted
POST /auth
As a user of restful-booker
I want to be able to update a pre-
existing booking using its ID
So that I can correct and errors
made in a booking
PUT /booking/{id}
As a user of restful-booker
I want to be able to delete a
booking using its ID
So that I can remove the booking
DELETE /booking/{id}
API can be found at: github.com/mwinteringham/restful-booker
What did you learn?
TAKING RESTFUL TESTING FURTHER
Mobile to Web Service
UI
UI testing
Backend
RESTful testing
AUTOMATION?
WRAPPING UP
THANK YOU
Restful-booker - https://github.com/mwinteringham/restful-booker
Slides - https://github.com/mwinteringham/reveal.js

More Related Content

PPTX
40+ tips to use Postman more efficiently
PDF
The never-ending REST API design debate
PPTX
RESTful API Automation with JavaScript
PDF
RESTful Web Services
PPTX
REST API Design & Development
PDF
Best Practices in Web Service Design
PDF
Rest api design by george reese
PPSX
Rest api standards and best practices
40+ tips to use Postman more efficiently
The never-ending REST API design debate
RESTful API Automation with JavaScript
RESTful Web Services
REST API Design & Development
Best Practices in Web Service Design
Rest api design by george reese
Rest api standards and best practices

What's hot (20)

KEY
Web API Basics
PPTX
PDF
How to build a rest api.pptx
PPTX
Understanding REST APIs in 5 Simple Steps
PPTX
Postman Collection Format v2.0 (pre-draft)
PPTX
An Introduction To REST API
PPTX
REST API Best Practices & Implementing in Codeigniter
PPTX
RESTful API - Best Practices
PPTX
ASP.NET WEB API Training
PDF
Restful api design
PDF
What is REST API? REST API Concepts and Examples | Edureka
PDF
Testing REST Web Services
PPTX
Frisby Api automation
PPTX
Test in Rest. API testing with the help of Rest Assured.
PPTX
RESTful API Design Best Practices Using ASP.NET Web API
PDF
Doing REST Right
PPTX
Implementation advantages of rest
PPTX
Web API testing : A quick glance
PDF
REST API and CRUD
PPTX
Restful webservices
Web API Basics
How to build a rest api.pptx
Understanding REST APIs in 5 Simple Steps
Postman Collection Format v2.0 (pre-draft)
An Introduction To REST API
REST API Best Practices & Implementing in Codeigniter
RESTful API - Best Practices
ASP.NET WEB API Training
Restful api design
What is REST API? REST API Concepts and Examples | Edureka
Testing REST Web Services
Frisby Api automation
Test in Rest. API testing with the help of Rest Assured.
RESTful API Design Best Practices Using ASP.NET Web API
Doing REST Right
Implementation advantages of rest
Web API testing : A quick glance
REST API and CRUD
Restful webservices
Ad

Similar to Understanding and testing restful web services (20)

PDF
Simplify QA Automation: Master API Testing with HTTPClient in C#
PDF
RefCard RESTful API Design
PDF
Automating Cloud Operations: Everything You Wanted to Know about cURL and REST
PPT
RESTful services
PPTX
Azure AD B2C Webinar Series: Custom Policies Part 1
PDF
.NET Core, ASP.NET Core Course, Session 19
PPTX
Rest WebAPI with OData
PDF
Oauth Nightmares Abstract OAuth Nightmares
PPTX
How to build Simple yet powerful API.pptx
PPTX
Rest & RESTful WebServices
PPTX
Restful api
PDF
[drupalday2017] - Drupal come frontend che consuma servizi: HTTP Client Manager
PDF
Protecting your APIs with OAuth 2.0
PPTX
HTTP fundamentals for developers
PDF
What the Heck is OAuth and OIDC - UberConf 2018
PPT
RESTful SOA - 中科院暑期讲座
PPTX
(4) OAuth 2.0 Obtaining Authorization
PPTX
SCWCD : Session management : CHAP : 6
PDF
API_Testing_with_Postman
PPTX
APIs_ An Introduction.pptx
Simplify QA Automation: Master API Testing with HTTPClient in C#
RefCard RESTful API Design
Automating Cloud Operations: Everything You Wanted to Know about cURL and REST
RESTful services
Azure AD B2C Webinar Series: Custom Policies Part 1
.NET Core, ASP.NET Core Course, Session 19
Rest WebAPI with OData
Oauth Nightmares Abstract OAuth Nightmares
How to build Simple yet powerful API.pptx
Rest & RESTful WebServices
Restful api
[drupalday2017] - Drupal come frontend che consuma servizi: HTTP Client Manager
Protecting your APIs with OAuth 2.0
HTTP fundamentals for developers
What the Heck is OAuth and OIDC - UberConf 2018
RESTful SOA - 中科院暑期讲座
(4) OAuth 2.0 Obtaining Authorization
SCWCD : Session management : CHAP : 6
API_Testing_with_Postman
APIs_ An Introduction.pptx
Ad

Recently uploaded (20)

PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PPTX
Cloud computing and distributed systems.
PDF
Encapsulation theory and applications.pdf
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PPTX
Big Data Technologies - Introduction.pptx
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PPTX
sap open course for s4hana steps from ECC to s4
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
Per capita expenditure prediction using model stacking based on satellite ima...
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
The Rise and Fall of 3GPP – Time for a Sabbatical?
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Advanced methodologies resolving dimensionality complications for autism neur...
Cloud computing and distributed systems.
Encapsulation theory and applications.pdf
Reach Out and Touch Someone: Haptics and Empathic Computing
Encapsulation_ Review paper, used for researhc scholars
Unlocking AI with Model Context Protocol (MCP)
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
“AI and Expert System Decision Support & Business Intelligence Systems”
Big Data Technologies - Introduction.pptx
NewMind AI Weekly Chronicles - August'25 Week I
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
MIND Revenue Release Quarter 2 2025 Press Release
sap open course for s4hana steps from ECC to s4
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Mobile App Security Testing_ A Comprehensive Guide.pdf

Understanding and testing restful web services