RESTful applications: The why and how by Maikel Mardjan

Jexia
JexiaJexia
1
#buildtogether
RESTful applications and Angular: The why and how
Author : Maikel Mardjan
Date : 24 February 2016
© 2016 Jexia Company
This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.
2
Whoami?
Maikel Mardjan:
More than 20 years experience within IT
(System) Development. Worked as IT
Architect, Integrator, SW Developer. Now
working as developer for Jexia.com to
create the best developer tools around.
Struggled but won serious integration fights
using CORBA, RPCs, SOA, WSDLs.
https://nl.linkedin.com/in/maikelmardjan
@maikelmardjan
Questions? Please contact me!
3
About this talk
4
Agenda:REST: What, Why, How?
 Essence of REST
 How does REST work?
 Designing RESTful APIs
 Advantages and Disadvantages of REST
 Tools to work with REST
 Summary
5
Why REST?
Defining, creating and managing application integration through APIs is
(was) hard!
Our needs / challenges / opportunities today:
Currently almost all new released software systems contains REST interfaces for
usage and/or control
SOAP
integration
6
Why REST?
Defining, creating and managing application integration through APIs is (was) hard!
Our needs today:
● We need a simpler why to connect to (different) Cloud based services. SOAP and
WSDL-based interfaces were not that simple.
● We have a large range of devices of different vendors to integrate with (data)
backends (phones, watches, smartTVs, Navigation devices, etc).
● All large software cooperations (Google, Yahoo and Microsoft etc) have deprecated
SOAP and WSDL-based interfaces in favor of REST services to expose their services.
RESTful interfacing is easier, simpler and encourage information usage and sharing!
Currently almost all new released software systems contains REST interfaces for usage
and/or control.
7
Why REST? (2)
Almost all large services today allow interacting/integration
by the use of RESTful APIs. Some examples:
8
REST: So what is it really all about?
Representational State Transfer (REST):
 Architecture style for designing and implementing
networked applications.
 Lightweight alternative to mechanisms like RPC (Remote
Procedure Calls) and SOAP Web Services.
 REST is based on the HTTP specification.
