1/21
Flashcards covering REST APIs, HTTP methods, and related concepts for exam preparation.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
What does REST stand for, and what is it?
Representational State Transfer; a standard for systems to communicate over the web using HTTP methods.
What does API stand for, and what does it do?
Application Programming Interface; a set of rules that allows different programs to communicate with each other.
What format do REST APIs typically send data in?
JSON (JavaScript Object Notation)
What does it mean that REST APIs are stateless?
No memory is stored; each request is brand new.
What characterizes the routes used by REST APIs?
Clear, predictable routes, such as /api/trucks.
What is commonly used on the frontend to send data in a REST API?
Axios
How does the backend (Spring Boot) receive data sent from the frontend in a REST API?
Matching @mapping annotations in the Spring Boot Controller class.
Which Spring annotation is used to handle HTTP GET requests?
@getMapping
Which Spring annotation is used to handle HTTP POST requests?
@postMapping
Which Spring annotation is used to handle HTTP PUT requests?
@putMapping
Which Spring annotation is used to handle HTTP DELETE requests?
@deleteMapping
What is the purpose of the axios.get() method and the corresponding @getMapping annotation?
To fetch data.
What is the purpose of the axios.post() method and the corresponding @postMapping annotation?
To create new data.
What is the purpose of the axios.put() method and the corresponding @putMapping annotation?
To update existing data.
What is the purpose of the axios.delete() method and the corresponding @deleteMapping annotation?
To remove/delete existing data.
What do HTTP requests from the frontend using Axios signify to the backend?
They let the backend know what Java method to run when the frontend sends data using specific HTTP methods.
What is routing in the context of APIs?
How API endpoints are organized, often starting with /api/.
What does the /api
prefix in a route like /api/trucks
indicate?
Signals that it's an API route.
In the route /api/trucks
, what does /trucks
refer to?
Refers to the truck entity (what is being created, read, updated, or deleted).
What does the @RequestBody
annotation do in Spring?
Tells Spring to map the body of the HTTP request into a Java object.
When is the @RequestBody
annotation typically used?
When expecting JSON input from the frontend (POST or PUT requests).
When is it not necessary to use the @RequestBody
annotation?
A GET request with no body.