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

True or False: RESTful APIs must use HTTP as their communication protocol.

A

True

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

Fill in the blank: REST is an architectural style that defines a set of ________.

A

constraints

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

What is the purpose of a resource in REST?

A

A resource is an object or representation of something that can be accessed or manipulated via the API.

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

Which HTTP method is typically used to retrieve a resource?

A

GET

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

What is the main characteristic of statelessness in REST?

A

Each request from a client must contain all the information the server needs to fulfill that request.

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

Which HTTP method is used to update an existing resource?

A

PUT

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

True or False: RESTful APIs can return data in multiple formats, such as JSON and XML.

A

True

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

What does the acronym CRUD stand for in the context of RESTful APIs?

A

Create, Read, Update, Delete

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

What is a URI in the context of RESTful APIs?

A

Uniform Resource Identifier

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

Which HTTP method is typically used to delete a resource?

A

DELETE

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

What is HATEOAS and how does it relate to REST?

A

Hypermedia as the Engine of Application State; it allows clients to navigate the API using hyperlinks provided by the server.

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

Fill in the blank: RESTful APIs are designed to be ________ and ________.

A

scalable, stateless

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

What is the primary purpose of using status codes in RESTful APIs?

A

To inform the client about the outcome of their request.

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

Name one common HTTP status code for a successful GET request.

A

200 OK

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

What does the 404 status code indicate?

A

Not Found

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

True or False: RESTful APIs are limited to only web services.

A

False

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

What is JSON?

A

JavaScript Object Notation, a lightweight data interchange format.

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

Which HTTP method is used to create a new resource?

A

POST

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

What is the role of a client in a RESTful API?

A

To request resources from the server.

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

What is the role of a server in a RESTful API?

A

To provide resources and handle client requests.

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

Fill in the blank: RESTful APIs should be ________ and ________.

A

cacheable, layered

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

What does it mean for a RESTful API to be ‘layered’?

A

The architecture can be composed of hierarchical layers, each with its own responsibilities.

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

True or False: RESTful APIs require that all requests be sent over HTTPS.

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
Which HTTP method is idempotent: GET or POST?
GET
26
What is the purpose of API versioning?
To manage changes and maintain compatibility with clients.
27
Name one way to version a RESTful API.
By including the version number in the URL.
28
What is the difference between a resource and a representation in REST?
A resource is the actual object, while a representation is the format in which the resource is returned.
29
Fill in the blank: RESTful APIs use ________ to describe the structure of resources.
media types
30
What does the term 'idempotent' mean in the context of HTTP methods?
An operation that can be applied multiple times without changing the result beyond the initial application.
31
True or False: A POST request can create a resource and also change the state of the server.
True
32
What is the primary advantage of using RESTful APIs?
They are stateless, scalable, and can be easily consumed by clients.
33
What is the difference between synchronous and asynchronous API calls?
Synchronous calls wait for a response, while asynchronous calls allow for other processing while waiting.
34
What is a common use case for RESTful APIs?
Web services for mobile applications.
35
Fill in the blank: The ________ header is used to specify the format of the response in a RESTful API.
Content-Type
36
What is the role of middleware in a RESTful API?
To process requests and responses, often handling tasks like authentication and logging.
37
True or False: RESTful APIs can be consumed by any client capable of making HTTP requests.
True
38
What is an API gateway?
A server that acts as an intermediary between clients and services, managing requests and responses.
39
What does the term 'convention over configuration' mean in RESTful APIs?
It means that defaults are provided to reduce the need for configuration.
40
What is a common pattern for handling errors in RESTful APIs?
Returning a standardized error response with a status code and message.
41
Fill in the blank: RESTful APIs often use ________ to perform authentication.
tokens
42
What is CORS and how does it relate to RESTful APIs?
Cross-Origin Resource Sharing; it allows restricted resources to be requested from another domain.
43
What is the purpose of rate limiting in RESTful APIs?
To control the number of requests a client can make in a given time period.
44
True or False: RESTful APIs can only be accessed over the internet.
False
45
What is a common authentication method used in RESTful APIs?
OAuth
46
What does the status code 500 indicate?
Internal Server Error
47
Fill in the blank: RESTful APIs should be ________ to allow for easy integration.
well-documented
48
What is the difference between a public and a private API?
A public API is open for anyone to use, while a private API is restricted to specific users or applications.
49
What is the purpose of using query parameters in a RESTful API?
To filter, sort, or paginate resources.
50
True or False: RESTful APIs can only be used for CRUD operations.
False
51
What is OAuth?
An open standard for access delegation commonly used for token-based authentication.
52
What does the term 'stateless client' mean in REST?
Clients do not store information about previous requests.
53
Fill in the blank: A RESTful API should be able to handle ________ gracefully.
errors
54
What is a common tool used for testing RESTful APIs?
Postman
55
What is the role of the Accept header in a RESTful API request?
To specify the media types that are acceptable for the response.
56
What is the main benefit of using JSON over XML in RESTful APIs?
JSON is generally lighter and easier to parse.
57
What is a resource representation in REST?
The data format that represents a resource, typically in JSON or XML.
58
True or False: RESTful APIs can be designed to be reusable and composable.
True
59
What does the 401 status code indicate?
Unauthorized
60
Fill in the blank: RESTful APIs should follow ________ principles to be effective.
REST
61
What is the main limitation of RESTful APIs?
They are not suitable for real-time applications due to their stateless nature.
62
What is a common pattern for organizing RESTful API endpoints?
Using nouns to represent resources and HTTP methods to represent actions.
63
What is the purpose of API documentation?
To provide information on how to use the API, including endpoints, parameters, and response formats.
64
What does the term 'response body' refer to in a RESTful API?
The data returned by the server in response to a client's request.
65
Fill in the blank: RESTful APIs should be designed to be ________ and ________.
simple, intuitive
66
What is the purpose of a webhook in the context of RESTful APIs?
To allow real-time notifications from the server to the client.
67
What is the difference between synchronous and asynchronous processing in RESTful APIs?
Synchronous processing waits for a response, while asynchronous processing allows other tasks to run concurrently.
68
True or False: RESTful APIs can be easily scaled horizontally.
True
69
What is the function of the OPTIONS HTTP method?
To describe the communication options for the target resource.
70
What does the term 'endpoint' refer to in a RESTful API?
A specific URL where an API can be accessed.
71
Fill in the blank: RESTful APIs should be designed with ________ in mind to ensure they can evolve over time.
flexibility