Presentation is loading. Please wait.

Presentation is loading. Please wait.

Snejina Lazarova Senior QA Engineer, Team Lead CRMTeam Dimo Mitev Senior QA Engineer, Team Lead SystemIntegrationTeam Telerik QA Academy RESTful Web Services.

Similar presentations


Presentation on theme: "Snejina Lazarova Senior QA Engineer, Team Lead CRMTeam Dimo Mitev Senior QA Engineer, Team Lead SystemIntegrationTeam Telerik QA Academy RESTful Web Services."— Presentation transcript:

1 Snejina Lazarova Senior QA Engineer, Team Lead CRMTeam Dimo Mitev Senior QA Engineer, Team Lead SystemIntegrationTeam Telerik QA Academy RESTful Web Services

2 RESTful Web Services – Main Concepts RESTful Web Services – Main Concepts REST Concepts REST Concepts REST Constraints REST Constraints A RESTful System Main Actors A RESTful System Main Actors Resources Resources Representations Representations Actions Actions soapUI soapUI 2

3 In the real world a "service" is: In the real world a "service" is: A piece of work performed by a service provider A piece of work performed by a service provider Provides a client (consumer) some desired result by some input parameters Provides a client (consumer) some desired result by some input parameters The requirements and the result are known The requirements and the result are known Easy to use Easy to use Always available Always available Has quality characteristics (price, execution time, constraints, etc.) Has quality characteristics (price, execution time, constraints, etc.) 3

4 Lightweight Architecture for Web Services

5 Representational state transfer (REST) is a style of software architecture for distributed hypermedia systems such as the World Wide Web. http://en.wikipedia.org/wiki/Representational_State_Transfer Application state and functionality are resources Application state and functionality are resources Every resource has an URI Every resource has an URI All resources share a uniform interface All resources share a uniform interface This natively maps to the HTTP protocol This natively maps to the HTTP protocol

6 The architecture consist of The architecture consist of clients and servers clients and servers requests and responses requests and responses Requests and responses are build around the transfer of representations of resources Requests and responses are build around the transfer of representations of resources Clients contain representations, servers the resources (concepts) themselves Clients contain representations, servers the resources (concepts) themselves

7 A RESTful system should be A RESTful system should be Client-server Client-server Stateless Stateless Cacheable Cacheable Uniformly accessible Uniformly accessible

8 Client-server Client-server Clients are separated from servers by a uniform interface Clients are separated from servers by a uniform interface 8

9 Stateless Stateless There should be no need for the service to keep users' session There should be no need for the service to keep users' session Each request should be independent of others Each request should be independent of others 9

10 Cacheable Cacheable Clients are able to cache responses Clients are able to cache responses Responses must, implicitly or explicitly, define themselves as cacheable or not Responses must, implicitly or explicitly, define themselves as cacheable or not 10

11 Uniform Accessible Uniform Accessible Each resource must have a unique address and a valid point of access Each resource must have a unique address and a valid point of access 11

12 1. You type a URL into your browser to reach a specific HTML page 2. The browser gets and displays the elements of the HTML page The browser is getting a representation of the current state of that resource The browser is getting a representation of the current state of that resource 12

13 Resources Resources Representations Representations Actions Actions 13

14 A resources is "everything" the service can provide A resources is "everything" the service can provide State and functions of a remote application are also considered as resources State and functions of a remote application are also considered as resources 14

15 RESTful resource = anything that is addressable over the Web RESTful resource = anything that is addressable over the Web Addressable = anything that can be accessed and transferred between clients and servers Addressable = anything that can be accessed and transferred between clients and servers A resource must have a unique address over the Web A resource must have a unique address over the Web Under HTTP these are URIs Under HTTP these are URIs 15

16 Uniform Resource Identifier in a RESTful web services is a hyperlink to a resource Uniform Resource Identifier in a RESTful web services is a hyperlink to a resource It is only means for clients and servers to exchange representations of resources It is only means for clients and servers to exchange representations of resources 16

17 The representations of resources is what is sent back and forth clients and servers The representations of resources is what is sent back and forth clients and servers We never send or receive resources, only their representations We never send or receive resources, only their representations 17

18 The format of the representations is determined by the content-type The format of the representations is determined by the content-type The interaction of the representation on the resource is determined by the action The interaction of the representation on the resource is determined by the action GET GET SET SET POST POST DELETE DELETE 18

19 Content type is a reusable collection of settings that you want to apply to a certain category of content Content type is a reusable collection of settings that you want to apply to a certain category of content In REST we are using HTTP to communicate and we can transfer any kind of information that can be passed between clients and servers In REST we are using HTTP to communicate and we can transfer any kind of information that can be passed between clients and servers ex. test files, PDF documents, images, videos ex. test files, PDF documents, images, videos 19

