/Java-Servlet-REST-API

A straightforward Restful API built with Java Servlet

Primary LanguageJava

Java-Servlet-REST-API

A straightforward Restful API built with Java Servlet

The routes for handling all CRUD operation looks like this
api/users get all Users
api/users/1234 get User with id = 1234
api/users add new User
api/users/1234 update User with id = 1234
api/users/1234 remove User

GET

api/users || GET api/users/{passUserId}
It returns a list of users in JSON format. You can also get a specific user by passing their id.

POST

api/users
You can send(POST) data using a JSON file. The key(parameters) for users are
*id
*name
*email
*gener
*status
E.g

{
    "id": 1234,
    "name": "Sunil Bohara",
    "email": "boharasunil4@gmail.com",
    "gender": "male",
    "status": "active"
}

DELETE

api/users/{passUserId}
Delete the user from the server (database) by entering the user ID into the endpoint. For example, using the endpoint like this: api/users/1234.

PUT

api/users/{passUserId}
By passing the ID in the endpoint and sending the new data in JSON format, you can update the user. The keys (parameters) for users are
*id
*name
*email
*gener
*status
E.g

{
    "id": 1234,
    "name": "Sunil Bohara",
    "email": "boharasunil4@gmail.com",
    "gender": "male",
    "status": "active"
}

:)