Skip to content
Syarif Ubaidillah edited this page Jul 9, 2022 · 3 revisions

Authentication

Setiap fitur yang memiliki header Authorization berarti harus login untuk mendapatkan access_token dan refresh_token.

Setiap fitur yang memiliki Query Param dapat digunakan seperti ini /api/example?paramA=12&paramB=331.

Login

Method Path
POST /api/login
Header Value
Content-Type application/json
Request Body
{
	"email": "alsyadahmad@holyhos.co.id",
	"password": "password"
}
Response Body
{
	"message": "User Logged In",
	"data": {
		"id": 3,
		"code": "DRS00001",
		"email": "alsyadahmad@holyhos.co.id",
		"full_name": "Alsyad Ahmad",
		"gender": "Male",
		"roles": "Doctor",
		"facility": "General",
		"status": 1
	},
	"jwt": {
		"access_token": "<access_token>",
		"refresh_token": "<refresh_token>"
	}
}

Register

Method Path
POST /api/register
Header Value
Content-Type application/json
Request Body
{
	"email": "syarif@holyhos.co.id",
	"password": "password",
	"facility_id": 2,
	"full_name": "Syarif Ubaidillah",
	"gender": "Male",
	"role_id": 2
}
Response Body
{
	"message": "Register success",
}

Find Email

Method Path
POST /api/find_email
Header Value
Content-Type application/json
Request Body
{
	"email": "alsyadahmad@holyhos.co.id",
}
Response Body
{
	"message": "User Logged In",
	"data": {
		"id": 3,
		"code": "NRS00001",
		"email": "priscillahalim@holyhos.co.id",
		"full_name": "Priscilla Halim",
		"gender": "Female",
		"roles": "Nurse",
		"facility": "General",
		"status": 1
	},
	"jwt": {
		"access_token": "<access_token>",
		"refresh_token": "<refresh_token>"
	}
}

Forgot Password

Method Path
POST /api/forgot_password
Header Value
Content-Type application/json
Query Param Value
token token_from_find_email
Request Body
{
	"password": "password",
}
Response Body
{
	"message": "Password Changed",
}

My Profile

Method Path
GET /api/profile
Header Value
Authorization Bearer <access_token>
Request Body
{
	"email": "alsyadahmad@holyhos.co.id",
	"password": "password"
}
Response Body
{
	"message": "User Logged In",
	"data": {
		"id": 3,
		"code": "NRS00001",
		"email": "priscillahalim@holyhos.co.id",
		"full_name": "Priscilla Halim",
		"gender": "Female",
		"roles": "Nurse",
		"facility": "General",
		"status": 1
	},
}

Change Password

Method Path
POST /api/profile/change_password
Header Value
Content-Type application/json
Authorization Bearer <access_token>
Request Body
{
	"password": "password",
}
Response Body
{
	"message": "Password Changed",
}

Refresh Token

Method Path
POST /api/refresh_token
Header Value
Content-Type application/json
Authorization Bearer <refresh_token>
Query Param Value
token access_token
Response Body
{
	"message": "Token Refreshed",
	"data": {
		"access_token": "<token>",
		"refresh_token": "<token>"
	}
}

LogOut

Method Path
POST /api/logout
Header Value
Authorization Bearer <access_token>
Response Body
{
	"message": "User Logged Out",
}