Sunteți pe pagina 1din 5

Module Customer

Table Mysql

CUSTOMER_ID INT PRIMARY_KEY


AUTO_INCREMENT START FROM
1000
CUSTOMER_NAME Varchar(150) Mandatory
CUSTOMER_INITIAL Varchar(5) Mandatory
CreatedBy Varchar(50) Nullable
CreatedDate Datetime Nullable
ModifiedBy Varchar(50) Nullable
ModifiedDate Datetime Nullable

A. Get API
API Name : {url_domain}/customer/getlist
Method : GET
Header : Bearer(spasi){JWTTOKEN}
FORMAT :

IF Authenticated and Success


{
rows: [
{
customerId : xxxx,
customerName : xxxx,
createdBy : xxxx,
createdDate: xxxx (Format Date “dd MMM yyyy”),
modifiedBy: xxxx (JIKA NULL, kasih string “-”),
modifiedDate: xxxx
(JIKA NULL, kasih string “-”, Format Date “dd MMM
}, yyyy”)
{

customerId : xxxx,
customerName : xxxx,
createdBy : xxxx,
createdDate: xxxx (Format Date “dd MMM yyyy”),
modifiedBy: xxxx (JIKA NULL, kasih string “-”),
modifiedDate: xxxx
} (JIKA NULL, kasih string “-”, Format Date “dd MMM
], yyyy”)
Status: 200,
Message: Success
}
IF NOT AUTHENTICATED JWT
{ Validasi yang dicek setelah JWT decode adalah
Rows: [], Cek userID dan email ke database,
Status: 500,
Message: Not
Authenticated
}
IF ERROR TRY CATCH
{
Rows: [],
Status: 404,
Message: {Message Error
Java Exception}
}
B. Post API Insert
API Name : {url_domain}/customer/insert
Method : POST
Header : Bearer(spasi){JWTTOKEN}
FORMAT :

Insert Data Success


Dari Body
{ customerId : Generate by increment id
customerName : xxxx, terakhir lewat db
createdBy : xxxx, createdDate : datetimenow nya java
} modifiedDate : null
modifiedBy: null

Return JSON
{
Status : 200,
Message: Successfully Insert
}

IF NOT AUTHENTICATED JWT


Dari Body
{
customerName : xxxx, Validasi yang dicek setelah JWT decode
createdBy : xxxx, adalah
} Cek userID dan email ke database,

Return JSON
{
status:500,
message: Not Authenticated
}

IF ERROR TRY CATCH


Dari Body
{
customerName : xxxx,
createdBy : xxxx,
}

Return JSON
{
status:404,
message: {Message Error Java Exception}
}
C. Post API Update
API Name : {url_domain}/customer/update
Method : POST
Header : Bearer(spasi){JWTTOKEN}
FORMAT :

Update Data Success


Dari Body
{
customerId : xxx, modifiedDate : datetimenow nya java
customerName : xxxx,
modifiedBy : xxxx,
}

Return JSON
{
Status : 200,
Message: Successfully Updated
}

IF NOT AUTHENTICATED JWT


Dari Body
{
customerId : xxx, Validasi yang dicek setelah JWT decode
customerName : xxxx, adalah
modifiedBy : xxxx, Cek userID dan Email ke database,
}

Return JSON
{
status:500,
message: Not Authenticated
}

IF ERROR TRY CATCH


Dari Body
{
customerId : xxx,
customerName : xxxx,
modifiedBy : xxxx,
}

Return JSON
{
status:404,
message: {Message Error Java Exception}
}

D. Delete API
API Name : {url_domain}/customer/delete
Method : DELETE
Header : Bearer(spasi){JWTTOKEN}
FORMAT :

Update Data Success


Dari Body
{
customerId : xxx,
}

Return JSON
{
Status : 200,
Message: Successfully Deleted
}

IF NOT AUTHENTICATED JWT


Dari Body
{
customerId : xxx, Validasi yang dicek setelah JWT decode
} adalah
Return JSON Cek userID dan Email ke database,
{
status:500,
message: Not Authenticated
}
IF ERROR TRY CATCH
Dari Body
{
customerId : xxx,
}

Return JSON
{
status:404,
message: {Message Error Java Exception}
}

S-ar putea să vă placă și