Despite being simple, REST is not limited in usage!
9
The REST standard?
By default REST is not a "standard"!
Do we need a standard for REST?
10
The REST standard? (2)
By default REST is not a "standard"!
The current leading initiative to standardize REST
descriptions is currently a project from the Linux
Foundation organization (See https://openapis.org/ )
11
Basic REST elements
Data element : pizzaHawaii
Resource : pizza, book, user, ticket etc
Resource identifier : URI , URN ( /pizzatype/34)
Data representation : JSON, txt, htmlt, XML, YAML etc
Metadata : content type, last-modified time
REST
(HTTP based integration)Verbs (GET,
POST, PUT, etc)
Representations
(Json, XML, etc)
Nouns (Resources) /order/pizza/45
12
Working of REST (3)
Method RFC Description
GET Transfer a current representation of the target resource.
HEAD Same as GET, but only transfer the status line and header
section.
POST Perform resource-specific processing on the request payload.
PUT Replace all current representations of the target resource with
the request payload.
DELETE Remove all current representations of the target resource.
CONNECT Establish a tunnel to the server identified by the target resource.
OPTIONS Describe the communication options for the target resource.
TRACE Perform a message loop-back test along the path to the target
resource.
Good REST services should use the HTTP methods correctly. This means as defined
by RFC 7231.
13
Working of REST
14
Sample mockup
A simple task application with RESTful interfaces:
 GET /tasks – display all tasks
 POST /tasks – Create a new task
 GET /tasks/{id} display a task with id
 PUT /tasks/{id} – Update a task with id
 DELETE /tasks/{id} – Delete a tasks with id
When using REST calls to your data you can often make use of
data query options. These can be used to find, filter and sort the
output from your dataset.
15
Designing RESTful APIs
Designing RESTful APIs is easy:
● To create a resource on the server, use POST.
● To retrieve a resource, use GET.
● To change the state of a resource or to update it, use PUT.
● To remove or delete a resource, use DELETE.
16
Designing RESTful APIs (2)
REST interfaces are defined through the URL or URI:
17
Designing RESTful APIs
Some simple design guidelines:
● Queries should not return an overload of data. If needed, provide a
paging mechanism.
● Even though the REST response can be anything, make sure it's well
documented (and do not change the output format since it will break
existing clients).
● GET access requests should never cause a state change.
● All communication is done by representation (e.g. XML/JSON). By
default JSON is the preferred representation to use.
● Be Stateless. Stateless ( Each request from any client contains all the
information. So all HTTP methods like caching and load-balance can be
used).
18
Business Advantages when using REST?
Why should you (again) use something new?
What is the business value for you?
Why should you use RESTful services?
19
Advantages of REST
● REST is 'light weight'. (Easy to develop, test, etc)
● Network and security friendly (e.g. firewalls, caching,
stateless, configuration, IDPS possible, no confusion on
wire-protocol)
● Human readable results since basic HTTP-based methods
are used with JSON. (when you choose to use json, why
not?)
● No hard coupling between client-server. Create your RESTful
client in the programming language you want!
20
Disadvantages of REST
REST is no solution for every use case!
So when not to use RESTful APIs?
21
Disadvantages of REST
● Changing REST interfaces and Versioning: If not done well:payloads tend to grow over
time for all clients.
● REST endpoints are usually weakly-typed and lack machine-readable metadata. So use
strong typing when possible!
● No single standard exist for RESTful interfaces. Consequence is that depending on the
service request/response behavior can be different than expected.
● Most REST systems of any complexity end up with large amounts of endpoints. Getting
familiar with all these endpoint and interacting with the correct endpoints can become
hard.
● Doing chained transactions over different REST endpoints providers can become difficult
and can become complex too. (But with good design it is possible!)
● RESTful interfacing can have a large impact on network load. (REST with video, audio, big-
data files …) Sometimes using pure ftp-protocol is not that bad...
● REST is hard to use when fetching complicated object graphs that require multiple round
trips between the client and server to render single views.
22
Tools to work with REST
Use the right tool for the job. Working with RESTful interfaces
requires of always testing interfaces. Some tool examples:
● cURL (The defacto CLI tool for years!) (
https://curl.haxx.se/docs/)
● wget
● HTTPIE (Python CLI, http://httpie.org )
● REST Easy (A firefox plugin)
● Postman (Chrome extensions or standalone)
23
Questions / Discussion
#BuildTogether
24
Summary
 Essence of REST
 How does REST work?
 Designing RESTful APIs
 Advantages and Disadvantages of REST
 Tools to work with REST
25
Appendix: Designing RESTful APIs (2)
REST interfaces are defined through the URL or URI:
 URN: Universal Resource Name
 Name of a resource in-depended of a specific location
 URL: Uniform Resource LOCATION
 Provides access to a specific representation of a resource on the
network.
 Example: https://myapp.jexia.com/mypizza?ordernumber=60
 Example:https://myapp.jexia.com/mypizza/ordernumber/60
 URI: Uniform Resource IDENTIFIER (can be URL or URN)
 Identifies a specific resource on the network
 Example: https://myapp.jexia.com/mypizza
 mailto:<questions@jexia.com>
1 of 25

Recommended

Taking ownership of the challenges and problems of owning a grotty API and tu... by
Taking ownership of the challenges and problems of owning a grotty API and tu...Taking ownership of the challenges and problems of owning a grotty API and tu...
Taking ownership of the challenges and problems of owning a grotty API and tu...Jexia
616 views30 slides
Patrick Debois - From Serverless to Servicefull by
Patrick Debois - From Serverless to ServicefullPatrick Debois - From Serverless to Servicefull
Patrick Debois - From Serverless to ServicefullServerlessConf
1.9K views95 slides
The art of decomposing monoliths - Kfir Bloch - Codemotion Amsterdam 2016 by
The art of decomposing monoliths - Kfir Bloch - Codemotion Amsterdam 2016The art of decomposing monoliths - Kfir Bloch - Codemotion Amsterdam 2016
The art of decomposing monoliths - Kfir Bloch - Codemotion Amsterdam 2016Codemotion
522 views58 slides
Codemotion Amsterdam 2016 - The DevOps Disaster by
Codemotion Amsterdam 2016 - The DevOps DisasterCodemotion Amsterdam 2016 - The DevOps Disaster
Codemotion Amsterdam 2016 - The DevOps DisasterBert Jan Schrijver
323 views30 slides
Engage 2019 - De04. Java with Domino After XPages by
Engage 2019 - De04. Java with Domino After XPagesEngage 2019 - De04. Java with Domino After XPages
Engage 2019 - De04. Java with Domino After XPagesJesse Gallagher
620 views28 slides
Angular vs React - Devoxx BE 2017 by
Angular vs React - Devoxx BE 2017Angular vs React - Devoxx BE 2017
Angular vs React - Devoxx BE 2017Deepu K Sasidharan
619 views63 slides

More Related Content

What's hot

Delivery Free of Charge by
Delivery Free of ChargeDelivery Free of Charge
Delivery Free of ChargeAll Things Open
672 views13 slides
Common blind spots on the journey to production vijay raghavan aravamudhan by
Common blind spots on the journey to production  vijay raghavan aravamudhanCommon blind spots on the journey to production  vijay raghavan aravamudhan
Common blind spots on the journey to production vijay raghavan aravamudhanXP Conference India
496 views26 slides
Getting out of the monolith hell by
Getting out of the monolith hellGetting out of the monolith hell
Getting out of the monolith hellmimmozzo_
179 views90 slides
DocOps: Agile Content Development In Practice - Nils Bier, tekom Jahrestagung... by
DocOps: Agile Content Development In Practice - Nils Bier, tekom Jahrestagung...DocOps: Agile Content Development In Practice - Nils Bier, tekom Jahrestagung...
DocOps: Agile Content Development In Practice - Nils Bier, tekom Jahrestagung...K15t
574 views43 slides
Building Highly Scalable Apps On Bluemix by
Building Highly Scalable Apps On BluemixBuilding Highly Scalable Apps On Bluemix
Building Highly Scalable Apps On BluemixRyan Baxter
1.6K views28 slides
Red Hat Forum London 2014 - Delivering Innovation at Speed, A JBoss Perspective by
Red Hat Forum London 2014 - Delivering Innovation at Speed, A JBoss PerspectiveRed Hat Forum London 2014 - Delivering Innovation at Speed, A JBoss Perspective
Red Hat Forum London 2014 - Delivering Innovation at Speed, A JBoss PerspectiveJeremy Brown
693 views27 slides

What's hot(20)

Common blind spots on the journey to production vijay raghavan aravamudhan by XP Conference India
Common blind spots on the journey to production  vijay raghavan aravamudhanCommon blind spots on the journey to production  vijay raghavan aravamudhan
Common blind spots on the journey to production vijay raghavan aravamudhan
Getting out of the monolith hell by mimmozzo_
Getting out of the monolith hellGetting out of the monolith hell
Getting out of the monolith hell
mimmozzo_179 views
DocOps: Agile Content Development In Practice - Nils Bier, tekom Jahrestagung... by K15t
DocOps: Agile Content Development In Practice - Nils Bier, tekom Jahrestagung...DocOps: Agile Content Development In Practice - Nils Bier, tekom Jahrestagung...
DocOps: Agile Content Development In Practice - Nils Bier, tekom Jahrestagung...
K15t574 views
Building Highly Scalable Apps On Bluemix by Ryan Baxter
Building Highly Scalable Apps On BluemixBuilding Highly Scalable Apps On Bluemix
Building Highly Scalable Apps On Bluemix
Ryan Baxter1.6K views
Red Hat Forum London 2014 - Delivering Innovation at Speed, A JBoss Perspective by Jeremy Brown
Red Hat Forum London 2014 - Delivering Innovation at Speed, A JBoss PerspectiveRed Hat Forum London 2014 - Delivering Innovation at Speed, A JBoss Perspective
Red Hat Forum London 2014 - Delivering Innovation at Speed, A JBoss Perspective
Jeremy Brown693 views
Swagger for-your-api by Tony Tam
Swagger for-your-apiSwagger for-your-api
Swagger for-your-api
Tony Tam13.3K views
Microservices, the lean way by Bruno Bossola
Microservices, the lean wayMicroservices, the lean way
Microservices, the lean way
Bruno Bossola748 views
DevOpsGuys Performance Testing with APM Tools workshop by DevOpsGroup
DevOpsGuys Performance Testing with APM Tools workshopDevOpsGuys Performance Testing with APM Tools workshop
DevOpsGuys Performance Testing with APM Tools workshop
DevOpsGroup6.3K views
A Tour of Swagger for APIs by Allen Dean
A Tour of Swagger for APIsA Tour of Swagger for APIs
A Tour of Swagger for APIs
Allen Dean2.9K views
Testing for Logic App Solutions | Integration Monday by BizTalk360
Testing for Logic App Solutions | Integration MondayTesting for Logic App Solutions | Integration Monday
Testing for Logic App Solutions | Integration Monday
BizTalk360373 views
Building Scalable Micro-services with Nodejs by Michal Juhas
Building Scalable Micro-services with NodejsBuilding Scalable Micro-services with Nodejs
Building Scalable Micro-services with Nodejs
Michal Juhas2.1K views
Drinking from the Stream: How to Use Messaging Platforms for Scalability & Pe... by VMware Tanzu
Drinking from the Stream: How to Use Messaging Platforms for Scalability & Pe...Drinking from the Stream: How to Use Messaging Platforms for Scalability & Pe...
Drinking from the Stream: How to Use Messaging Platforms for Scalability & Pe...
VMware Tanzu422 views
LSCC 2014 "Crafting DevOps: Applying Software Craftsmanship to DevOps" by Daniel Bryant
LSCC 2014 "Crafting DevOps: Applying Software Craftsmanship to DevOps"LSCC 2014 "Crafting DevOps: Applying Software Craftsmanship to DevOps"
LSCC 2014 "Crafting DevOps: Applying Software Craftsmanship to DevOps"
Daniel Bryant4.4K views
Designing APIs with OpenAPI Spec by Adam Paxton
Designing APIs with OpenAPI SpecDesigning APIs with OpenAPI Spec
Designing APIs with OpenAPI Spec
Adam Paxton6K views
QA Fest 2017. Диана Пинчук. Разработка мульти- платформенного мобильного SDK:... by QAFest
QA Fest 2017. Диана Пинчук. Разработка мульти- платформенного мобильного SDK:...QA Fest 2017. Диана Пинчук. Разработка мульти- платформенного мобильного SDK:...
QA Fest 2017. Диана Пинчук. Разработка мульти- платформенного мобильного SDK:...
QAFest412 views
Hidden Treasure - TestComplete Script Extensions by SmartBear
Hidden Treasure - TestComplete Script ExtensionsHidden Treasure - TestComplete Script Extensions
Hidden Treasure - TestComplete Script Extensions
SmartBear463 views
GraphQL vs BFF: A critical perspective by Pronovix
GraphQL vs BFF: A critical perspectiveGraphQL vs BFF: A critical perspective
GraphQL vs BFF: A critical perspective
Pronovix346 views
RSpec & Rails, an introduction by Utku Kaynar
RSpec & Rails, an introductionRSpec & Rails, an introduction
RSpec & Rails, an introduction
Utku Kaynar546 views

Similar to RESTful applications: The why and how by Maikel Mardjan

REST full API Design by
REST full API DesignREST full API Design
REST full API DesignChristian Guenther
1.3K views43 slides
Simple Web Services with PHP by
Simple Web Services with PHPSimple Web Services with PHP
Simple Web Services with PHPJohn Paul Ada
308 views22 slides
IRJET- Rest API for E-Commerce Site by
IRJET- Rest API for E-Commerce SiteIRJET- Rest API for E-Commerce Site
IRJET- Rest API for E-Commerce SiteIRJET Journal
30 views4 slides
Overview of Rest Service and ASP.NET WEB API by
Overview of Rest Service and ASP.NET WEB APIOverview of Rest Service and ASP.NET WEB API
Overview of Rest Service and ASP.NET WEB APIPankaj Bajaj
2K views20 slides
Switch to Backend 2023 | Day 1 Part 1 by
Switch to Backend 2023 | Day 1 Part 1Switch to Backend 2023 | Day 1 Part 1
Switch to Backend 2023 | Day 1 Part 1Google Developer Students Club NIT Silchar
26 views19 slides

Similar to RESTful applications: The why and how by Maikel Mardjan(20)

Simple Web Services with PHP by John Paul Ada
Simple Web Services with PHPSimple Web Services with PHP
Simple Web Services with PHP
John Paul Ada308 views
IRJET- Rest API for E-Commerce Site by IRJET Journal
IRJET- Rest API for E-Commerce SiteIRJET- Rest API for E-Commerce Site
IRJET- Rest API for E-Commerce Site
IRJET Journal30 views
Overview of Rest Service and ASP.NET WEB API by Pankaj Bajaj
Overview of Rest Service and ASP.NET WEB APIOverview of Rest Service and ASP.NET WEB API
Overview of Rest Service and ASP.NET WEB API
Pankaj Bajaj2K views
REST & RESTful APIs: The State of Confusion by Glenn Antoine
REST & RESTful APIs: The State of ConfusionREST & RESTful APIs: The State of Confusion
REST & RESTful APIs: The State of Confusion
Glenn Antoine4.2K views
Rapid Web Development with Python for Absolute Beginners by Fatih Karatana
Rapid Web Development with Python for Absolute BeginnersRapid Web Development with Python for Absolute Beginners
Rapid Web Development with Python for Absolute Beginners
Fatih Karatana1.4K views
Fullstack Interview Questions and Answers.pdf by csvishnukumar
Fullstack Interview Questions and Answers.pdfFullstack Interview Questions and Answers.pdf
Fullstack Interview Questions and Answers.pdf
csvishnukumar2 views
Secc tutorials development and deployment of rest web services in java_v2.0 by Aravindharamanan S
Secc tutorials development and deployment of rest web services in java_v2.0Secc tutorials development and deployment of rest web services in java_v2.0
Secc tutorials development and deployment of rest web services in java_v2.0
Aravindharamanan S123 views
Rest api best practices – comprehensive handbook by Katy Slemon
Rest api best practices – comprehensive handbookRest api best practices – comprehensive handbook
Rest api best practices – comprehensive handbook
Katy Slemon91 views
Weekly Tech Session by Pravin Vaja
Weekly Tech SessionWeekly Tech Session
Weekly Tech Session
Pravin Vaja121 views
Building Killer RESTful APIs with NodeJs by Srdjan Strbanovic
Building Killer RESTful APIs with NodeJsBuilding Killer RESTful APIs with NodeJs
Building Killer RESTful APIs with NodeJs
Srdjan Strbanovic9.6K views
Creating Web Services with Zend Framework - Matthew Turland by Matthew Turland
Creating Web Services with Zend Framework - Matthew TurlandCreating Web Services with Zend Framework - Matthew Turland
Creating Web Services with Zend Framework - Matthew Turland
Matthew Turland6.7K views
17 applied architectures by Majong DevJfu
17 applied architectures17 applied architectures
17 applied architectures
Majong DevJfu889 views

Recently uploaded

SUPPLIER SOURCING.pptx by
SUPPLIER SOURCING.pptxSUPPLIER SOURCING.pptx
SUPPLIER SOURCING.pptxangelicacueva6
15 views1 slide
Melek BEN MAHMOUD.pdf by
Melek BEN MAHMOUD.pdfMelek BEN MAHMOUD.pdf
Melek BEN MAHMOUD.pdfMelekBenMahmoud
14 views1 slide
Five Things You SHOULD Know About Postman by
Five Things You SHOULD Know About PostmanFive Things You SHOULD Know About Postman
Five Things You SHOULD Know About PostmanPostman
33 views43 slides
Ransomware is Knocking your Door_Final.pdf by
Ransomware is Knocking your Door_Final.pdfRansomware is Knocking your Door_Final.pdf
Ransomware is Knocking your Door_Final.pdfSecurity Bootcamp
55 views46 slides
Transcript: The Details of Description Techniques tips and tangents on altern... by
Transcript: The Details of Description Techniques tips and tangents on altern...Transcript: The Details of Description Techniques tips and tangents on altern...
Transcript: The Details of Description Techniques tips and tangents on altern...BookNet Canada
136 views15 slides
Democratising digital commerce in India-Report by
Democratising digital commerce in India-ReportDemocratising digital commerce in India-Report
Democratising digital commerce in India-ReportKapil Khandelwal (KK)
15 views161 slides

Recently uploaded(20)

Five Things You SHOULD Know About Postman by Postman
Five Things You SHOULD Know About PostmanFive Things You SHOULD Know About Postman
Five Things You SHOULD Know About Postman
Postman33 views
Transcript: The Details of Description Techniques tips and tangents on altern... by BookNet Canada
Transcript: The Details of Description Techniques tips and tangents on altern...Transcript: The Details of Description Techniques tips and tangents on altern...
Transcript: The Details of Description Techniques tips and tangents on altern...
BookNet Canada136 views
handbook for web 3 adoption.pdf by Liveplex
handbook for web 3 adoption.pdfhandbook for web 3 adoption.pdf
handbook for web 3 adoption.pdf
Liveplex22 views
Case Study Copenhagen Energy and Business Central.pdf by Aitana
Case Study Copenhagen Energy and Business Central.pdfCase Study Copenhagen Energy and Business Central.pdf
Case Study Copenhagen Energy and Business Central.pdf
Aitana16 views
HTTP headers that make your website go faster - devs.gent November 2023 by Thijs Feryn
HTTP headers that make your website go faster - devs.gent November 2023HTTP headers that make your website go faster - devs.gent November 2023
HTTP headers that make your website go faster - devs.gent November 2023
Thijs Feryn22 views
【USB韌體設計課程】精選講義節錄-USB的列舉過程_艾鍗學院 by IttrainingIttraining
【USB韌體設計課程】精選講義節錄-USB的列舉過程_艾鍗學院【USB韌體設計課程】精選講義節錄-USB的列舉過程_艾鍗學院
【USB韌體設計課程】精選講義節錄-USB的列舉過程_艾鍗學院
PharoJS - Zürich Smalltalk Group Meetup November 2023 by Noury Bouraqadi
PharoJS - Zürich Smalltalk Group Meetup November 2023PharoJS - Zürich Smalltalk Group Meetup November 2023
PharoJS - Zürich Smalltalk Group Meetup November 2023
Noury Bouraqadi127 views
GDG Cloud Southlake 28 Brad Taylor and Shawn Augenstein Old Problems in the N... by James Anderson
GDG Cloud Southlake 28 Brad Taylor and Shawn Augenstein Old Problems in the N...GDG Cloud Southlake 28 Brad Taylor and Shawn Augenstein Old Problems in the N...
GDG Cloud Southlake 28 Brad Taylor and Shawn Augenstein Old Problems in the N...
James Anderson85 views

RESTful applications: The why and how by Maikel Mardjan

  • 1. 1 #buildtogether RESTful applications and Angular: The why and how Author : Maikel Mardjan Date : 24 February 2016 © 2016 Jexia Company This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.
  • 2. 2 Whoami? Maikel Mardjan: More than 20 years experience within IT (System) Development. Worked as IT Architect, Integrator, SW Developer. Now working as developer for Jexia.com to create the best developer tools around. Struggled but won serious integration fights using CORBA, RPCs, SOA, WSDLs. https://nl.linkedin.com/in/maikelmardjan @maikelmardjan Questions? Please contact me!
  • 4. 4 Agenda:REST: What, Why, How?  Essence of REST  How does REST work?  Designing RESTful APIs  Advantages and Disadvantages of REST  Tools to work with REST  Summary
  • 5. 5 Why REST? Defining, creating and managing application integration through APIs is (was) hard! Our needs / challenges / opportunities today: Currently almost all new released software systems contains REST interfaces for usage and/or control SOAP integration
  • 6. 6 Why REST? Defining, creating and managing application integration through APIs is (was) hard! Our needs today: ● We need a simpler why to connect to (different) Cloud based services. SOAP and WSDL-based interfaces were not that simple. ● We have a large range of devices of different vendors to integrate with (data) backends (phones, watches, smartTVs, Navigation devices, etc). ● All large software cooperations (Google, Yahoo and Microsoft etc) have deprecated SOAP and WSDL-based interfaces in favor of REST services to expose their services. RESTful interfacing is easier, simpler and encourage information usage and sharing! Currently almost all new released software systems contains REST interfaces for usage and/or control.
  • 7. 7 Why REST? (2) Almost all large services today allow interacting/integration by the use of RESTful APIs. Some examples:
  • 8. 8 REST: So what is it really all about? Representational State Transfer (REST):  Architecture style for designing and implementing networked applications.  Lightweight alternative to mechanisms like RPC (Remote Procedure Calls) and SOAP Web Services.  REST is based on the HTTP specification. Despite being simple, REST is not limited in usage!
  • 9. 9 The REST standard? By default REST is not a "standard"! Do we need a standard for REST?
  • 10. 10 The REST standard? (2) By default REST is not a "standard"! The current leading initiative to standardize REST descriptions is currently a project from the Linux Foundation organization (See https://openapis.org/ )
  • 11. 11 Basic REST elements Data element : pizzaHawaii Resource : pizza, book, user, ticket etc Resource identifier : URI , URN ( /pizzatype/34) Data representation : JSON, txt, htmlt, XML, YAML etc Metadata : content type, last-modified time REST (HTTP based integration)Verbs (GET, POST, PUT, etc) Representations (Json, XML, etc) Nouns (Resources) /order/pizza/45
  • 12. 12 Working of REST (3) Method RFC Description GET Transfer a current representation of the target resource. HEAD Same as GET, but only transfer the status line and header section. POST Perform resource-specific processing on the request payload. PUT Replace all current representations of the target resource with the request payload. DELETE Remove all current representations of the target resource. CONNECT Establish a tunnel to the server identified by the target resource. OPTIONS Describe the communication options for the target resource. TRACE Perform a message loop-back test along the path to the target resource. Good REST services should use the HTTP methods correctly. This means as defined by RFC 7231.
  • 14. 14 Sample mockup A simple task application with RESTful interfaces:  GET /tasks – display all tasks  POST /tasks – Create a new task  GET /tasks/{id} display a task with id  PUT /tasks/{id} – Update a task with id  DELETE /tasks/{id} – Delete a tasks with id When using REST calls to your data you can often make use of data query options. These can be used to find, filter and sort the output from your dataset.
  • 15. 15 Designing RESTful APIs Designing RESTful APIs is easy: ● To create a resource on the server, use POST. ● To retrieve a resource, use GET. ● To change the state of a resource or to update it, use PUT. ● To remove or delete a resource, use DELETE.
  • 16. 16 Designing RESTful APIs (2) REST interfaces are defined through the URL or URI:
  • 17. 17 Designing RESTful APIs Some simple design guidelines: ● Queries should not return an overload of data. If needed, provide a paging mechanism. ● Even though the REST response can be anything, make sure it's well documented (and do not change the output format since it will break existing clients). ● GET access requests should never cause a state change. ● All communication is done by representation (e.g. XML/JSON). By default JSON is the preferred representation to use. ● Be Stateless. Stateless ( Each request from any client contains all the information. So all HTTP methods like caching and load-balance can be used).
  • 18. 18 Business Advantages when using REST? Why should you (again) use something new? What is the business value for you? Why should you use RESTful services?
  • 19. 19 Advantages of REST ● REST is 'light weight'. (Easy to develop, test, etc) ● Network and security friendly (e.g. firewalls, caching, stateless, configuration, IDPS possible, no confusion on wire-protocol) ● Human readable results since basic HTTP-based methods are used with JSON. (when you choose to use json, why not?) ● No hard coupling between client-server. Create your RESTful client in the programming language you want!
  • 20. 20 Disadvantages of REST REST is no solution for every use case! So when not to use RESTful APIs?
  • 21. 21 Disadvantages of REST ● Changing REST interfaces and Versioning: If not done well:payloads tend to grow over time for all clients. ● REST endpoints are usually weakly-typed and lack machine-readable metadata. So use strong typing when possible! ● No single standard exist for RESTful interfaces. Consequence is that depending on the service request/response behavior can be different than expected. ● Most REST systems of any complexity end up with large amounts of endpoints. Getting familiar with all these endpoint and interacting with the correct endpoints can become hard. ● Doing chained transactions over different REST endpoints providers can become difficult and can become complex too. (But with good design it is possible!) ● RESTful interfacing can have a large impact on network load. (REST with video, audio, big- data files …) Sometimes using pure ftp-protocol is not that bad... ● REST is hard to use when fetching complicated object graphs that require multiple round trips between the client and server to render single views.
  • 22. 22 Tools to work with REST Use the right tool for the job. Working with RESTful interfaces requires of always testing interfaces. Some tool examples: ● cURL (The defacto CLI tool for years!) ( https://curl.haxx.se/docs/) ● wget ● HTTPIE (Python CLI, http://httpie.org ) ● REST Easy (A firefox plugin) ● Postman (Chrome extensions or standalone)
  • 24. 24 Summary  Essence of REST  How does REST work?  Designing RESTful APIs  Advantages and Disadvantages of REST  Tools to work with REST
  • 25. 25 Appendix: Designing RESTful APIs (2) REST interfaces are defined through the URL or URI:  URN: Universal Resource Name  Name of a resource in-depended of a specific location  URL: Uniform Resource LOCATION  Provides access to a specific representation of a resource on the network.  Example: https://myapp.jexia.com/mypizza?ordernumber=60  Example:https://myapp.jexia.com/mypizza/ordernumber/60  URI: Uniform Resource IDENTIFIER (can be URL or URN)  Identifies a specific resource on the network  Example: https://myapp.jexia.com/mypizza  mailto:<questions@jexia.com>