Nhóm thực hiện: 15
Hệ thống cung cấp các API cho các cửa hàng quà tặng có thể sử dụng để nâng cấp hoặc tích hợp vào hệ thống của cửa hàng.
Thông tin chi tiết cho từng API đã được cập nhật tại các document cho từng phiên bản.
Hệ thống sẽ liên tục được cập nhật và bổ sung những tính năng mới.
Khi hệ thống sử dụng API mà phát sinh lỗi bạn có thể liên lạc qua email: giakhangnguyen115@gmail.com để được khắc phục sớm nhất.
U can replace localhost to tonydomain.ddns.net, maybe has app name follow the domain. Ex: tonydomain.ddns.net:8080/giftapp
Thử nghiệm hệ thống giftapp bằng cách thực hiện những bước sau đây:
Bước 1: Clone project về máy
Bước 2: vào thư mục supporting test postman để kiểm tra thử có file CNPM postman_collection.json hay không.
Bước 3: Vào postman
Bước 4: Chọn file -> import
Bước 5: chọn tới đường dẫn file CNPM.postman_collection.json
Sau khi thực hiện xong có thể test thử tất cả các chức năng của hệ thống.
Note: nếu không thực hiện được có thể cho host đã bị tắt (host của nhóm em). Để có thể test tiếp thay đổi tonydomain.ddns.net thành localhost
Link: http://localhost:8080/api/accounts/signup
Or: http://localhost:8080/giftapp/api/accounts/signup
Body:
{
"username": "catuser",
"password": "123meow"
}
Status code:
Link: http://localhost:8080/api/accounts/signin
Or: http://localhost:8080/giftapp/api/accounts/signin
Body:
{
"username": "catuser",
"password": "123meow",
"accountType": 1
}
accountType
Status code:
link: http://localhost:8080/api/accountinfos
link: http://localhost:8080/api/accountinfos
{
"uname" : "khangtest2",
"disname" : "khangtest2",
"uaddress" : "daylaaddresss",
"phonenum" : 919910266,
"email" : "mailjcungdc"
}
Status: 201 Lưu thành công accountInforService
Status: 404
link: http://localhost:8080/api/accountinfos/khangtest1
{
"disname" : "khangtest3",
"uaddress" : "daylaaddresss",
"phonenum" : 919910266,
"email" : "mailjcungdc"
}
Status:200 AccountInfo đã được update
Status:404
link: http://localhost:8080/api/accountinfos
[
{
"uname": "khangtest1",
"disname": "khangtest",
"uaddress": "daylaaddress",
"phonenum": 919910266,
"email" : "mailjcungdc"
}
]
Status:404
link: http://localhost:8080/api/accountinfos/khangtest1
Status:200
{
"uname": "khangtest2",
"disname": "khangtest2",
"uaddress": "daylaaddresss",
"phonenum": 919910266
}
Status: 404
link: http://localhost:8080/api/accountinfos/khangtest1
Status:200 Xóa accountInfo thành công
Status:404
link: http://localhost:8080/api/gorderaddon
{
"gorderId": 2,
"addonId": 2,
"content":"day la lan thu dau hai"
}
Status: 201 Lưu thành công gOrderAddOn
Status: 404
link: http://localhost:8080/api/gorderaddon/2
{
"gorderId": 15,
"addonId": 3,
"content":"Muon sua thanh addon thu ba"
}
Status: 200 GOrderAddOn update thành công
Status: 400
link: http://localhost:8080/api/gorderaddon
[
{
"cid": 1,
"gorderId": null,
"addonId": 2,
"content": "sua cai content khac",
"aname": null,
"adescription": null,
"price": null
},
{
"cid": 2,
"gorderId": null,
"addonId": 2,
"content": "sua cai content khac",
"aname": null,
"adescription": null,
"price": null
},
{
"cid": 3,
"gorderId": null,
"addonId": 2,
"content": "sua cai content khac",
"aname": null,
"adescription": null,
"price": null
},
{
"cid": 5,
"gorderId": 2,
"addonId": 2,
"content": "day la lan thu dau hai",
"aname": null,
"adescription": null,
"price": null
}
]
Status: 404
link: http://localhost:8080/api/gorderaddon/15
Status:200
[
{
"cid": 17,
"gorderId": 15,
"addonId": 1,
"content": "cái nơ màu xanh",
"aname": "test1",
"adescription": "dung de test",
"price": 10000
},
{
"cid": 18,
"gorderId": 15,
"addonId": 5,
"content": "Muon sua thanh addon thu ba",
"aname": "fakeAddOn1",
"adescription": "Đây là addOnFake",
"price": 30000
}
]
Status: 404
link: http://localhost:8080/api/gorderaddon/2
Status: 200 Ğã xóa thành công addon
Status: 404
link: http://localhost:8080/api/user/order
{
"uname" : "khangtest1",
"giftpackId": 1,
"receiveAddress" : "123/dada/tp.HCM",
"phoneNumber" : 919910266,
"dateArrive" : "23-05-2021",
"greetingCardContent" : "Happy birthday",
"addonId": [1,2],
"content" : ["cái nơ màu xanh", "cái thiệp màu hồng"]
}
Status: 200 Đã tạo đơn hàng thành công Location: /api/user/order/id/16
Status: 404
link: http://localhost:8080/api/user/order/id/16
{
"cid": 16,
"uname": "khangtest1",
"giftpackId": 1,
"receiveAddress": "123/dada/tp.HCM",
"phoneNumber": 919910266,
"dateOrder": "17-05-2021",
"dateArrive": "23-05-2021",
"greetingCardContent": "Happy birthday",
"addonId": [
1,
2
],
"content": [
"cái nơ màu xanh",
"cái thiệp màu hồng"
],
"status": "Đang xử lý",
"cost": 140000
}
link: http://localhost:8080/api/user/order/uname/khangtest1
Status: 200
[
{
"cid": 1,
"uname": "khangtest1",
"giftpackId": 1,
"receiveAddress": "123/dada/tp.HCM",
"phoneNumber": 919910266,
"dateOrder": "17-05-2021",
"dateArrive": "23-05-2021",
"greetingCardContent": "Happy birthday",
"addonId": [
1
],
"content": [
"cái nơ màu xanh"
],
"status": "Đang chờ xử lý",
"cost": 110000
},
{
"cid": 4,
"uname": "khangtest1",
"giftpackId": 1,
"receiveAddress": "123/dada/tp.HCM",
"phoneNumber": 919910266,
"dateOrder": "17-05-2021",
"dateArrive": "23-05-2021",
"greetingCardContent": "Happy birthday",
"addonId": null,
"content": null,
"status": "Đang chờ xử lý",
"cost": 100000
},
{
"cid": 12,
"uname": "khangtest1",
"giftpackId": 1,
"receiveAddress": "123/dada/tp.HCM",
"phoneNumber": 919910266,
"dateOrder": "17-05-2021",
"dateArrive": "23-05-2021",
"greetingCardContent": "Happy birthday",
"addonId": [
1,
2
],
"content": [
"cái nơ màu xanh",
"cai thiep mau hong"
],
"status": "Đang chờ xử lý",
"cost": 140000
},
{
"cid": 13,
"uname": "khangtest1",
"giftpackId": 1,
"receiveAddress": "123/dada/tp.HCM",
"phoneNumber": 919910266,
"dateOrder": "17-05-2021",
"dateArrive": "23-05-2021",
"greetingCardContent": "Happy birthday",
"addonId": [
2
],
"content": [
"cai thiep mau hong"
],
"status": "Đang chờ xử lý",
"cost": 130000
},
{
"cid": 14,
"uname": "khangtest1",
"giftpackId": 1,
"receiveAddress": "123/dada/tp.HCM",
"phoneNumber": 919910266,
"dateOrder": "17-05-2021",
"dateArrive": "23-05-2021",
"greetingCardContent": "Happy birthday",
"addonId": [
1,
2
],
"content": [
"cái nơ màu xanh",
"cai thiep mau hong"
],
"status": "Đang chờ xử lý",
"cost": 140000
}
]
Status: 404
link: http://localhost:8080/api/user/order
Status: 200
[
{
"cid": 1,
"uname": "khangtest1",
"giftpackId": 1,
"receiveAddress": "123/dada/tp.HCM",
"phoneNumber": 919910266,
"dateOrder": "17-05-2021",
"dateArrive": "23-05-2021",
"greetingCardContent": "Happy birthday",
"addonId": [
1
],
"content": [
"cái nơ màu xanh"
],
"status": "Đang chờ xử lý",
"cost": 110000
},
{
"cid": 4,
"uname": "khangtest1",
"giftpackId": 1,
"receiveAddress": "123/dada/tp.HCM",
"phoneNumber": 919910266,
"dateOrder": "17-05-2021",
"dateArrive": "23-05-2021",
"greetingCardContent": "Happy birthday",
"addonId": null,
"content": null,
"status": "Đang chờ xử lý",
"cost": 100000
}
]
link:http://localhost:8080/api/delivery
Status.200
[
{
"gorderId": 5,
"pstate": "Canceled",
"pdelivered": 1,
"pcanceled": 1
},
{
"gorderId": 8,
"pstate": "done",
"pdelivered": 1,
"pcanceled": 0
},
{
"gorderId": 10,
"pstate": "cancel",
"pdelivered": 0,
"pcanceled": 1
}
]
Status.400
link:http://localhost:8080/api/delivery/Listdeliveried
Status.200
[
{
"gorderId": 5,
"pstate": "Canceled",
"pdelivered": 1,
"pcanceled": 1
},
{
"gorderId": 8,
"pstate": "done",
"pdelivered": 1,
"pcanceled": 0
}
]
Status.400
link:http://localhost:8080/api/delivery/addOrderProcess
{
"gorderId": 5,
"pstate": "process",
"pdelivered": 0,
"pcanceled": 0
}
Status.200 Add success
link:http://localhost:8080/api/delivery/update/5
{
"gorderId": 5,
"pstate": "done",
"pdelivered": 1,
"pcanceled": 0
}
Status.200 Update success
link:http://localhost:8080/api/delivery/delete/5
Status.200 Delete success
link:http://localhost:8080/comments/listComments
Status.200
[
{
"cid": 4,
"giftpackId": 2,
"uname": "catuser",
"content": "Fail"
}
]
Status.400
link:http://localhost:8080/comments/getCommentsByUname/catuser
Status.200
[
{
"cid": 4,
"giftpackId": 2,
"uname": "catuser",
"content": "Fail"
}
]
Status.400
link: http://localhost:8080/comments/getCommentsBygiftID/1
Status.200
{
"cid": 10,
"giftpackId": 1,
"uname": "catuser",
"content": "Failed"
}
Status.400
{
"cid": 10,
"giftpackId": 1,
"uname": "catuser",
"content": "Failed"
}
Add Comment sucess
Status.400
{
"giftpackId": 2,
"uname": "catuser",
"content": "Fail"
}
Status.200 Update success
Status.400 Update unsuccess
link:http://localhost:8080/comments/delete/10
Status.200 Delete success
Status.400 Delete unsuccess
link:http://localhost:8080/comments/resolveComment
{
"email":"18110092@student.hcmute.edu.vn",
"content":"Gift very good",
"commentResolve":"Thanks you for buy Gift",
"giftpackId":2
}
Status.200 Mail sent.
Mail unsent
Link: http://localhost:8080/api/items
Status code: 200
[
{
"cid": 1,
"itemName": "keo",
"itemDescription": "2 bich keo",
"thumbnailimg": "https://www.apple.com/ac/structured-data/images/open_graph_logo.png?201810040211",
"price": 250,
"activeState": 1
},
{
"cid": 2,
"itemName": "keo",
"itemDescription": "2 bich keo",
"thumbnailimg": "https://www.apple.com/ac/structured-data/images/open_graph_logo.png?201810040211",
"price": 200,
"activeState": 1
}
]
Link: http://localhost:8080/api/items/1
Get an item with id (this link for id = 1)
Status code: 200
{
"cid": 1,
"itemName": "keo",
"itemDescription": "2 bich keo",
"thumbnailimg": "https://www.apple.com/ac/structured-data/images/open_graph_logo.png?201810040211",
"price": 250,
"activeState": 1
}
Create new item
{
"itemName": "gau bong",
"itemDescription": "1 co gau bong mau tin",
"thumbnailimg": "https://www.apple.com/ac/structured-data/images/open_graph_logo.png?201810040211",
"price": 450,
"activeState": 1
}
Status code: 201
Created new item.
Link: http://localhost:8080/api/items/1
Update an item with id (this link for item has id = 1)
{
"itemName": "gau bong",
"itemDescription": "Con gau bong mau tim to dung",
"thumbnailimg": "https://www.apple.com/ac/structured-data/images/open_graph_logo.png?201810040211",
"price": 350,
"activeState": 1
}
Status code: 200
Update item.
Link: http://localhost:8080/api/items/noitemtypes
Get a number of item's types
Status code: 200
{
"numberofitemtypes": 3
}
Link: http://localhost:8080/api/giftpacks
Get all giftpack
Status code: 200
[
{
"cid": 1,
"gname": "qua valentine",
"gdescription": "sicola va hoa hong",
"thumbnailimg": "https://www.apple.com/ac/structured-data/images/open_graph_logo.png?201810040211",
"price": 570,
"averageStar": 0,
"activeState": 1
},
{
"cid": 10,
"gname": "qua sinh nhat",
"gdescription": "banh kem",
"thumbnailimg": "https://www.apple.com/ac/structured-data/images/open_graph_logo.png?201810040211",
"price": 270,
"averageStar": 0,
"activeState": 1
}
]
Link:http://localhost:8080/api/giftpacks/1
Get a giftpack has id = 1
Status code: 200
{
"cid": 1,
"gname": "qua valentine",
"gdescription": "sicola va hoa hong",
"thumbnailimg": "https://www.apple.com/ac/structured-data/images/open_graph_logo.png?201810040211",
"price": 570,
"averageStar": 0,
"activeState": 1
}
Create new giftpack
{
"gname": "qua xin loi",
"gdescription": "hoa cuc",
"thumbnailimg": "https://www.apple.com/ac/structured-data/images/open_graph_logo.png?201810040211",
"price": 130,
"averageStar": 0,
"activeState": 1
}
Status code: 201
Created new giftpack
Link: http://localhost:8080/api/giftpacks/10
Update an existed gitfpack has id = 10
{
"gname": "qua chia tay",
"gdescription": "hoa hong trang",
"thumbnailimg": "https://www.apple.com/ac/structured-data/images/open_graph_logo.png?201810040211",
"price": 1300,
"averageStar": 0,
"activeState": 1
}
Status code: 200
Updated giftpack
Link: http://localhost:8080/api/giftpacks/nogiftpacktypes
Get the number of giftpack's types
{
"numberofgiftpacktypes": 3
}
Link: http://localhost:8080/api/addons
Get all of addon
Status code: 200
[
{
"cid": 1,
"aname": "loi chuc",
"adescription": "mot loi chuc den nhung ai ...",
"price": 25
},
{
"cid": 2,
"aname": "phat nhac",
"adescription": "O noi dau do nhin ve qua khu cua hai ta lieu em co tiec?",
"price": 25
},
{
"cid": 3,
"aname": "choi nhac",
"adescription": "O noi dau do nhin ve qua khu cua hai ta lieu em co tiec?",
"price": 25
}
]
Link: http://localhost:8080/api/addons/1
Get an addon has id = 1
Status code: 200
{
"cid": 1,
"aname": "loi chuc",
"adescription": "mot loi chuc den nhung ai ...",
"price": 25
}
Create new addon
{
"aname": "dance",
"adescription": "999 doa hoa hong",
"price": 99
}
Status code: 201
Created new addon
Link: http://localhost:8080/api/addons/1
Update addon has id = 1
{
"aname": "dance and nu.de",
"adescription": "999 doa hoa hong, thoi doi",
"price": 199
}
Status code: 200
Updated addon!
Link: http://localhost:8080/api/addons/noaddontypes
Get the number of addon's types
Status code: 200
{
"noaddontypes": 4
}
link: http://localhost:8080/api/giftpackitems
Get all giftpackItems
Link : http://localhost:8080/api/giftpackitems
[
{
"cid": 3,
"giftpackId": 1,
"itemId": 2
}
]
Get giftpacksItem by id=1 link: http://localhost:8080/api/giftpackitems/1
Request
[
{
"cid": 3,
"giftpackId": 1,
"itemId": 2
}
]
Add one giftpack has many items
{
"giftpackid": 1,
"itemid" : [1, 2]
}
Success: 201
Update by id in database of giftpackItems
link: http://localhost:8080/api/giftpackitems/2
{
"giftpackId": 1,
"itemId": 2
}
Success: 200
Delete by id in database of giftpackItems
link: http://localhost:8080/api/giftpackitems/2
Success: 200