Hi guys, in this lesson we will talk about rest controller in springboard in secret bird. We can create REST services with rest controllers. Rest controller works with HTTP service. HTTP server has two main components. These are HTTP request and HTTP response request comes from client side to server side response is given by server to the client side. From client side, we can send request with different mapping tasks.
These mapping types are get mapping, post mapping, delete mapping, post mapping, and patch mapping. Default mapping type is get mapping. So when we try to call some API for browser, these recast VOB. Get mapping. Get mapping is used for select operations. For example, we can write the code like get all users with get mapping.
Post mapping is used for creat operations. For example, we can write a quote like save user with post mapping. deletes mapping is used for delete operations. For example, we can write a quote like delete user with delete mapping. Put mapping is used for update operations. For example, we can write a code like update user with put mapping.
And finally, patch mapping is used for partial update operations. For example, we can write a code like update username with patch mapping Other thing about requests is to describe paths. In rest controllers, we can describe paths with request mapping values. For example, for these get all users method, our API endpoints will be localhost plus portney plus request mapping path. Other think about recast is to send parameters to it. First of all we can send parameters with request body.
In here, payload data is used. Secondly, we can send parameters with PATH variable. Thirdly, we can send parameters with request para. Okay, nice meal. be enough for us about HTTP requests. Now let's talk about HTTP responses.
In rest controllers, we can define every method with response and decapsulation response entity is a capsulation that contains HTTP headers, HTTP status and response body. With response entity, we can control HTTP responses easily. For example, we can return user object after create operation like that with this entity. So in here, we can control return object and response HTTP status. Of course, there are other many things in rest controllers, but for beginning for our course, this will be enough. That's all.
Thank you.