RESTful API Flashcards

1
Q

HTTP methods

A

CRUD - POST (create), GET (read), PUT (update), DELETE (delete)

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

6 Requirements for RESTful API

A

1) Client-server are independent. Interact with each other through requests
2) Stateless. server doesn’t store any state about prev requests (so client request must contain all information required for server to process it)
3) Cacheable. Server includes a version number in its messages to decide if it should request a resource again or use the already cached data
4) Uniform interface: identification of resources (via a unique URI - Uniform resource identifier), Manipulation of Resources through representations (JSON, not SQL query), self-descriptive messages (application/json that tells receiver how to parse the message), HATEOAS (response from the API should include links to other parts of the API – can figure out how API works without external documentation)
5) Layered System. REST allows for API on one server, LB inbetween, data on another server
6)

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

RESTful stands for

A

representational state transfer

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

What IS RESTful API?

A

a way of writing web API (appelation programming interface) that focuses on system and state of resources and how they should be transferred over HTTP protocols.

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

PUT vs POST

A

PUT puts a file at a URI and replaces the existing one, if there is one. POST sends data to a URI and expects the resource at that URI to deal with the request.
REST uses GET
PUT responses aren’t cacheable.

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

Advantages / Disadvantages

A

Advantages: high performance, reliability, scalability. Statelessness allows client & server to operate individually. Supports various data transfer techs (JSON, XML, etc). Uses less bandwidth than other methods.
Disadvantages: HTTP methods limit you to synchronous requests. Doesn’t enforce security practices

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

AJAX vs REST

A

AJAX client can make a RESTful request to a REST API but AJAX isn’t an architectural style. It’s a web development technique for client-side applications. AJAX allows web apps to send and retrieve data from a server asynchronously without interfering with the display and behavior of the existing page.

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

HTTP response codes

A

2XX - successful request
4XX - bad or unauthorized request
5XX - service unavailable (server issue)

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