Introduction to Spring WebFlux #jsug #sf_a1Toshiaki Maki
Ā
The document provides an introduction and overview of Spring WebFlux, a non-blocking web framework for Spring. It discusses the differences between blocking and non-blocking web stacks, and how Spring WebFlux uses reactive streams and programming. Code examples are provided showing how to build reactive controllers and streams in Spring WebFlux that support backpressure.
The document discusses demystifying APIs. It begins with an introduction to APIs, including their evolution and benefits. It then discusses RESTful APIs and their key aspects like uniform interface and use of HTTP methods. The document outlines best practices for API design, development, and challenges. It provides examples of designing APIs using Node.js and Hapi.js and discusses challenges like security, authentication, rate limiting, and scalability. Tools mentioned include Express, Swagger, Postman, and Kong.
- gRPC is an open source RPC framework originally developed by Google in 2015. It uses HTTP/2 for transport, Protocol Buffers as the interface definition language, and provides features like authentication, bidirectional streaming and interface definitions.
- Compared to REST, gRPC is faster, more efficient through binary encoding (Protocol Buffers), supports bidirectional streaming, and generates client and server code. However, it lacks browser support and has fewer available tools.
- gRPC is best suited for internal microservices communication where high performance is required and tight coupling is acceptable. It supports unary, server streaming, client streaming and bidirectional streaming RPC patterns.
Understanding REST APIs in 5 Simple StepsTessa Mero
Ā
This document summarizes the 5 steps to understanding REST APIs: 1) Understanding the purpose of APIs and their importance and growth, 2) Learning that REST defines functions to communicate via HTTP verbs and nouns, 3) Knowing that APIs use requests and responses, 4) Relying on documentation as the reference, and 5) Using debugging and testing tools to prevent issues. It provides examples of requests, responses, API documentation, and tools like Postman for working with REST APIs.
SpringOne Tour: Spring Boot 3 and BeyondVMware Tanzu
Ā
This document discusses new features and capabilities in Spring Boot 3 and beyond, including support for JDK 17 and Jakarta EE 9/10, ahead-of-time compilation, virtual threads, improved observability, and more. Spring Boot 3.1 RC1 has been released with features like using Testcontainers for development, building Docker images, and dependency upgrades. The speaker demonstrated Spring Boot 3 and discussed upcoming releases of Spring Framework 6.0 and 6.1 as foundations for new Spring Boot versions.
The document provides an introduction to Gradle, an open source build automation tool. It discusses that Gradle is a general purpose build system with a rich build description language based on Groovy. It supports "build-by-convention" and is flexible and extensible, with built-in plugins for Java, Groovy, Scala, web and OSGi. The presentation covers Gradle's basic features, principles, files and collections, dependencies, multi-project builds, plugins and reading materials.
Les Hazlewood, Stormpath co-founder and CTO and the Apache Shiro PMC Chair demonstrates how to design a beautiful REST + JSON API. Includes the principles of RESTful design, how REST differs from XML, tips for increasing adoption of your API, and security concerns.
Presentation video: https://www.youtube.com/watch?v=5WXYw4J4QOU
More info: http://www.stormpath.com/blog/designing-rest-json-apis
Further reading: http://www.stormpath.com/blog
Sign up for Stormpath: https://api.stormpath.com/register
Stormpath is a user management and authentication service for developers. By offloading user management and authentication to Stormpath, developers can bring applications to market faster, reduce development costs, and protect their users. Easy and secure, the flexible cloud service can manage millions of users with a scalable pricing model.
This talk introduces Spring's REST stack - Spring MVC, Spring HATEOAS, Spring Data REST, Spring Security OAuth and Spring Social - while refining an API to move higher up the Richardson maturity model
gRPC is an open source framework that allows for communication between services using HTTP/2 and Protocol Buffers. It provides features like low latency and high scalability. Key benefits include focusing on service design, language interoperability, and growing community support. gRPC uses Protocol Buffers for serialization, HTTP/2 for transport, and an IDL for service definitions. It supports various request-response and streaming call types and provides libraries in many languages.
This document provides an overview of gRPC (Google Remote Procedure Call), including:
- RPC allows invoking functions on remote servers similarly to APIs. gRPC builds on this with features like HTTP/2, protocol buffers, and load balancing.
- Protocol buffers define the data structure and code can be generated for various languages. RPC uses protobufs which are machine-readable for security.
- gRPC has features like client/server streaming and duplex streaming in addition to traditional RPC implementations like RPC-XML and RPC-JSON.
gRPC is an open source RPC framework that makes it easy to build a distributed system across multiple languages. It uses HTTP/2 for transport, has features like streaming, load balancing and authentication built-in. It is used widely at Google and is now available open source with implementations in 10 languages. gRPC benefits from being layered on HTTP/2 for interoperability and has a pluggable architecture for advanced features like monitoring and proxies.
This document discusses reactive programming and Spring Webflux. It begins with an introduction to reactive programming and why it is needed for applications with high user expectations. It then covers reactive streams and the Reactive Manifesto. It introduces Project Reactor and compares it to RxJava. It discusses how Spring Webflux allows for non-blocking reactive REST APIs. It concludes with an overview of a demo and next steps including support for SQL, web sockets, and MongoDB.
How to Avoid Common Mistakes When Using Reactor NettyVMware Tanzu
Ā
The document discusses common mistakes when using Reactor Netty including logging, memory leaks, timeouts, connection closed issues, and connection pools. It provides examples of logging output that show a request-response lifecycle and handling of multiple concurrent connections. The presentation covers configuring logging, avoiding object retention, setting response timeouts, handling closed connections, and sizing connection pools properly.
Troubleshooting common oslo.messaging and RabbitMQ issuesMichael Klishin
Ā
This document discusses common issues with oslo.messaging and RabbitMQ and how to diagnose and resolve them. It provides an overview of oslo.messaging and how it uses RabbitMQ for RPC calls and notifications. Examples are given of where timeouts could occur in RPC calls. Methods for debugging include enabling debug logging, examining RabbitMQ queues and connections, and correlating logs from services. Specific issues covered include RAM usage, unresponsive nodes, rejected TCP connections, TLS connection failures, and high latency. General tips emphasized are using tools to gather data and consulting log files.
The document summarizes a presentation given by Alex Borysov and Mykyta Protsenko comparing gRPC and REST. It provides an overview of gRPC, describing it as a high performance RPC framework. It then discusses some issues with REST including heterogeneous data formats and service discovery. Examples are given of implementing a sample aggregator service using both REST and gRPC to illustrate their differences.
This document provides an overview of HTTP and REST APIs. It describes how HTTP allows sending documents over the web using URLs to identify resources and HTTP verbs like GET, PUT, DELETE and POST. It defines common response codes. It explains that REST stands for Representational State Transfer and relies on a stateless, client-server architecture using the HTTP protocol. The key design constraints of REST include having a uniform interface, being resource-based and using representations to manipulate resources with self-descriptive messages. Benefits include statelessness for scalability, cacheability to improve performance, separating clients from servers, and using a layered system with intermediary servers.
This presentation covers basics of RESTful webservices. I have prepared it by reading different online tutorials. One of them is java brains video tutorial. Hope this helps some one.
If any one needs examples mentioned in the slides, please contact me.
The document provides an overview of REST APIs and how they can be used to build web applications. It discusses HTTP and URLs, defines REST and its architectural constraints, and shows how to implement REST principles using HTTP methods, URLs and response codes. The document also covers REST API design best practices like versioning, limiting fields, using JSON format, and handling errors properly. It provides resources for further reading on REST APIs and their implementation.
This document discusses Representational State Transfer (REST) and how it relates to web architectures and HTTP. Some key points:
- REST is an architectural style for distributed hypermedia systems that defines resources, resource identifiers, representations, and HTTP verbs. It captures the characteristics that made the web successful.
- HTTP is the core protocol used in REST. Common verbs are GET, POST, PUT, DELETE. Resources are identified by URIs and can have multiple representations like JSON or XML.
- In a REST system, the client interacts with resources through representations transferred via HTTP. This changes the client's state, giving rise to the term "Representational State Transfer".
- The web itself is an example of a
This document discusses Representational State Transfer (REST) and how it relates to web architectures and HTTP. Some key points:
- REST is an architectural style for distributed hypermedia systems that defines resources, resource identifiers, representations, and HTTP verbs like GET, POST, PUT, DELETE.
- The web itself is a RESTful system, with resources identified by URLs and representations transferred via HTTP requests and responses.
- REST uses HTTP verbs on resources identified by URIs to transfer representations of those resources between clients and servers.
- Representations can be in various formats like JSON, XML, HTML, allowing the same resource to be presented in multiple ways.
- The document provides examples of how REST and
This document discusses building forms, APIs, and CRUD operations in React. It covers creating basic and controlled forms in React, RESTful APIs and CRUD operations using HTTP methods like GET and POST. Axios is introduced as a library for making API requests from React. Examples of CRUD functionality for create, read, update and delete operations are provided. The conclusion emphasizes how this knowledge enables building dynamic web applications with seamless data interaction and user experience.
Primary focus of this presentation is on the hypermedia as the engine of application state (HATEOAS) and how HTTP APIs may benefit from it. Provides sneak peek into HAL media type & gives an overview of hypermedia support in Java tools (JAX-RS / HalBuilder and Spring HATEOAS) along with practical suggestions for server-side design of hypermedia API. Also includes quick overview of Richardson Maturity Model based on a set of examples, current API trends.
This document discusses the evolution of web APIs from SOAP to RESTful architectures. It covers the basics of REST including the Richardson maturity model, use of HTTP verbs and status codes, hypermedia, and content negotiation. Caching techniques are also discussed as a means of improving scalability. The overall summary is that HTTP provides a powerful application protocol for building web APIs and REST architectures allow these APIs to better leverage the inherent scaling capabilities of the web.
This document summarizes a presentation about building RESTful applications using PHP. REST (Representational State Transfer) is a software architectural style that uses HTTP verbs to manipulate resources. The presentation covers the six constraints that define REST - client-server separation, statelessness, cacheability, uniform interface, layered system, and code on demand. It provides tips for implementing REST in PHP like using the header() function, determining the request method, and encoding/decoding JSON. Questions from the audience are answered at the end.
This document provides an introduction to designing RESTful APIs. It discusses HTTP, REST architectural principles, and how to design APIs around resources and use HTTP methods and status codes. Examples of good and bad RESTful APIs are provided, along with exercises to design RESTful versions of existing APIs. Authentication patterns like API keys and OAuth are also covered.
This document provides an overview of ASP.NET MVC 4 Web API. It discusses what an API is and why Web API is used. It covers key concepts like HTTP, REST, JSON. It describes features of Web API like routing, error handling, model validation, OData support, media formatters, and security. It also discusses using the HttpClient class and future plans.
Resting on your laurels will get you pownedDinis Cruz
Ā
Presentation delivered at BlackHat 2013. See these posts for more details on the Demos: http://blog.diniscruz.com/2013/08/using-xmldecoder-to-execute-server-side.html ., http://blog.diniscruz.com/2013/08/neo4j-csrf-payload-to-start-processes.html
Mobile applications Development - Lecture 14
REST Basics
This presentation has been developed in the context of the Mobile Applications Development course at the Computer Science Department of the University of LāAquila (Italy).
http://www.di.univaq.it/malavolta
This document discusses REST and ASP.NET WebAPI. It begins with introductions to REST, the Richardson Maturity Model, and ASP.NET WebAPI. It then covers key WebAPI concepts like controllers, routes, content negotiation, and HTTP methods. A large portion discusses hypermedia and the OData protocol for building hypermedia-driven REST services with WebAPI and Entity Framework. It provides examples of OData queries, metadata support, and routing. The document concludes with recommendations for further reading and questions.
Building Self Documenting HTTP APIs with CQRSDerek Comartin
Ā
Does your HTTP API expose your database structure?
HTTP endpoints that represent your database entities couples your consuming clients to the internals of your application. Making it much harder to change your API.
Go beyond serializing a database row into json by leveraging CQRS.
Start designing an HTTP API like a regular HTML website. Bringing the concepts of HTML links and forms to your API allows your clients to consume it with ease.
Attendees will learn how to design an HTTP API by leveraging CQRS and hypermedia to decouple their core application from their HTTP API.
ASIT Bangalore is the best institute for "REST API" and invites lot of people with technical back ground and experienced HRĀ from corporate world as a part of pre-placement training, this actually helps us to perform better in our interviews. For more details please visit our website.
Simple Object Access Protocol (SOAP) and Representational State Transfer (REST) are two answers to the same question: how to access Web services. The choice initially may seem easy, but at times it can be surprisingly difficult. SOAP is a standards-based Web services access protocol that has been around for a while and enjoys all of the benefits of long-term use. Originally developed by Microsoft, SOAP really isnt as simple as the acronym would suggest. The Difference between SOAP vs REST APIs REST is the newcomer to the block. It seeks to fix the problems with SOAP and provide a truly simple method of accessing Web services. Shabnam Kumari | Deepak"REST based API" Published in International Journal of Trend in Scientific Research and Development (ijtsrd), ISSN: 2456-6470, Volume-1 | Issue-4 , June 2017, URL: http://www.ijtsrd.com/papers/ijtsrd2200.pdf http://www.ijtsrd.com/computer-science/computer-security/2200/rest-based-api/shabnam-kumari
REST and Resource Oriented Architecture - okcDG March 2008Ryan Hoegg
Ā
This document discusses REST (Representational State Transfer), a architectural style for distributed hypermedia systems, and Resource Oriented Architecture (ROA), which provides concrete rules for building RESTful web services. It explains key REST concepts like addressable resources, uniform interface, statelessness, and hypermedia. It also provides an example of designing a RESTful pizza delivery web service using ROA principles like naming resources with URIs and designing representations for resources.
Roy Fielding introduced the concept of RESTful APIs in 2000. REST has since become a dominant framework for sending requests from clients to servers to interact with and receive data in a format clients can use. A RESTful API uses well-established HTTP methods like GET, POST, PUT, and DELETE to allow standardized communication and efficient use of network resources. REST defines how clients and servers exchange information about resources through standardized requests and responses.
This document provides an overview of REST (Representational State Transfer) and RESTful architectures. It begins with an introduction and agenda. It then defines REST and describes its key aspects like resources, representations, and the HTTP methods. It discusses the constraints and goals of REST, examples of RESTful systems, and why REST is advantageous for building distributed systems. Finally, it covers implementing RESTful services in Java using the JAX-RS API and frameworks like Jersey.
Similar to API Design, A Quick Guide to REST, SOAP, gRPC, and GraphQL, By Vahid Rahimian (20)
Participants explored how visual and functional coherence strengthened brand identity and streamlined development in this session. They learned to maintain consistency across platforms and enhance user experiences using Design Systems. Ideal for brand designers, UI/UX designers, developers, and product managers who sought to optimize efficiency and ensure consistency across projects.
Non-Functional Testing Guide_ Exploring Its Types, Importance and Tools.pdfkalichargn70th171
Ā
Are you looking for ways to ensure your software development projects are successful? Non-functional testing is an essential part of the process, helping to guarantee that applications and systems meet the necessary non-functional requirements such as availability, scalability, security, and usability.
Discover BoxLang, the innovative JVM programming language developed by Ortus Solutions. Designed to harness the power of the Java Virtual Machine, BoxLang offers a modern approach to application development with robust performance and scalability. Join us as we explore the capabilities of BoxLang, its syntax, and how it enhances productivity in software development.
In this session, we explored how the cbfs module empowers developers to abstract and manage file systems seamlessly across their lifecycle. From local development to S3 deployment and customized media providers requiring authentication, cbfs offers flexible solutions. We discussed how cbfs simplifies file handling with enhanced workflow efficiency compared to native methods, along with practical tips to accelerate complex file operations in your projects.
What is OCR Technology and How to Extract Text from Any Image for FreeTwisterTools
Ā
Discover the fascinating world of Optical Character Recognition (OCR) technology with our comprehensive presentation. Learn how OCR converts various types of documents, such as scanned paper documents, PDFs, or images captured by a digital camera, into editable and searchable data. Dive into the history, modern applications, and future trends of OCR technology. Get step-by-step instructions on how to extract text from any image online for free using a simple tool, along with best practices for OCR image preparation. Ideal for professionals, students, and tech enthusiasts looking to harness the power of OCR.
Seamless PostgreSQL to Snowflake Data Transfer in 8 Simple StepsEstuary Flow
Ā
Unlock the full potential of your data by effortlessly migrating from PostgreSQL to Snowflake, the leading cloud data warehouse. This comprehensive guide presents an easy-to-follow 8-step process using Estuary Flow, an open-source data operations platform designed to simplify data pipelines.
Discover how to seamlessly transfer your PostgreSQL data to Snowflake, leveraging Estuary Flow's intuitive interface and powerful real-time replication capabilities. Harness the power of both platforms to create a robust data ecosystem that drives business intelligence, analytics, and data-driven decision-making.
Key Takeaways:
1. Effortless Migration: Learn how to migrate your PostgreSQL data to Snowflake in 8 simple steps, even with limited technical expertise.
2. Real-Time Insights: Achieve near-instantaneous data syncing for up-to-the-minute analytics and reporting.
3. Cost-Effective Solution: Lower your total cost of ownership (TCO) with Estuary Flow's efficient and scalable architecture.
4. Seamless Integration: Combine the strengths of PostgreSQL's transactional power with Snowflake's cloud-native scalability and data warehousing features.
Don't miss out on this opportunity to unlock the full potential of your data. Read & Download this comprehensive guide now and embark on a seamless data journey from PostgreSQL to Snowflake with Estuary Flow!
Try it Free: https://dashboard.estuary.dev/register
A captivating AI chatbot PowerPoint presentation is made with a striking backdrop in order to attract a wider audience. Select this template featuring several AI chatbot visuals to boost audience engagement and spontaneity. With the aid of this multi-colored template, you may make a compelling presentation and get extra bonuses. To easily elucidate your ideas, choose a typeface with vibrant colors. You can include your data regarding utilizing the chatbot methodology to the remaining half of the template.
2. Agenda
ā¢HTTP, REST Basics
ā¢REST API Design Guide
ā¢SOAP, REST, GraphQL, and gRPC
ā¢Which API Format?
System
Analysis
and
Design,
Spring
2021,
Sharif
University
By
Vahid
Rahimian
2
4. Hypertext Transfer Protocol
(HTTP)
ā¢ A communications protocol
ā¢ Allows retrieving inter-linked text documents
(hypertext)
ā¢ World Wide Web.
ā¢ HTTP Verbs
ā¢ HEAD
ā¢ GET
ā¢ POST
ā¢ PUT
ā¢ DELETE
ā¢ TRACE
ā¢ OPTIONS
ā¢ CONNECT
Browser Web Server
GET /index.html HTTP/1.1
Host: myket.ir
HTTP/1.1 200 OK
Content-Type: text/html
<html><head>ā¦
System
Analysis
and
Design,
Spring
2021,
Sharif
University
By
Vahid
Rahimian
4
5. RepresentationalState Transfer(REST)
ā¢ A style of software architecture for distributed
hypermedia systems such as the World Wide
Web.
ā¢ Introduced in the doctoral dissertation of Roy
Fielding
ā¢ One of the principal authors of the HTTP specification.
ā¢ A collection of network architecture principles
which outline how resources are defined and
addressed
System
Analysis
and
Design,
Spring
2021,
Sharif
University
By
Vahid
Rahimian
5
6. REST and HTTP
ā¢ The motivation for REST was to capture the
characteristics of the Web which made the Web
successful.
ā¢ URI Addressable resources
ā¢ HTTP Protocol
ā¢ Make a Request ā Receive Response ā Display Response
ā¢ Exploits the use of the HTTP protocol beyond HTTP
POST and HTTP GET
ā¢ HTTP PUT, HTTP DELETE
System
Analysis
and
Design,
Spring
2021,
Sharif
University
By
Vahid
Rahimian
6
7. REST - not a Standard
ā¢ REST is not a standard
ā¢ JSR 311: JAX-RS: The JavaTM API for RESTful Web
Services
ā¢ But it uses several standards:
ā¢ HTTP
ā¢ URL
ā¢ XML/HTML/GIF/JPEG/etc (Resource Representations)
ā¢ text/xml, text/html, image/gif, image/jpeg, etc
(Resource Types, MIME Types)
System
Analysis
and
Design,
Spring
2021,
Sharif
University
By
Vahid
Rahimian
7
8. Main Concepts
Nouns (Resources)
unconstrained
i.e., http://example.com/employees/12345
Verbs
constrained
i.e., GET
Representations
constrained
i.e., XML
REST
System
Analysis
and
Design,
Spring
2021,
Sharif
University
By
Vahid
Rahimian
8
9. Resources
ā¢ The key abstraction of information in REST is a
resource.
ā¢ A resource is a conceptual mapping to a set of entities
ā¢ Any information that can be named can be a resource: a
document or image, a temporal service (e.g. "today's
weather in Los Angeles"), a collection of other resources, a
non-virtual object (e.g. a person), and so on
ā¢ Represented with a global identifier (URI in HTTP)
ā¢ http://myket.ir/games/clash-of-clans
System
Analysis
and
Design,
Spring
2021,
Sharif
University
By
Vahid
Rahimian
9
10. Naming Resources
ā¢ REST uses URI to identify resources
ā¢ https://myket.ir/games/
ā¢ https://myket.ir/games/clash-of-clans/
ā¢ https://myket.ir/games/clash-of-clans/comments/
ā¢ http://sharif.edu/classes
ā¢ http://sharif.edu/classes/cs40418-2
ā¢ http://sharif.edu/classes/cs40418-2/students
ā¢ As you traverse the path from more generic to more
specific, you are navigating the data
System
Analysis
and
Design,
Spring
2021,
Sharif
University
By
Vahid
Rahimian
10
11. Verbs
ā¢ Represent the actions to be performed on resources
ā¢ HTTP GET
ā¢ HTTP POST
ā¢ HTTP PUT
ā¢ HTTP DELETE
System
Analysis
and
Design,
Spring
2021,
Sharif
University
By
Vahid
Rahimian
11
12. HTTP GET
ā¢ How clients ask for the information they seek.
ā¢ Issuing a GET request transfers the data from the
server to the client in some representation
ā¢ GET http://taaghche.com/books
ā¢ Retrieve all books
ā¢ GET http://taaghche.com /books/ISBN-0011021
ā¢ Retrieve book identified with ISBN-0011021
ā¢ GET http://taaghche.com/books/ISBN-0011021/authors
ā¢ Retrieve authors for book identified with ISBN-0011021
System
Analysis
and
Design,
Spring
2021,
Sharif
University
By
Vahid
Rahimian
12
13. HTTP PUT, HTTP POST
ā¢ HTTP POST creates a resource
ā¢ HTTP PUT updates a resource
ā¢ POST http://admin.taaghche.com/books/
ā¢ Content: {title, authors[], ā¦}
ā¢ Creates a new book with given properties
ā¢ PUT http://taaghche.com/books/isbn-111
ā¢ Content: {isbn, title, authors[], ā¦}
ā¢ Updates book identified by isbn-111 with submitted properties
System
Analysis
and
Design,
Spring
2021,
Sharif
University
By
Vahid
Rahimian
13
14. HTTP DELETE
ā¢ Removes the resource identified by the URI
ā¢ DELETE http://admin.taaghche.com/books/ISBN-0011
ā¢ Delete book identified by ISBN-0011
System
Analysis
and
Design,
Spring
2021,
Sharif
University
By
Vahid
Rahimian
14
15. Representations
ā¢ How data is represented or returned to the client for
presentation.
ā¢ Two main formats:
ā¢ JavaScript Object Notation (JSON)
ā¢ XML
ā¢ It is common to have multiple representations of the
same data
System
Analysis
and
Design,
Spring
2021,
Sharif
University
By
Vahid
Rahimian
15
16. Representations
ā¢ XML
<COURSE>
<ID> CS40418-2 </ID>
<NAME> System Analysis and Design </NAME>
<INSTRUCTOR> Vahid Rahimian </INSTRUCTOR>
</COURSE>
ā¢ JSON
{
āidā: āCS40418-2ā,
ānameā: āSystem Analysis and Designā,
āinstructorā: āVahid Rahimianā
}
System
Analysis
and
Design,
Spring
2021,
Sharif
University
By
Vahid
Rahimian
16
17. Representational State Transfer
Resource
Client
http://myket.ir/games/clash-of-clans
Clash-of-Clans.html
The Client references a Web resource using a URL. A representation of the resource is returned (in
this case as an HTML document).
The representation (e.g., Clash-Of-Clans.html) places the client application in a state. The result of the
client traversing a hyperlink in Clash-Of-Clans.html is another resource accessed. The new
representation places the client application into yet another state. Thus, the client application changes
(transfers) state with each resource representation --> Representation State Transfer!
Description
Screenshots, Video
User Comments
...
System
Analysis
and
Design,
Spring
2021,
Sharif
University
By
Vahid
Rahimian
17
18. Architecture Style
Request
(XML doc)
Response
(XML doc)
Web/Proxy
Server
HTTP GET
URL 1
HTTP Response
doGet()
Request
(XML doc)
Response
(JSON doc)
HTTP POST
URL 1
HTTP Response
doPost(id)
REST Engine
(locate resource
and generate
response)
PO
(XML doc)
HTTP DELETE
URL 1
doDelete()
Response
(TEXT doc)
HTTP Response
System
Analysis
and
Design,
Spring
2021,
Sharif
University
By
Vahid
Rahimian
18
19. Real Life Examples
ā¢ Google Maps
ā¢ Google AJAX Search API
ā¢ Amazon Web Services
ā¢ Trello API
System
Analysis
and
Design,
Spring
2021,
Sharif
University
By
Vahid
Rahimian
19
20. REST and the Web
ā¢ The Web is an example of a REST system!
ā¢ All of those Web services that you have been using all
these many years - book ordering services, search
services, online dictionary services, etc - are REST-
based Web services.
ā¢ Alas, you have been using REST, building REST services
and you didn't even know it.
System
Analysis
and
Design,
Spring
2021,
Sharif
University
By
Vahid
Rahimian
20
22. Organize the API around resources
ā¢ Focus on the business entities that the
web API exposes. For example, in an
e-commerce system, the primary
entities might be customers and
orders.
ā¢ Avoid requiring resource URIs more
complex
than collection/item/collection.
ā¢
System
Analysis
and
Design,
Spring
2021,
Sharif
University
By
Vahid
Rahimian
22
23. Define operations in terms of
HTTP methods
ā¢ GET retrieves a representation of the
resource at the specified URI. The body
of the response message contains the
details of the requested resource.
ā¢ POST creates a new resource at the
specified URI. The body of the request
message provides the details of the new
resource. Note that POST can also be
used to trigger operations that don't
actually create resources.
System
Analysis
and
Design,
Spring
2021,
Sharif
University
By
Vahid
Rahimian
23
24. Define operations in terms of
HTTP methods
ā¢ PUT either creates or replaces the
resource at the specified URI. The body
of the request message specifies the
resource to be created or updated.
ā¢ PATCH performs a partial update of a
resource. The request body specifies the
set of changes to apply to the resource.
ā¢ DELETE removes the resource at the
specified URI.
System
Analysis
and
Design,
Spring
2021,
Sharif
University
By
Vahid
Rahimian
24
25. Define operations in terms of
HTTP methods
System
Analysis
and
Design,
Spring
2021,
Sharif
University
By
Vahid
Rahimian
25
26. Conform to HTTP semantics:
Media Types
ā¢ In the HTTP protocol, formats are specified
through the use of media types, also called
MIME types.
ā¢ For non-binary data, most web APIs support
JSON (media type = application/json) and
possibly XML (media type = application/xml).
ā¢ The Content-Type header in a request or
response specifies the format of the
representation.
System
Analysis
and
Design,
Spring
2021,
Sharif
University
By
Vahid
Rahimian
26
27. Conform to HTTP semantics:
Media Types
If the server doesn't support the media type, it
should return HTTP status code 415
(Unsupported Media Type).
System
Analysis
and
Design,
Spring
2021,
Sharif
University
By
Vahid
Rahimian
27
28. Conform to HTTP semantics:
Media Types
ā¢ A client request can include an Accept header that
contains a list of media types the client will accept from
the server in the response message.
ā¢ If the server cannot match any of the media type(s) listed,
it should return HTTP status code 406 (Not Acceptable).
System
Analysis
and
Design,
Spring
2021,
Sharif
University
By
Vahid
Rahimian
28
29. Conform to HTTP semantics:
POST methods
ā¢ If a POST method creates a new resource, it returns HTTP status
code 201 (Created). The URI of the new resource is included in the
Location header of the response. The response body contains a
representation of the resource.
ā¢ If the method does some processing but does not create a new
resource, the method can return HTTP status code 200 and include
the result of the operation in the response body. Alternatively, if
there is no result to return, the method can return HTTP status code
204 (No Content) with no response body.
ā¢ If the client puts invalid data into the request, the server should
return HTTP status code 400 (Bad Request). The response body can
contain additional information about the error or a link to a URI that
provides more details.
System
Analysis
and
Design,
Spring
2021,
Sharif
University
By
Vahid
Rahimian
29
30. Conform to HTTP semantics:
PATCH methods
ā¢ With a PATCH request, the client sends a set of
updates to an existing resource, in the form of a
patch document. The server processes the patch
document to perform the update.
System
Analysis
and
Design,
Spring
2021,
Sharif
University
By
Vahid
Rahimian
30
31. Conform to HTTP semantics:
Async operations
ā¢ Sometimes a POST, PUT, PATCH, or DELETE
operation might require processing that
takes a while to complete.
ā¢ If you wait for completion before sending a
response to the client, it may cause
unacceptable latency.
ā¢ If so, consider making the operation
asynchronous. Return HTTP status code 202
(Accepted) to indicate the request was
accepted for processing but is not
completed
System
Analysis
and
Design,
Spring
2021,
Sharif
University
By
Vahid
Rahimian
31
32. Filter and paginate data
ā¢ GET requests over collection resources can
potentially return a large number of items.
ā¢ You should design a web API to limit the
amount of data returned by any single
request.
ā¢ Consider supporting query strings that
specify the maximum number of items to
retrieve and a starting offset into the
collection.
System
Analysis
and
Design,
Spring
2021,
Sharif
University
By
Vahid
Rahimian
32
33. Support partial responses for
large binary resources
ā¢ A resource may contain large binary fields, such
as files or images.
ā¢ To overcome problems caused by unreliable and
intermittent connections and to improve
response times, consider enabling such
resources to be retrieved in chunks.
ā¢ To do this, the web API should support the
Accept-Ranges header for GET requests for large
resources.
ā¢ This header indicates that the GET operation
supports partial requests. The client application
can submit GET requests that return a subset of
a resource, specified as a range of bytes.
System
Analysis
and
Design,
Spring
2021,
Sharif
University
By
Vahid
Rahimian
33
34. Support partial responses for
large binary resources
System
Analysis
and
Design,
Spring
2021,
Sharif
University
By
Vahid
Rahimian
34
35. Support partial responses for
large binary resources
ā¢ Also, consider implementing HTTP HEAD
requests for these resources.
ā¢ A HEAD request is similar to a GET
request, except that it only returns the
HTTP headers that describe the resource,
with an empty message body.
ā¢ A client application can issue a HEAD
request to determine whether to fetch a
resource by using partial GET requests.
System
Analysis
and
Design,
Spring
2021,
Sharif
University
By
Vahid
Rahimian
35
36. Support partial responses for
large binary resources
System
Analysis
and
Design,
Spring
2021,
Sharif
University
By
Vahid
Rahimian
36
37. Use HATEOAS to enable
navigation to related resources
System
Analysis
and
Design,
Spring
2021,
Sharif
University
By
Vahid
Rahimian
37
38. Versioning a RESTful web API
System
Analysis
and
Design,
Spring
2021,
Sharif
University
By
Vahid
Rahimian
38
39. Versioning a RESTful web API
ā¢ URI Versioning
https://adventure-works.com/v2/customers/3
ā¢ Query string versioning
https://adventure-works.com/customers/3?version=2
ā¢ Header versioning
System
Analysis
and
Design,
Spring
2021,
Sharif
University
By
Vahid
Rahimian
39
40. Versioning a RESTful web API
ā¢ Media type versioning
System
Analysis
and
Design,
Spring
2021,
Sharif
University
By
Vahid
Rahimian
40
41. SOAP, REST,
GraphQL, and gRPC
System
Analysis
and
Design,
Spring
2021,
Sharif
University
By
Vahid
Rahimian
41
42. SOAP
ā¢ Simple Object Access Protocol (SOAP)
ā¢ A protocol for exchanging information
encoded in Extensible Markup
Language (XML) between a client and
a procedure or service that resides on
the Internet
System
Analysis
and
Design,
Spring
2021,
Sharif
University
By
Vahid
Rahimian
42
43. SOAP
ā¢ SOAP is typically used with the Web
Service Description Language (WSDL).
ā¢ WSDL describes how to structure the
SOAP request and response messages
System
Analysis
and
Design,
Spring
2021,
Sharif
University
By
Vahid
Rahimian
43
49. REST
ā¢ Representational State Transfer
ā¢ An architectural style devised by Roy
Fielding in his 2000 Ph.D. thesis.
ā¢ Use the standard HTTP methods, GET,
POST, PUT and DELETE, to query and
mutate resources represented by URIs
on the Internet.
System
Analysis
and
Design,
Spring
2021,
Sharif
University
By
Vahid
Rahimian
49
51. HATEOAS
ā¢ Hypermedia as the Engine of
Application State
ā¢ a REST response can contain links that
describe operations or followup
workflow steps relevant to the given
resource.
System
Analysis
and
Design,
Spring
2021,
Sharif
University
By
Vahid
Rahimian
51
52. REST can use HATEOAS
concept
ā¢ REST uses HATEOAS to define
operations and workflow tasks that
are relevant to a resource
System
Analysis
and
Design,
Spring
2021,
Sharif
University
By
Vahid
Rahimian
52
55. GraphQL
ā¢ GraphQL is a technology that came
out of Facebook but is now open-
source specification.
ā¢ The underlying mechanism for
executing queries and mutations is
the HTTP POST verb.
ā¢ GraphQL requests can be sent via
HTTP POST or HTTP GET requests.
System
Analysis
and
Design,
Spring
2021,
Sharif
University
By
Vahid
Rahimian
55
56. GraphQL
ā¢ as the name implies, GraphQL is
intended to represent data in a graph.
ā¢ Instead of the columns and rows
found in a relational database or the
collection of structured documents
found in a document-centric database
such as MongoDB, a graph database is
a collection of nodes and edges.
System
Analysis
and
Design,
Spring
2021,
Sharif
University
By
Vahid
Rahimian
56
57. GraphQL Query
ā¢ Unlike REST, in which the caller
has no control over the structure of
the returned dataset (maybe just
āfieldsā), GraphQL allows you to
define the structure of the returned
data explicitly in the query itself.
System
Analysis
and
Design,
Spring
2021,
Sharif
University
By
Vahid
Rahimian
57
60. GraphQL Request
ā¢ POST requests sent with the Content-
Type header application/graphql must
have a POST body content as a
GraphQL query string.
System
Analysis
and
Design,
Spring
2021,
Sharif
University
By
Vahid
Rahimian
60
61. GraphQL Request
ā¢ POST requests sent with the Content-
Type header application/json must
have a POST body in the following
JSON format:
System
Analysis
and
Design,
Spring
2021,
Sharif
University
By
Vahid
Rahimian
61
62. GraphQL Request
ā¢ In GET requests, the query, variables,
and operation are sent as URL-
encoded query parameters in the
URL.
System
Analysis
and
Design,
Spring
2021,
Sharif
University
By
Vahid
Rahimian
62
63. GraphQL Response
ā¢ The ādataā field contains the result of
your GraphQL request.
ā¢ The āextensionsā field contains extra
metadata for the request with metrics
and trace information for the request.
ā¢ The āerrorsā field is a JSON list where
each entry has a "message" field that
describes the error.
System
Analysis
and
Design,
Spring
2021,
Sharif
University
By
Vahid
Rahimian
63
68. GraphQL Subscriptions
ā¢ Opens the door to asynchronous
messaging.
ā¢ Query and mutation data exchange under
GraphQL is synchronous due to the
request-response pattern inherent in the
HTTP/1.1 protocol.
ā¢ However, GraphQL allows users to
receive messages asynchronously when a
specific event is raised on the server-side
System
Analysis
and
Design,
Spring
2021,
Sharif
University
By
Vahid
Rahimian
68
70. gRPC
ā¢ A data exchange technology developed
by Google and then later made open-
source.
ā¢ Like GraphQL, it's a specification that's
implemented in a variety of languages.
ā¢ Unlike REST and GraphQL, which use
text-based data formats, gRPC uses
binary format (increases performance)
System
Analysis
and
Design,
Spring
2021,
Sharif
University
By
Vahid
Rahimian
70
71. gRPC Protocol Buffers
ā¢ gRPC uses the Protocol Buffers binary
format.
ā¢ Both the client and server in a gRPC data
exchange shall have access to the same
schema definition
ā¢ By convention, a Protocol Buffers definition
is defined in a .proto file.
ā¢ The .proto file provides the "dictionary" by
which data is encoded and decoded to and
from the Protocol Buffers binary format.
System
Analysis
and
Design,
Spring
2021,
Sharif
University
By
Vahid
Rahimian
71
73. gRPC and HTTP/2
ā¢ In addition to using Protocol Buffers
to encode data and thus increase
performance, gRPC has another
benefit.
ā¢ It supports bidirectional,
asynchronous data exchange. This is
because gRPC is based on the HTTP/2
protocol.
System
Analysis
and
Design,
Spring
2021,
Sharif
University
By
Vahid
Rahimian
73
74. HTTP/2
ā¢ Unlike HTTP/1.1, which supports only a
request-response interaction over a single
connection, HTTP/2 supports any number
of requests and responses over a single
connection.
ā¢ Connections can also be bidirectional.
ā¢ under HTTP/2, a client opens a
connection to a target server, and that
connection stays open until either the
client or server closes it.
ā¢ gRPC allows data streams as well. The
steam can emanate from the client or
from the server.
System
Analysis
and
Design,
Spring
2021,
Sharif
University
By
Vahid
Rahimian
74
75. gRPC schema in protocol buffer
language format
System
Analysis
and
Design,
Spring
2021,
Sharif
University
By
Vahid
Rahimian
75
77. Sample ProtoBuff Message
ā¢ In an application, you create a Test1 message
and set a to 150. You then serialize the message
to an output stream. If you were able to examine
the encoded message, you'd see three bytes:
System
Analysis
and
Design,
Spring
2021,
Sharif
University
By
Vahid
Rahimian
77
78. Sample ProtoBuff Message
ā¢ Now let's say you construct a Test4, providing
the values 3, 270, and 86942 for the repeated
field d. Then, the encoded form would be:
System
Analysis
and
Design,
Spring
2021,
Sharif
University
By
Vahid
Rahimian
78
81. API Communication
ā¢ a REST client written in Go can
communicate with a REST server
written in Node.JS. Or, you can
execute a query or mutation from the
curl command.
ā¢ Same goes for GraphQL, gRPC, and
SOAP
System
Analysis
and
Design,
Spring
2021,
Sharif
University
By
Vahid
Rahimian
81
83. SOAP: Pros
ā¢ SOAP can be implemented using a variety
of protocols, not only HTTP but SMTP
and FTP as well.
ā¢ SOAP supports discovery via WSDL and
it's language agnostic.
ā¢ SOAP has been around for a while. There
is still a good deal of legacy SOAP
implementations that need to be
maintained.
System
Analysis
and
Design,
Spring
2021,
Sharif
University
By
Vahid
Rahimian
83
84. SOAP: Cons
ā¢ SOAP can be considered a complex message
format with a lot of ins and outs to the
specification.
ā¢ The verbose nature of XML which is the format
upon which SOAP is based, coupled with the
reliance on external namespaces to extend the
basic message format makes the protocol
difficult to manage.
ā¢ SOAP messages can get quite large.
ā¢ Moving bulky, text based, SOAP messages
between source and target takes a long time in
comparison to binary messaging protocols such
as gRPC
System
Analysis
and
Design,
Spring
2021,
Sharif
University
By
Vahid
Rahimian
84
85. SOAP: Cons
ā¢ SOAP is a legacy protocol. While
thereās a lot of maintenance work
to be done with those systems that
use it, new architectures are taking
a more modern approach to inter-
service communication.
System
Analysis
and
Design,
Spring
2021,
Sharif
University
By
Vahid
Rahimian
85
86. REST: Pros
ā¢ REST is simple, well-known, and
widely used.
ā¢ You make a call on a resource
represented by a URL on the Internet
using an HTTP verb and get a
response back in JSON or XML.
ā¢ Productivity under REST is almost
immediate.
System
Analysis
and
Design,
Spring
2021,
Sharif
University
By
Vahid
Rahimian
86
87. REST: Cons
ā¢ REST is immutable in terms of the data
structure of a response.
ā¢ Given the response/response aspect of
HTTP/1.1, REST can be slow.
System
Analysis
and
Design,
Spring
2021,
Sharif
University
By
Vahid
Rahimian
87
88. GraphQL: Pros
ā¢ GraphQL is flexible and growing in
popularity.
ā¢ The latest version of GitHub's API is
published using GraphQL. Yelp
publishes its API in GraphQL, as does
Shopify. The list continues to grow.
ā¢ The GraphQL specification covers every
aspect of API implementation, from
Scalars, Types, Interfaces, Unions,
Directives, ā¦
System
Analysis
and
Design,
Spring
2021,
Sharif
University
By
Vahid
Rahimian
88
89. GraphQL: Cons
ā¢ QraphQL is complex and hard to
implement. While the specification
allows for customization, the basic
framework cannot be avoided. You
have to do things according to the
GraphQL way.
ā¢ REST, on the other hand, has a limited
rule set to follow.
System
Analysis
and
Design,
Spring
2021,
Sharif
University
By
Vahid
Rahimian
89
90. GraphQL vs REST
ā¢ It's the difference between making a
skateboard and making an automobile.
No matter what, you need four wheels as
well as a way to start and stop, but a
skateboard (REST) is far easier to make
and operate than an automobile
(GraphQL).
ā¢ It's a question of tradeoffs and making
sure the benefits of use outweigh the cost
of implementation.
ā¢ Once GraphQL is implemented, users
find it a better developer experience than
System
Analysis
and
Design,
Spring
2021,
Sharif
University
By
Vahid
Rahimian
90
91. gRPC: Pros
ā¢ gRPC is exact and wicked fast.
ā¢ It's become a de facto standard for
inter-service data exchange on the
backend.
ā¢ Bidirectional streaming capabilities that
are provided by HTTP/2 allow gRPC to
be used in situations where REST or
GraphQL can't even be considered.
System
Analysis
and
Design,
Spring
2021,
Sharif
University
By
Vahid
Rahimian
91
92. gRPC: Cons
ā¢ Both client and server need to support the
same Protocol Buffers specification. This
is a significant undertaking in terms of
version control.
ā¢ Under REST or GraphQL, one can add a
new attribute(s) to a resource (REST) or
type (GraphQL) without running much risk
of breaking the existing code. Making
such additions in gRPC can have a
detrimental impact. Thus, updates to the
.proto file need to be carefully
coordinated.
System
Analysis
and
Design,
Spring
2021,
Sharif
University
By
Vahid
Rahimian
92
93. gRPC: Cons
ā¢ Another challenge is that HTTP/2 does
not have universal support for public-
facing client-server interactions on the
Internet.
ā¢ Not all websites on the Internet support
HTTP/2.
System
Analysis
and
Design,
Spring
2021,
Sharif
University
By
Vahid
Rahimian
93
94. gRPC: Cons
ā¢ gRPC is that it takes time to attain
mastery.
ā¢ Some time can be saved by using the
protoc tool. protoc will auto-generate
gRPC client and server code according
to a particular programming language
based on a specific .proto file.
ā¢ It's useful for creating boilerplate code,
but doing more complex programming
requires a lot more work.
System
Analysis
and
Design,
Spring
2021,
Sharif
University
By
Vahid
Rahimian
94
95. gRPC as a Backend Technology
ā¢ gRPC is best suited to situations where
developers control both client and
server data exchange activities.
Typically such boundaries exist on the
backend. Hence, the prominence of
gRPC as a backend technology.
System
Analysis
and
Design,
Spring
2021,
Sharif
University
By
Vahid
Rahimian
95
96. gRPC: Performance over Flexibility
ā¢ gRPC is a very particular API format
that provides lightning-fast execution at
the expense of flexibility.
ā¢ Yet, if you have an application in which
nanoseconds count, gRPC includes
speed that is hard to match when using
REST or GraphQL.
System
Analysis
and
Design,
Spring
2021,
Sharif
University
By
Vahid
Rahimian
96
97. Any Questions?
Your time is limited, donāt waste it living someone elseās life
Steve Jobs, Stanford University speech, 2005
System
Analysis
and
Design,
Spring
2021,
Sharif
University
By
Vahid
Rahimian
97