Lecture 9 - REST Flashcards

1
Q

What does a URI tell us? (REST addressable resources basic principle)

A

protocol
host/port
resource path

ex: scheme://host:port/path?queryString#fragment

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

URI parameters
Query parameters
and matrix parameters?

A

/customers/{customer-id}

http://sales.com/customers?zip=02115

color=black
(name-value pairs after segment)

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

A uniform constrained interface (UCI) is a standardized way of interacting with a system. What are the operations? Are they idempotent? (REST basic principle)

A

GET
PUT
DELETE
POST

All idempotent EXCEPT for post (can submit a form multiple times).

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

What does REST stand for?

A

REpresentational State Transfer

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

What does REST provide?

A

Service-oriented interface

Reduces load on server (HTTP caching)

Scalable (Stateless + caching)

Uses same principles as internet (Uniform interface)

Can support any data format, any programming language.

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

What is GraphQL?

A

Developed by Facebook, query language, less requests required.

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

what is gRPC?

A

Developed by Google, alternative non OOP method (C), low overhead, protocol buffers.

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

What are websockets?

A

Full-duplex binary protocol (think of c project)

Establish TCP connection, good for real-time low latency.

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

What is MQTT (Message Queuing Telemetry Transport)?

A

Lightweight protocol for IoT devices (wearables, smart home devices, etc).

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

Why is REST representation-oriented?
(Basic principle)

A

Each service is addressable through a URI.

Representations are exchanged between client and service.

Ex: JSON, XML, YAML

With HTTP the representation is in the body of the request or response

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

What does it mean that REST communicates statelessly?

A

RESTful applications do not maintain sessions/conversations.

Each request is independent and contains all information needed to process the request.

(scalability, less work from server)

Resources can have their own state, client responsible for holding conversational state

(RESTful services do not rely on sessions or cookies)

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

What is HATEOAS (Hypermedia as the Engine of Application State)?

A

Document can have links (embedded in the response) to other services or documents.

Ex: next, previous

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

GET
POST
PUT
DELETE

when to use?

A

GET - Get a list of values using query parameters or getting an individual item with an id encoded in URI

POST - sends a representation of the object to the URI (no id)

PUT - sends a representation of the object to the URI (id known)

DELETE - objects URI and delete (200 ok or 204 no content)

Put vs Post:
put for update or create (id-known, idempotent)

post for create or submit data (id-unknown, non-idempotent)

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