Skip to content

kushsharma1001/API-Calls-in-Java

Repository files navigation

Exposing API Endpoints-in-Java

This sections tells how to create/expose APIs for different HTTP verbs in a Spring boot project

Prerequisite : Just download a Spring initializr project using WEB dependency. (jar) Then, override pom values in your project with the pom that I have given (just add dependencies that i have in my pom) Then, Add User class and ExosingAPI class in your project. Done, you are good to go. Run your @SpringBootApplication class.

How to Test APIs exposed in project : Open Postman and try different calls there as shown in Image uploaded.

Note: Incase our api methods throw exception due to some reason (arrayIndexOutOfBound, null.toString() etc) then, we should create a new class as shown in exception.png pic

Note: I encouarge you to create a Spring boot project and try to use given classes and run the project on your own. Still, if you face difficulty, please use attached zip file to import fully functional spring boot project.

  • (Work in Project Explorer in Eclipse. In order to add a new class, package etc, select src/main/java and Right Click to "New".)

About

This particular section shows how to expose APIs in Spring boot project

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages