REST

Réussis tes devoirs et examens dès maintenant avec Quizwiz!

What is a web service?

-A service available over the web. -Enables communication between applications over the web -provides a standard protocol/format for communication. -Platform independent communication -Using web services, two different applications (implementation) can talk to each other and exchange data/information

What are the guiding principals of REST?

-Client Server -Stateless -Cacheable -Uniform Interface -Layered System -Code on demand (optional)

What is JSON?

-Javascript object notation. -Lightweight data-interchange format. -Based on a subset of Javascript.

Four typical operations when interacting with a website?

-Read content, whether protected or not. -Delet content, for example when we cancel items in a shopping cart. -Update content, for exampe when we change email or phone details on a social networking site. -Create content, such as when we create a social networking account.

URI vs URL

-Uniform Resource Identifier -A Uniform Resource Identifier (URI) is a compact sequence of characters that identifies an abstract or physical resource. -Uniform Resource Locator -The term "Uniform Resource Locator" (URL) refers to the subset of URIs that, in addition to identifying a resource, provide a means of locating the resource by describing its primary access mechanism (e.g., its network "location").

What are the core components of a HTTP Request?

A HTTP Request has five major parts − Verb − Indicate HTTP methods such as GET, POST, DELETE, PUT etc. URI − Uniform Resource Identifier (URI) to identify the resource on server. HTTP Version − Indicate HTTP version, for example HTTP v1.1 . Request Header − Contains metadata for the HTTP Request message as key-value pairs. For example, client ( or browser) type, format supported by client, format of message body, cache settings etc. Request Body − Message content or Resource representation.

What are the core components of a HTTP response?

A HTTP Response has four major parts − Status/Response Code − Indicate Server status for the requested resource. For example 404 means resource not found and 200 means response is ok. HTTP Version − Indicate HTTP version, for example HTTP v1.1 . Response Header − Contains metadata for the HTTP Response message as key-value pairs. For example, content length, content type, response date, server type etc. Response Body − Response message content or Resource representation.

What is messaging in RESTful webservices?

A client sends a message in form of a HTTP Request and server responds in form of a HTTP Response. This technique is termed as Messaging. These messages contain message data and metadata i.e. information about message itself.

What is REST?

Acronym for REpresentational State Transfer. It is an architectural style for distributed hypermedia systems. Like any other architectural style, REST also does have it's own 6 guiding constraints which must be satisfied if an interface needs to be referred as RESTful.

What is a RESTful API?

An API that conforms to the REST architecture. -Will typically use HTTP as communication protocol. -Will typically use HTTP verbs (e.g. GET, POST, PUT, DELETE)

What is an Idempotent Request?

An operation is idempotent if a sequence of two or more of the same operation result in the same resource state as would a single instance of that operation.

What does API stand for? What is it?

Application programing interface. Basically its something that allows one piece of software to talk to another.

Explain the Uniform Interface principal:

By applying the software engineering principle of generality to the component interface, the overall system architecture is simplified and the visibility of interactions is improved. In order to obtain a uniform interface, multiple architectural constraints are needed to guide the behavior of components. REST is defined by four interface constraints: identification of resources; manipulation of resources through representations; self-descriptive messages; and, hypermedia as the engine of application state.

Explain the Client Server principal:

By separating the user interface concerns from the data storage concerns, we improve the portability of the user interface across multiple platforms and improve scalability by simplifying the server components.

What is CRUD?

CRUD: -Create -Retrieve -Update -Delete These are the four typical operations that an app would perform on a data store.

Explain the Cacheable principal:

Cache constraints require that the data within a response to a request be implicitly or explicitly labeled as cacheable or non-cacheable. If a response is cacheable, then a client cache is given the right to reuse that response data for later, equivalent requests.

What is caching?

Caching refers to storing server response in client itself so that a client needs not to make server request for same resource again and again. A server response should have information about how a caching is to be done so that a client caches response for a period of time or never caches the server response.

What does the HTTP DELETE method do?

Deletes a specified resource.

What is a server / service provider?

Develops / implements the application (web service) and makes it available over the internet (web)

Explain the Stateless principal:

Each request from client to server must contain all of the information necessary to understand the request, and cannot take advantage of any stored context on the server. Session state is therefore kept entirely on the client.

What are the advantages of statelessness in RESTful Webservices?

Following are the benefits of statelessness in RESTful web services − Web services can treat each method request independently. Web services need not to maintain client's previous interactions. It simplifies application design. As HTTP is itself a statelessness protocol, RESTful Web services work seamlessly with HTTP protocol.

