How to create Spring Boot Hello World RESTful Web Services?
Create your first hello world RESTful Web Services Spring Boot application This is, perhaps the simplest form of a RESTful webservices API with Spring Boot. The @RestController annotation specifies this class will handle requests and produce responses following REST style.
How to test the Hello World REST API?
To test GET requests using only query string parameters, you can type the URL for the API’s helloworld resource into a browser address bar. For example:
What should be the response to a REST call?
In case of API response, it can be simple XML or JSON or any other media type. Also, at times, one REST API is being consumed by different applications. Out of which, one application might need the response in the form of XML and other might need the response in the form of JSON.
What kind of response does the REST API return?
The above response is not the complete response its just the response body. An HTTP response contains the status line, headers and the message/response body. As we have already discussed that same REST API can return both XML or JSON as response message, depending upon the Media-Type attribute in the HTTP request.
To test GET requests using only query string parameters, you can type the URL for the API’s helloworld resource into a browser address bar. For example:
Create your first hello world RESTful Web Services Spring Boot application This is, perhaps the simplest form of a RESTful webservices API with Spring Boot. The @RestController annotation specifies this class will handle requests and produce responses following REST style.
In case of API response, it can be simple XML or JSON or any other media type. Also, at times, one REST API is being consumed by different applications. Out of which, one application might need the response in the form of XML and other might need the response in the form of JSON.
The above response is not the complete response its just the response body. An HTTP response contains the status line, headers and the message/response body. As we have already discussed that same REST API can return both XML or JSON as response message, depending upon the Media-Type attribute in the HTTP request.