HTTP, REST API Flashcards

1
Q

Which HTTP METHODS (verbs) can be used to “send data”?

A

POST, PUT, PATCH

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

Which HTTP METHOD removes a singleton resource?

A

DELETE

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

Who was the originator of the REST architecture?

A

Roy Fielding

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

Which HTTP METHOD is the most commonly used by REST API?

A

GET

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

Which group of HTTP status codes is used for Redirection messages?

A

3XX

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

Which group of HTTP status codes contains the Not Found message?

A

4XX

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

According to Roy Fielding, “The key abstractions of information in REST is a representation.”

A

False. Should be “a resource”, not representation.

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

Which of the 6 REST constraints ensures no client context/information is stored on the server between requests?

A

Statelessness

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

REST Clients, like Postman and Insomnia make responses from REST APIs more readable.

A

True

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

What does REST API stand for?

A

Representational State Transfer and Application Programming Interface

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

Which of the following strings must be added to the INSTALLED_APPS variable to add Django REST framework in the Django application?

A

‘rest_framework’

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

The “book_collection” view supports which HTTP requests?

A

GET, POST

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

The “book_instance” view supports which HTTP requests?

A

GET, PUT, DELETE

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

What new URL paths were added to the books/urls.py file to map requests to the new REST API views?

A

path(‘api/’, book_collection),

path(‘api//’, book_instance),

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

Data serialization is the process of converting complex data structures into a byte stream for storage, transfer and distribution.

A

True

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

What book attribute is NOT updated when the data is validated in the BookSerializer code?

A

id

17
Q

What argument is passed in to BookSerializer update function containing “cleaned” input data?

A

validated_data

18
Q

What error was returned when you issued the following HTTPie (http) command in our lab?
http GET “:8000/books/api/14/

A

HTTP/1.1 404 Not Found

19
Q

What book title was added using the HTTPie (http) command line client?

A

The Count of Monte Cristo

20
Q

What field did we update to correct an error in data entered using the HTTPie command line client?

A

year

21
Q

API endpoint:

A

a URL that returns an HTTP response in JSON format

22
Q

In Lab 9, what info did you retrieve using GET requests?

A
  • Currency exchange rates/data
  • TV show information for Ted Lasso, data from a specific episode
  • Penguin Random House API - the davinci code
23
Q

HTTP status 5XX:

A

internal server error

24
Q

Django REST API Framework - Serializers:

A

Serialization is the process of converting complex data (e.g. python object) into native Python datatypes that can easily be rendered in JSON, XML, or other content types.

Django REST API provides a variety of Serializers, including a ModelSerializer that provide shortcuts for serializing your data.

25
Q

Django Serializers:

A
  • ModelSerializer
  • Serializer
  • HyperlinkedModelSerializer
  • ListSerializer
  • BaseSerializer
26
Q

Renderers:

A

allow you to return HTTP response objects using various media types, depending on the Accept header in the request

27
Q

Parsers:

A

Parsers are used to parse the content of incoming HTTP request objects based on the Content-Type header received in the HTTP request