ahmed-dinar / restful-in-peace

RESTful in Peace - A Pet Project

Home Page:https://ahmed-dinar.github.io/restful-in-peace

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

RESTful in Peace

 

ATTENTION!: After registration please insert a role named ADMIN in role table & user id in table user_role with the admin role id , otherwise create, delete & update of some endpoints will not work & without admin role.

NOTE: A insomnia generated file can be found HERE & It can be imported in insomnia to test the api. All endpoints are added.

 

Technologies / Tools used

 

JAVA 1.8
Web Application Framework Spring Boot
Architecture MVC
Database MySQL
ORM Hibernate
Database Git(Github)
Build Tool Maven
IDE Spring Tool Suite

Additional Documentation

 

Generate Api Key

URL : /apikey

Method : GET

Privilege : ALL

Header

{}

Body

{}

Response

{
	"key": <key>
}

Create an Appointment

URL : /api/insert/appointment/new

Method : POST

Privilege : Admin

Header

token=<token>
jwt_token=<jwt_token>

Body

{
    "doctor_id": <doctor id>,
    "patient_id": <patient id>,
    "prescription": "",
    "date_time": "31-07-2018 10:00:00"
}

Response

{
	"Status": "Success"
}

Fetch All Appointments

URL : /api/appointments

Method : GET

Privilege : User

Header

token=<token>
jwt_token=<jwt_token>

Body

{}

Response

List of all the Appointments Object.

Fetch A Appointment

URL : /api/appointments

Method : GET

Privilege : User

Header

token=<token>
jwt_token=<jwt_token>
appointment_id=<appointment_id>

Body

{}

Response

Appointments Object.

Fetch Appointments of A Doctor

URL : /api/appointments

Method : GET

Privilege : User

Header

token=<token>
jwt_token=<jwt_token>
doctor_id=<doctor_id>

Body

{}

Response

List of all the Appointments Object of this doctor

Fetch Appointments of A Patient

URL : /api/appointments

Method : GET

Privilege : User

Header

token=<token>
jwt_token=<jwt_token>
patient_id=<patient_id>

Body

{}

Response

List of all the Appointments Object of this patient

Fetch Appointments between A Doctor & A Patient

URL : /api/appointments

Method : GET

Privilege : User

Header

token=<token>
jwt_token=<jwt_token>
doctor_id=<doctor_id>
patient_id=<patient_id>

Body

{}

Response

List of all the Appointments Object with this doctor and patient

Update Appointment

URL : /api/update/appointments

Method : PUT

Privilege : Admin

Header

token=<token>
jwt_token=<jwt_token>
appointment_id=<appointment_id>

Body

{
	"prescription": "Long Live!"
}

Response

{
	"status": "updated"
}

Delete Appointment

URL : /api/delete/appointments

Method : DELETE

Privilege : Admin

Header

token=<token>
jwt_token=<jwt_token>
appointment_id=<appointment_id>

Body

{}

Response

{
	"status": "deleted"
}

Create Role

URL : /api/insert/role/new

Method : POST

Privilege : Admin

Header

token=<token>
jwt_token=<jwt_token>

Body

{
 "name":"MODERATOR",
 "status":"ACTIVE"
}

Response

{
	"status": "success"
}

Fetch All Roles

URL : /api/roles

Method : GET

Privilege : Admin

Header

token=<token>
jwt_token=<jwt_token>

Body

{}

Response

List of all Roles Object

Delete

URL : /api/roles

Method : DELETE

Privilege : Admin

Header

token=<token>
jwt_token=<jwt_token>
role_id=<role_id>

Body

{}

Response

{
	"status": "deleted"
}

Insert A Role of a User

URL : /api/insert/userrole/new

Method : POST

Privilege : Admin

Header

token=<token>
jwt_token=<jwt_token>

Body

{
 "userId": <user id>,
 "roleId": <role id>
}

Response

{
	"status": "success"
}

Get Roles of a User

URL : /api/roles

Method : GET

Privilege : Admin

Header

token=<token>
jwt_token=<jwt_token>
user_id=<user_id>

Body

{}

Response

{
	"first_name": <first_name>,
	"email": <email>,
	"mobile": <mobile>,
	"roles" : [List of role object]
}

Delete a Role of a User

URL : /api/delete/userrole

Method : DELETE

Privilege : Admin

Header

token=<token>
jwt_token=<jwt_token>
role_id=<role_id>

Body

{}

Response

{
	"status": "deleted"
}

Get Registered User List

URL : /user/all

Method : GET

Privilege : Admin

Header

token=<token>
jwt_token=<jwt_token>

Body

{}

Response

List Of Registered User Object

Get A User

URL : /user/:userId

Method : GET

Privilege : Admin

Header

token=<token>
jwt_token=<jwt_token>

Body

{}

Response

The User Object

      © MIT

About

RESTful in Peace - A Pet Project

https://ahmed-dinar.github.io/restful-in-peace

License:MIT License


Languages

Language:Java 100.0%