REST Flashcards

1
Q

Layered Architecture concept:

A

Lower layer provides services to upper layer

many upper layers can use the same lower layer

Knowledge of only the next layer (no jumping over layers)

lower layers can not call upper layers

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is REST (the concept)

A

REpresentational State Transfer

-We transfer a representation of the current state of a resource

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

REST Constraints

A
  1. Client-Server
  2. Stateless
  3. Cacheable
  4. Layered System
  5. Uniform interface
  6. Code-on-demand (optional)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Client-Server constraint

A

Seperation of concerns

Many user interfaces for the same data/business logic

User interface/frontend can evolve seperately from the backend

Applications can be ported to several platforms (multiple frontends for the same backend)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Stateless constraint

A

Visibility: For debugging, you only need to look at a single request

Reliability: Recovery from failure is easier (just resend the request)

Scalability: No need to store state on the server, easier to build distributed applications

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Cacheable constraint

A

Responses can be reused

User-perceived performance increased

downside: Reliability

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Layered System constraint

A

Easy to replace hidden layers

easy to add/remove layers

downside: overhead and latancy

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Code-on-demand constraint

A

Server can send executable code to the client

Allows to extend client with additional functionality

downside: Visibility

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Uniform interface constraint

A

A uniform interface is required between components

Identification of resources
-Every resource can be identified using a URI/URL

Manipulation through representations
-No direct interaction with the data… use JSON or XML

Self descriptive messages
-Each request can be understood by the server in isolation… it has all the information… what is it requesting? JSON or something

HATEOAS
-Use links

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Why use REST

A

Helps build applications that are scalable, general and maintainable

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Resources

A

Use plural nouns

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Useful things to keep in mind

A

Version your API (http://blabla.com/v1/

Use sorting, paging, field selection for GET requests

  • GET http://blabla.com/users?sortBy=username
  • > returns all users sorted by usernames

Return the created updated deleted resource when the request is successful

How well did you know this?
1
Not at all
2
3
4
5
Perfectly