REST API's Flashcards

1
Q

What is REST & RESTful API?

A

Representational state transfer

It’s an architectural style for designing networked applications. REST is a set of guidelines for creating API’s

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

What are the top 5 REST guidelines and the advantages of them?

A
  1. Separation of client and server
  2. Stateless
  3. Uniform interface
  4. Cacheable
  5. Layered system
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What are the differences between SOAP API and REST API?

A

Architecture: REST is an architectural style, SOAP is a protocol (Simple Object Acess Protocol)

Protocol: REST uses HTTP or HTTPS, SOAP can user various protocols (HTTP, SMTP, etc)

Message format: REST uses lightweight formats like JSON or XML, SOAP typically uses XML.

State: REST is stateless, SOAP can be stateful or stateless.

Error handling: REST relies on HTTP status codes, SOAP defines its own fault mechanism.

Performance: REST is generally faster, SOAP slower.

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

What are HTTP verbs and HTTP methods?

A

HTTP methods, also known as HTTP verbs, are a set of actions that a client can take on a resource.

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

Explain the concept of idempotence in RESTful APIs

A

Same operation will yield the same output.

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

What are the role of status codes in RESTful APIs?

A

Used to convey the results of a client’s request.

1XX (info)
100: continue

2XX (success)
200: OK, 201: created, 202: accepted, 204: no content

3XX (redirection)
300: multiple choices

4XX (client error)
400: bad request, 401: unauthorized, 403: forbidden, 404: not found

5XX (server error)
500: internal server error, 501: not implemented, 502: bad gateway, 503: service unavailable

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

What is CORS?

A

Cross origin resource sharing

It’s a security feature implemented in web browsers that restricts web pages or scripts from making requests to a different domain than the one that served the web page.

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

How to remove the CORS restrictions in RESTful API’s in Express.js?

A

app.use(cors());

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

What is serialization and deserialization?

A

Converting an object to json: serialization
Converting json to object: deserialization

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