Implementing the spring boot crud operations on student entity by using Postman Rest api
Rest API request for Postman Rest API:
- Save student: POST http://localhost:8080/student
- Get student by Id: GET http://localhost:8080/student/2
- Get All students: GET http://localhost:8080/student
- Update a student: PUT http://localhost:8080/student/5
- Delete a student: DELETE http://localhost:8080/student/6
Command Prompt and Chrome or any browser cURL syntax for REST API:
- Save student: curl -X POST -H "Content-Type: application/json" -d "{"name":"milind","email":"milind@gmail.com"}" http://localhost:8080/student
- Get student by Id: curl http://localhost:8080/student/1
- Get All students: curl http://localhost:8080/student
- Update a student: curl -X PUT -H "Content-Type: application/json" -d "{"id":23,"name":"karan","email":"milind@gmail.com"}" http://localhost:8080/student/23 -v
- Delete a student: curl -X DELETE http://localhost:8080/student/24
note:
- cURL is a networking tool used to transfer data between a server and the curl client using protocols like HTTP, FTP, TELNET, and SCP.
- cURL is a command-line tool that lets you transmit HTTP requests and receive responses from the command line or a shell script. It is available for Linux distributions, Mac OS X, and Windows.
- cURL command syntax is used to construct the command in order to use cURL to run REST web API call: https://<HOST_OR_IP>/<BASE_INSTALL_DIR>/rest/
- reference website for cURL application: https://developer.adobe.com/commerce/webapi/get-started/gs-curl/