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
Q

Which HTTP method is idempotent: GET or POST?

A

GET

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

What is the purpose of API versioning?

A

To manage changes and maintain compatibility with clients.

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

Name one way to version a RESTful API.

A

By including the version number in the URL.

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

What is the difference between a resource and a representation in REST?

A

A resource is the actual object, while a representation is the format in which the resource is returned.

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

Fill in the blank: RESTful APIs use ________ to describe the structure of resources.

A

media types

30
Q

What does the term ‘idempotent’ mean in the context of HTTP methods?

A

An operation that can be applied multiple times without changing the result beyond the initial application.

31
Q

True or False: A POST request can create a resource and also change the state of the server.

A

True

32
Q

What is the primary advantage of using RESTful APIs?

A

They are stateless, scalable, and can be easily consumed by clients.

33
Q

What is the difference between synchronous and asynchronous API calls?

A

Synchronous calls wait for a response, while asynchronous calls allow for other processing while waiting.

34
Q

What is a common use case for RESTful APIs?

A

Web services for mobile applications.

35
Q

Fill in the blank: The ________ header is used to specify the format of the response in a RESTful API.

A

Content-Type

36
Q

What is the role of middleware in a RESTful API?

A

To process requests and responses, often handling tasks like authentication and logging.

37
Q

True or False: RESTful APIs can be consumed by any client capable of making HTTP requests.

A

True

38
Q

What is an API gateway?

A

A server that acts as an intermediary between clients and services, managing requests and responses.

39
Q

What does the term ‘convention over configuration’ mean in RESTful APIs?

A

It means that defaults are provided to reduce the need for configuration.

40
Q

What is a common pattern for handling errors in RESTful APIs?

A

Returning a standardized error response with a status code and message.

41
Q

Fill in the blank: RESTful APIs often use ________ to perform authentication.

A

tokens

42
Q

What is CORS and how does it relate to RESTful APIs?

A

Cross-Origin Resource Sharing; it allows restricted resources to be requested from another domain.

43
Q

What is the purpose of rate limiting in RESTful APIs?

A

To control the number of requests a client can make in a given time period.

44
Q

True or False: RESTful APIs can only be accessed over the internet.

A

False

45
Q

What is a common authentication method used in RESTful APIs?

A

OAuth

46
Q

What does the status code 500 indicate?

A

Internal Server Error

47
Q

Fill in the blank: RESTful APIs should be ________ to allow for easy integration.

A

well-documented

48
Q

What is the difference between a public and a private API?

A

A public API is open for anyone to use, while a private API is restricted to specific users or applications.

49
Q

What is the purpose of using query parameters in a RESTful API?

A

To filter, sort, or paginate resources.

50
Q

True or False: RESTful APIs can only be used for CRUD operations.

A

False

51
Q

What is OAuth?

A

An open standard for access delegation commonly used for token-based authentication.

52
Q

What does the term ‘stateless client’ mean in REST?

A

Clients do not store information about previous requests.

53
Q

Fill in the blank: A RESTful API should be able to handle ________ gracefully.

A

errors

54
Q

What is a common tool used for testing RESTful APIs?

A

Postman

55
Q

What is the role of the Accept header in a RESTful API request?

A

To specify the media types that are acceptable for the response.

56
Q

What is the main benefit of using JSON over XML in RESTful APIs?

A

JSON is generally lighter and easier to parse.

57
Q

What is a resource representation in REST?

A

The data format that represents a resource, typically in JSON or XML.

58
Q

True or False: RESTful APIs can be designed to be reusable and composable.

A

True

59
Q

What does the 401 status code indicate?

A

Unauthorized

60
Q

Fill in the blank: RESTful APIs should follow ________ principles to be effective.

A

REST

61
Q

What is the main limitation of RESTful APIs?

A

They are not suitable for real-time applications due to their stateless nature.

62
Q

What is a common pattern for organizing RESTful API endpoints?

A

Using nouns to represent resources and HTTP methods to represent actions.

63
Q

What is the purpose of API documentation?

A

To provide information on how to use the API, including endpoints, parameters, and response formats.

64
Q

What does the term ‘response body’ refer to in a RESTful API?

A

The data returned by the server in response to a client’s request.

65
Q

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

A

simple, intuitive

66
Q

What is the purpose of a webhook in the context of RESTful APIs?

A

To allow real-time notifications from the server to the client.

67
Q

What is the difference between synchronous and asynchronous processing in RESTful APIs?

A

Synchronous processing waits for a response, while asynchronous processing allows other tasks to run concurrently.

68
Q

True or False: RESTful APIs can be easily scaled horizontally.

A

True

69
Q

What is the function of the OPTIONS HTTP method?

A

To describe the communication options for the target resource.

70
Q

What does the term ‘endpoint’ refer to in a RESTful API?

A

A specific URL where an API can be accessed.

71
Q

Fill in the blank: RESTful APIs should be designed with ________ in mind to ensure they can evolve over time.

A

flexibility