20 Different clients are able to consume different representations of the same resource Different clients are able to consume different representations of the same resource A representation can take various forms, but its resource has to be available through the same URI A representation can take various forms, but its resource has to be available through the same URI 20

21 Comparing the Common Service Representation Formats

22 XML is markup-language for encoding documents in machine-readable form XML is markup-language for encoding documents in machine-readable form Text-based format Text-based format Consists of tags, attributes and content Consists of tags, attributes and content Provide data and meta-data in the same time Provide data and meta-data in the same time 22 HTML 5 Bay Ivan HTML 5 Bay Ivan WPF 4 Microsoft WPF 4 Microsoft WCF 4 Kaka Mara WCF 4 Kaka Mara UML 2.0 Bay Ali UML 2.0 Bay Ali

23 JSON (JavaScript Object Notation) JSON (JavaScript Object Notation) Standard for representing simple data structures and associative arrays Standard for representing simple data structures and associative arrays Lightweight text-based open standard Lightweight text-based open standard Derived from the JavaScript language Derived from the JavaScript language 23 { "firstName": "John", "lastName": "Smith", "age": 25, "firstName": "John", "lastName": "Smith", "age": 25, "address": { "streetAddress": "33 Alex. Malinov Blvd.", "address": { "streetAddress": "33 Alex. Malinov Blvd.", "city": "Sofia", "postalCode": "10021" }, "city": "Sofia", "postalCode": "10021" }, "phoneNumber": [{ "type": "home", "number": "212 555-1234"}, "phoneNumber": [{ "type": "home", "number": "212 555-1234"}, { "type": "fax", "number": "646 555-4567" }] { "type": "fax", "number": "646 555-4567" }]}, { "firstName": "Bay", "lastName": "Ivan", "age": 79 }

24 RSS (Really Simple Syndication) RSS (Really Simple Syndication) Family of Web feed formats for publishing frequently updated works Family of Web feed formats for publishing frequently updated works E.g. blog entries, news headlines, videos, etc. E.g. blog entries, news headlines, videos, etc. Based on XML, with standardized XSD schema Based on XML, with standardized XSD schema RSS documents (feeds) are list of items RSS documents (feeds) are list of items Each containing title, author, publish date, summarized text, and metadata Each containing title, author, publish date, summarized text, and metadata Atom protocol aimed to enhance / replace RSS Atom protocol aimed to enhance / replace RSS 24

25 25 W3Schools Home Page W3Schools Home Page http://www.w3schools.com http://www.w3schools.com Free web building tutorials Free web building tutorials RSS Tutorial RSS Tutorial http://www.w3schools.com/rss http://www.w3schools.com/rss New RSS tutorial on W3Schools New RSS tutorial on W3Schools XML Tutorial XML Tutorial http://www.w3schools.com/xml http://www.w3schools.com/xml New XML tutorial on W3Schools New XML tutorial on W3Schools

26 Under HTTP, actions are standard HTTP request Under HTTP, actions are standard HTTP request GET – retrieve a resource GET – retrieve a resource POST – create a resource POST – create a resource PUT – update a resource PUT – update a resource DELETE – delete a resource DELETE – delete a resource They make up the uniform interface used for client/server data transfers They make up the uniform interface used for client/server data transfers

27

28 Demo For detailed tutorial see: http://www.soapui.org/REST-Testing/getting- started.html http://www.soapui.org/REST-Testing/getting- started.html http://www.soapui.org/REST-Testing/getting- started.html

29 A REST Service contains any number of resources available on their corresponding path A REST Service contains any number of resources available on their corresponding path Resources themselves can have as many levels of child resources as desired Resources themselves can have as many levels of child resources as desired A child resources path will be the concatenation of all its parents path with its own A child resources path will be the concatenation of all its parents path with its own 29

30

31 QUERY parameters binds the value of a path segment to a resource method parameter QUERY parameters binds the value of a path segment to a resource method parameter 31

32 HEADER parameters are instead added as HTTP Headers to the outgoing request HEADER parameters are instead added as HTTP Headers to the outgoing request 32

33 TEMPLATE parameters are a flexible way of parameterizing the actual path of the request TEMPLATE parameters are a flexible way of parameterizing the actual path of the request 33

34 MATRIX parameters are another way of defining parameters to be added to the actual path of the resource, but before the query string MATRIX parameters are another way of defining parameters to be added to the actual path of the resource, but before the query string 34

35 35 Toolbar RequestEditor ResponseEditor

36 Demo

37 REST Console is an HTTP Request Visualizer and Constructor tool, helps developers build, debug and test RESTful APIs REST Console is an HTTP Request Visualizer and Constructor tool, helps developers build, debug and test RESTful APIs 37

38 Questions?


Download ppt "Snejina Lazarova Senior QA Engineer, Team Lead CRMTeam Dimo Mitev Senior QA Engineer, Team Lead SystemIntegrationTeam Telerik QA Academy RESTful Web Services."

Similar presentations


Ads by Google