What are the disadvantages of statelessness in RESTful Webservices?

Following is the disadvantage of statelessness in RESTful web services − Web services need to get extra information in each request and then interpret to get the client's state in case client interactions are to be taken care of.

What HTTP verbs are idempotent? What is not?

GET, PUT, and DELETE are. POST is not.

What HTTP Status Code 400 states?

It means, BAD REQUEST, states that invalid input is provided e.g. validation error, missing data.

What HTTP Status Code 409 states?

It means, CONFLICT, states conflict situation while executing the method for example, adding duplicate entry.

What HTTP Status Code 201 states?

It means, CREATED, when a resource is successful created using POST or PUT request. Return link to newly created resource using location header.

What HTTP Status Code 401 states?

It means, FORBIDDEN, states that user is not having access to method being used for example, delete access without admin rights.

What HTTP Status Code 500 states?

It means, INTERNAL SERVER ERROR, states that server has thrown some exception while executing the method.

What HTTP Status Code 204 states?

It means, NO CONTENT, when response body is empty for example, a DELETE request.

What HTTP Status Code 404 states?

It means, NOT FOUND, states that method is not available.

What HTTP Status Code 304 states?

It means, NOT MODIFIED, used to reduce network bandwidth usage in case of conditional GET requests. Response body should be empty. Headers should have date, location etc.

What HTTP Status Code 200 states?

It means, OK, shows success.

What should be the purpose of HEAD method of RESTful web services?

It should return only HTTP Header, no Body and should be read only.

What does JSON stand for? (acronym)

Javascript object notation.

What is the medium and format of REST?

Medium: HTTP (POST, GET, PUT, DELETE, ...) Format: XML / JSON / TEXT...

JSON data types

Number: no difference between integers and floats. String: String of unicode characters. Use double quotes. Boolean: True or false Array: Ordered list of 0 or more values. Object: unordered collection of key value pairs. Null: empty value

What is purpose of a URI in REST based webservices?

Purpose of an URI is to locate a resource(s) on the server hosting the web service.

Explain the Code On Demand principal:

REST allows client functionality to be extended by downloading and executing code in the form of applets or scripts. This simplifies clients by reducing the number of features required to be pre-implemented.

What is a Resource in REST?

REST architecture treats every content as a resource. These resources can be text files, html pages, images, videos or dynamic business data. REST Server simply provides access to resources and REST client accesses and modifies the resources. Here each resource is identified by URIs/ global IDs.

Which protocol is used by RESTful webservices?

RESTful web services make use of HTTP protocol as a medium of communication between client and server.

What does REST stand for?

REpresentational State Transfer

Why is it called Representational State Transfer:

Representational: Clients posses the information necessary to identify, modify, and/or delete a web source. State: all resource state information is stored on the client. Transfer: client state is passed from the client to the service through http.

What does the HTTP GET method do?

Retrieves data from a specified resource.

What does the HTTP OPTIONS method do?

Returns the supported HTTP methods.

What does the HTTP HEAD method do?

Same as get, but does not return a body.

What does SOAP stand for? What is its medium and format?

Simple Object Access Protocol Medium: HTTP (POST) Format: XML

What does the HTTP POST method do?

Submit data to be processed to a specific resource.

Explain the Layered System principal:

The layered system style allows an architecture to be composed of hierarchical layers by constraining component behavior such that each component cannot "see" beyond the immediate layer with which they are interacting.

What is URI?

URI stands for Uniform Resource Identifier. Each resource in REST architecture is identified by its URI.

What does the HTTP PUT method do?

Update a specified resource.

What does the HTTP PATCH method do?

Update partial resources.

How does JSON store data?

Using key value pairs: -Must use specific data types {"name":"Brad"}

JSON example with an embedded object and an array

{ "name" : "Brad", "age" : 35, "address" : { "street" : "5 main st", "city" : "Boston" }, "children" : ["Brianna", "Nicole"] }

How do the key value pairs look in a JSON file?

{"name":"Brad"} -Double quotes around both key and value. -Must use specific data types


Ensembles d'études connexes

Chapter 34: Acute Kidney Injury and Chronic Kidney Disease

View Set

Failed test questions 3 up to ? 190

View Set

Unit 2 Module 1 Enlightened Ideas in the Founding Documents Quiz 2 of 2

View Set

Musician's Guide to Fundamentals: Chapter 1 - 6 Review

View Set

480- Complex Exam 1; Module 1 (Introduction to Complex Care)

View Set

English For Today (BD-HSC)-Nelson Mandela, from Apartheid Fighter to President (MCQ)

View Set