APIs Flashcards

1
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
2
Q

What is REST?

A

REST is a ruleset that defines best practices for sharing data between clients and the server

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

What are the typical methods you use with a REST API?

A

You use CRUD functions only, regardless of the complexity. REST applications use HTTP methods like GET, POST, DELETE, and PUT.

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

Which architectural requirements need to be met for an API to be considered RESTful?

A

Client-server: REST applications have a server that manages application data and state. The server communicates with a client that handles the user interactions. A clear separation of concerns divides the two components. This means you can update and improve them in independent tracks.

Stateless: Servers don’t maintain client state, clients manage their own application state. The client’s requests to the server contain all the information required to process them.

Cacheable: servers must mark their responses as cacheable or not. Systems and clients can cache responses when convenient to improve performance. They also dispose of non-cacheable information, so no client uses stale data.

Uniform interface: This is REST’s most well-known feature or rule. Fielding says “The central feature that distinguishes the REST architectural style from other network-based styles is its emphasis on a uniform interface between components.” REST services provide data as resources, with a consistent namespace.

Layered system: Components in the system cannot see beyond their layer. This confined scope allows you to easily add load-balancers and proxies to improve authentication security or performance.

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

What is the benefit of these architectural requirements?

A

They create an application with clear separations of concerns.

The client:

  • receives server data when requested
  • manipulates or displays the data
  • notifies the server of any state changes
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

When would you NOT want to use REST?

A

Because all requests need to include all data to complete the request in the message payload, this can be restrictive. This works well when it we need a bit of data but quickly becomes unmanageable for complex requests.

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