REST Flashcards

1
Q

What is API?

A
  • API = Application Programming Interface
  • Application = any software with a distinct function
  • Interface = contract between the application through which the
    function can be accessed from the surrounding world
  • Programming = the application interface can be accessed programmatically, i.e., from another software
  • Compare to UI (Application User Interface)

API (Application Programming Interface) is a set of rules and protocols that allows interaction between different software components or services.

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

What is REST?

A

REST = Representational State Transfer

Software architectural style for building distributed hypermedia

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

Set of following architectural principles (REST)

A
  • resource orientation
  • unique resource identification
  • stateless client/server interaction
  • uniform interface
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Resource Orientation

A
  • resource = concrete or abstract thing/action we want to publish
    —* everything is a resource in REST
  • resource representation ~ state of the resource
    —* document that can be sent between communicating peers
    —* representation format needs to be established
    —-different (meta-)formats may be used(HTML, XML, JSON, RDF, AtomPub, …)
    each resource can have more representations ,in different formats
    dataformats==mediatypes
  • representation contains links to related resources
    —* representation format must support links
    —* applications that consume resources navigate instead of calling
    —* navigation = transition to next state
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Unique Resource Identification

A
  • each resource has a unique ID (name)
  • need to distinguish resource ID from resource representation ID
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Stateless Client/Server Communication

A

Each request from the client contains all the necessary data to process the request on the server. The server does not persist state between requests from the same client, making it easier to scale and improve system reliability.

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

Resource Manipulation

A
  • uniform interface for resource manipulation
  • do not encode verbs into resource identifiers

Uniform Interface: The RESTful API provides a uniform interface for interacting with resources. This includes using standard HTTP methods (GET, POST, PUT, DELETE, and others) to perform operations on resources, as well as uniform conventions for identifying resources via URI (Uniform Resource Identifier), data formatting (e.g., JSON, XML), and others. aspects of interaction with resources.

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

HTTP-methods and REST

A

The RESTful API relies on a limited set of HTTP methods such as GET, POST, PUT, and DELETE to perform operations on resources on the server, while the API may use different methods depending on the implementation.

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

REST FORMATS

A

An API can have various data transfer formats such as XML, JSON, SOAP, etc. while a RESTful API usually uses the JSON format for data transfer.

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

REST Identification

A

The RESTful API uses a URI (Uniform Resource Identifier) to identify resources on the server, while an API can use a variety of methods and ways to identify resources.

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

Stateless

A

The RESTful API is built on the principle of “Stateless” (stateless), which means that each request from the client contains all the necessary data to process the request on the server. The API, in turn, can be either “Stateless” or “Stateful” (stateful), depending on the implementation.

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

REST HTTP status codes

A

RESTful APIs typically use HTTP status codes to indicate the result of an operation, such as 200 OK, 201 Created, 404 Not Found, etc. The API can also use HTTP status codes, but this is not a requirement.

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

Caching

A

Caching: The RESTful API supports caching, which allows clients to keep local copies of resources on their side to improve performance and reduce server load.

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

Client-server architecture

A

Client-server architecture: The system is divided into a client part, which is responsible for the user interface and user interaction, and a server part, which processes requests from clients and manages resources. This allows you to independently develop the client and server parts of the system.

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

REST != HTTP

A

HTTP (Hypertext Transfer Protocol) is one of the most common protocols used to implement RESTful APIs. However, REST and HTTP are different things. REST defines the architectural principles for organizing communication between a client and a server, while HTTP is a data transfer protocol used to exchange information between a client and a server.

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