APIs Flashcards
What does REST stand for?
Representational State Transfer
True or False: RESTful APIs must use HTTP as their communication protocol.
True
Fill in the blank: REST is an architectural style that defines a set of ________.
constraints
What is the purpose of a resource in REST?
A resource is an object or representation of something that can be accessed or manipulated via the API.
Which HTTP method is typically used to retrieve a resource?
GET
What is the main characteristic of statelessness in REST?
Each request from a client must contain all the information the server needs to fulfill that request.
Which HTTP method is used to update an existing resource?
PUT
True or False: RESTful APIs can return data in multiple formats, such as JSON and XML.
True
What does the acronym CRUD stand for in the context of RESTful APIs?
Create, Read, Update, Delete
What is a URI in the context of RESTful APIs?
Uniform Resource Identifier
Which HTTP method is typically used to delete a resource?
DELETE
What is HATEOAS and how does it relate to REST?
Hypermedia as the Engine of Application State; it allows clients to navigate the API using hyperlinks provided by the server.
Fill in the blank: RESTful APIs are designed to be ________ and ________.
scalable, stateless
What is the primary purpose of using status codes in RESTful APIs?
To inform the client about the outcome of their request.
Name one common HTTP status code for a successful GET request.
200 OK
What does the 404 status code indicate?
Not Found
True or False: RESTful APIs are limited to only web services.
False
What is JSON?
JavaScript Object Notation, a lightweight data interchange format.
Which HTTP method is used to create a new resource?
POST
What is the role of a client in a RESTful API?
To request resources from the server.
What is the role of a server in a RESTful API?
To provide resources and handle client requests.
Fill in the blank: RESTful APIs should be ________ and ________.
cacheable, layered
What does it mean for a RESTful API to be ‘layered’?
The architecture can be composed of hierarchical layers, each with its own responsibilities.
True or False: RESTful APIs require that all requests be sent over HTTPS.
False
Which HTTP method is idempotent: GET or POST?
GET
What is the purpose of API versioning?
To manage changes and maintain compatibility with clients.
Name one way to version a RESTful API.
By including the version number in the URL.
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.