User - dinhhuy2808/q-chinese-doc GitHub Wiki

register

  • POST /user/{method}

method:

  • 1: đăng kí bình thường.
  • 2: đăng kí qua google.
  • body:
{
"phone":"01663036577",
"name":"test",
"accountType":2,
"password":"password", --> empty nếu method = 2
"email":"[email protected]"
}
  • response:
  1. 201: phone tồn tại.
  2. 202: email tồn tại.
  3. 200: success.

login

  • POST /user/login/{loginMethod} loginMethod:
  • 1: đăng nhập bình thường.
  • 2: đăng nhập qua google.
  • body:
{
"phone":"01663036577", --> optional nếu email available
"password":"password", --> empty nếu method = 2
"email":"[email protected]" --> optional nếu phone available
}
  • Response:
{
"phone":"01663036577",
"name":"name",
"email":"[email protected]",
"token":"..." -> JWT token
}

Update Avatar

  • POST /user/v2/update/avatar
  • body (PLAIN TEXT): base 64 image

changePassword

  • POST /user/v2/changePassword
  • body:
{
"password":"oldPassword",
"newPassword":"newPassword",
"verify":"verifyNewPassword"
}
  • response:
"code": {code},
"message":"message

{code}:

  • 202: password không đúng.
  • 203: server error.
  • 200: success.

Find Friend By Phone

  • POST /user/v2/find-user/{phone}
  • response:
"userKey":"userKey",
"name":"name",
"isFriend":true,
"avatar":"base64"

Add To Group

  • POST /user/v2/add-group/{friendId}/{roomKey}

Get User Key

  • GET /user/v2/getUserkey
  • response:
"key":"userKey"

Check User By Phone

  • GET /user/check/{phone}
  • response:true or false

Get Friend List

  • POST /user/v2/get-friends
  • response:
[
   {
     "roomKey":"roomKey",
     "roomName":"roomName",
     "avatar":"base64",
     "unread": 3 -> unread messages
     "userKey":"userKey",
     "isAccept":false          
   },
   {
     "roomKey":"roomKey",
     "roomName":"roomName",
     "avatar":"base64",
     "unread": 3 -> unread messages
     "userKey":"userKey",
     "isAccept":false   
   }
]

addNote

  • POST /user/v2/add-note

getUser

  • GET /user/v2/user-info
  • reponse:
{
	"user": {
		"email": "[email protected]",
		"dob": 0,
		"phone": "0981992102",
		"name": "Hoai Than",
		"create_time": 0,
		"image": "",
		"username": "",
		"address": "",
		"gender": "",
		"avatar": "",
		"userkey": "6196df7cef224a2b947f3af7ae9860c8"
	},
	"quizResultDetail": [
		{
			"resultDetail": {
				"hsk": 2,
				"test": 2,
				"score": 0,
				"rate": 0.0,
				"answers": [
					{
						"number": 1,
						"correctAnswer": "E",
						"userAnswer": ""
					},...
				],
				"listenRate": "0/15",
				"readRate": "0/20"
			},
			"questionDescription": [
				{
					"type": "1",
					"number": "1",
					"header": "<div class=\"qustion\"><div class=\"field-number\"></div> <div class=\"field-image\">  <img src=\"\" alt=\"\"> </div> <div class=\"field-audio\">  <audio controls=\"\" controlsList=\"nodownload\"> \r\n  <source src=\"http://103.92.29.71:8081/audios/BT/2/02-1 - Giáo trình chuẩn HSK 2 - Sách bài tập - question 1.mp3\" type=\"audio/mpeg\"> Your browser does not support the audio element. \r\n</audio>\r\n<div>\r\n   <button class=\"btn\" ><img src=\"assets/images/numbers/undo.svg\" onclick=\"previous(this)\" alt=\"\"  width=\"30px\" height=\"30px\"></button>\r\n   <button class=\"btn mr-4\" ><img src=\"assets/images/numbers/redo.svg\" onclick=\"next(this)\" alt=\"\" width=\"30px\" height=\"30px\"></button>\r\n</div> </div> <div class=\"text-justify field-subject\">  <p class=\"pinyin\"></p> </div></div>",
					"body": [
						{
							"number": "1",
							"header": "<div class=\"field-image\">  <img style=\"max-width: 100%;\" src=\"http://103.92.29.71:8081/images/BT/2/2.2.1.jpg\" alt=\"\"> </div> ",
							"value": {
								"A": "<div><i class=\"fa fa-check\"></i></div>",
								"B": "<div><i class=\"fa fa-times\"></i></div>"
							}
						}
					],
					"category": "NGHE",
					"listenContent": "医生说要住一个月,现在不能出院。"
				}, ...
			],
			"submitDate": "2021-05-15 10:36:29.0",
			"isPromote": false,
			"time": 5
		}
	],
	"testResultDetail": [
		{
			"resultDetail": {
				"hsk": 2,
				"test": 2,
				"score": 0,
				"rate": 0.0,
				"answers": [
					{
						"number": 1,
						"correctAnswer": "E",
						"userAnswer": ""
					},...
				],
				"listenRate": "0/15",
				"readRate": "0/20"
			},
			"questionDescription": [
				{
					"type": "1",
					"number": "1",
					"header": "<div class=\"qustion\"><div class=\"field-number\"></div> <div class=\"field-image\">  <img src=\"\" alt=\"\"> </div> <div class=\"field-audio\">  <audio controls=\"\" controlsList=\"nodownload\"> \r\n  <source src=\"http://103.92.29.71:8081/audios/BT/2/02-1 - Giáo trình chuẩn HSK 2 - Sách bài tập - question 1.mp3\" type=\"audio/mpeg\"> Your browser does not support the audio element. \r\n</audio>\r\n<div>\r\n   <button class=\"btn\" ><img src=\"assets/images/numbers/undo.svg\" onclick=\"previous(this)\" alt=\"\"  width=\"30px\" height=\"30px\"></button>\r\n   <button class=\"btn mr-4\" ><img src=\"assets/images/numbers/redo.svg\" onclick=\"next(this)\" alt=\"\" width=\"30px\" height=\"30px\"></button>\r\n</div> </div> <div class=\"text-justify field-subject\">  <p class=\"pinyin\"></p> </div></div>",
					"body": [
						{
							"number": "1",
							"header": "<div class=\"field-image\">  <img style=\"max-width: 100%;\" src=\"http://103.92.29.71:8081/images/BT/2/2.2.1.jpg\" alt=\"\"> </div> ",
							"value": {
								"A": "<div><i class=\"fa fa-check\"></i></div>",
								"B": "<div><i class=\"fa fa-times\"></i></div>"
							}
						}
					],
					"category": "NGHE",
					"listenContent": "医生说要住一个月,现在不能出院。"
				}, ...
			],
			"submitDate": "2021-05-15 10:36:29.0",
			"isPromote": false,
			"time": 5
		}
	],
	"totalResults": [
		{
			"hsk": 2,
			"totalScore": 0,
			"totalListenScore": 0,
			"totalReadingScore": 0,
			"wordAmount": 0
		}
	],
	"ranks": [
		{
			"userId": 71,
			"totalScore": 0,
			"titleId": 0,
			"userFullName": "Thị Thùy Trang Ngô",
			"wordAmount": 0,
			"hsk": 5
		}
	],
	"friendIds": [
		35
	],
	"userCurrentRank": 0,
	"rankingLevel": {
		"1": [
			{
				"userId": 176,
				"validChain": 0,
				"level": 1,
				"name": "Dam Hai Linh"
			}
		],
		"2": [
			
			{
				"userId": 119,
				"validChain": 1,
				"level": 2,
				"name": "Phạm Quốc Vương"
			}
		],
		"3": [
			{
				"userId": 3,
				"validChain": 2,
				"level": 3,
				"name": "Diệp Đức Phát"
			}
		]
	}
}

getFriendsRequest

  • POST /user/v2/get-friends-request

acceptFriendRequest

  • POST /user/v2/accept-friend-request/{friendKey}

sendFriendRequest

  • POST /user/v2/send-friend-request/{friendId}

sendFriendRequestWithKey

  • POST /user/v2/send-friend-request-by-key/{friendKey}

getNote

  • GET /user/v2/get-note

get User Detail ( Hồ Sơ Học tập tab)

  • GET /user/v2/user-info/detail
  • reponse:
{
	"user": {
		"email": "[email protected]",
		"dob": 0,
		"phone": "0981992102",
		"name": "Hoai Than",
		"create_time": 0,
		"image": "",
		"username": "",
		"address": "",
		"gender": "",
		"avatar": "",
		"userkey": "6196df7cef224a2b947f3af7ae9860c8"
	},
	"totalResults": [
		{
			"hsk": 2,
			"totalScore": 0,
			"totalListenScore": 0,
			"totalReadingScore": 0,
			"wordAmount": 0
		}
	],
	"userCurrentRank": 0
}

get Rank (Bảng xếp hạng tab)

  • GET /user/v2/user-info/ranks
  • reponse:
{
	"ranks": [
		{
			"userId": 71,
			"totalScore": 0,
			"titleId": 0,
			"userFullName": "Thị Thùy Trang Ngô",
			"wordAmount": 0,
			"hsk": 5
		}
	],
	"rankingLevel": {
		"1": [
			{
				"userId": 176,
				"validChain": 0,
				"level": 1,
				"name": "Dam Hai Linh"
			}
		],
		"2": [
			
			{
				"userId": 119,
				"validChain": 1,
				"level": 2,
				"name": "Phạm Quốc Vương"
			}
		],
		"3": [
			{
				"userId": 3,
				"validChain": 2,
				"level": 3,
				"name": "Diệp Đức Phát"
			}
		]
	}
}

get User Quiz History (Tien trình luyện tập tab)

  • GET /user/v2/user-info/quiz-history
  • reponse:
{

	"quizResultDetail": [
		{
			"resultDetail": {
				"id":1234,
				"hsk": 2,
				"test": 2,
				"score": 0,
				"rate": 0.0,
				"listenRate": "0/15",
				"readRate": "0/20"
			},
			...
}

get User Test History (Tien trình thăng cấp tab)

  • GET /user/v2/user-info/test-history
  • reponse:
{

	"testResultDetail": [
		{
			"resultDetail": {
				"id":1234,
				"hsk": 2,
				"test": 2,
				"score": 0,
				"rate": 0.0,
				"listenRate": "0/15",
				"readRate": "0/20"
			},
			...
}

get User Test Answer detail

  • GET /user/v2/user-info/raw-test-answer-detail/{id}
  • reponse:
{
	"testResultDetail": [
		{
			"resultDetail": {
				"id": 1234,
				"hsk": 2,
				"test": 2,
				"score": 0,
				"rate": 0.0,
				"answers": [
					{
						"number": 1,
						"correctAnswer": "E",
						"userAnswer": ""
					}
				],
				"listenRate": "0/15",
				"readRate": "0/20"
			},
			"questionDescription": [
				{
					"type": "5",
					"number": "1-5",
					"header": {
						"description": "A 11.1a B 11.1b C 11.1c D 11.1d E 11.1e"
					},
					"headingOptions": {
						"A": {
							"image": "https://resource.qchinese.net/images/Test/3/11.1a.png",
							"description": ""
						},
						"B": {
							"image": "https://resource.qchinese.net/images/Test/3/11.1b.png",
							"description": ""
						},
						"C": {
							"image": "https://resource.qchinese.net/images/Test/3/11.1c.png",
							"description": ""
						},
						"D": {
							"image": "https://resource.qchinese.net/images/Test/3/11.1d.png",
							"description": ""
						},
						"E": {
							"image": "https://resource.qchinese.net/images/Test/3/11.1e.png",
							"description": ""
						}
					},
					"body": [
						{
							"number": "1",
							"header": {
								"audio": "https://resource.qchinese.net/audios/Test/3/HSK3-11 - question 3.mp3"
							},
							"listenContent": "女:你一直看手表,有什么着急的事情吗?\n男:我九点前必须回到办公室,经理有事情找我,再见。"
						},
						{
							"number": "2",
							"header": {
								"audio": "https://resource.qchinese.net/audios/Test/3/HSK3-11 - question 4.mp3"
							},
							"listenContent": "男:你想什么呢?要出去吗?\n女:明天同学结婚,我在想穿哪双鞋好呢。"
						},
						{
							"number": "3",
							"header": {
								"audio": "https://resource.qchinese.net/audios/Test/3/HSK3-11 - question 5.mp3"
							},
							"listenContent": "女:你每天都骑自行车上下班?\n男:是,我骑了四个月了,一共瘦了六斤。"
						},
						{
							"number": "4",
							"header": {
								"audio": "https://resource.qchinese.net/audios/Test/3/HSK3-11 - question 6.mp3"
							},
							"listenContent": "男:真的不需要吃药吗?\n女:不需要,回去多喝水,休息两天就好了。"
						},
						{
							"number": "5",
							"header": {
								"audio": "https://resource.qchinese.net/audios/Test/3/HSK3-11 - question 7.mp3"
							},
							"listenContent": "女:你看,上次出现的问题,我已经解决了。\n男:好极了!只是你要注意身体,我记得你有一个多星期没去跑步了。"
						}
					],
					"category": "NGHE",
					"listenContent": ""
				},...
			],
			"submitDate": "2021-05-15 10:36:29.0",
			"isPromote": false,
			"time": 5
		},...
	]
}

get User Quiz Answer detail

  • GET /user/v2/user-info/raw-quiz-answer-detail/{id}
  • reponse:
{
	"quizResultDetail": [
		{
			"resultDetail": {
				"id": 1234,
				"hsk": 2,
				"test": 2,
				"score": 0,
				"rate": 0.0,
				"answers": [
					{
						"number": 1,
						"correctAnswer": "E",
						"userAnswer": ""
					}
				],
				"listenRate": "0/15",
				"readRate": "0/20"
			},
			"questionDescription": [
				{
					"type": "5",
					"number": "1-5",
					"header": {
						"description": "A 11.1a B 11.1b C 11.1c D 11.1d E 11.1e"
					},
					"headingOptions": {
						"A": {
							"image": "https://resource.qchinese.net/images/Test/3/11.1a.png",
							"description": ""
						},
						"B": {
							"image": "https://resource.qchinese.net/images/Test/3/11.1b.png",
							"description": ""
						},
						"C": {
							"image": "https://resource.qchinese.net/images/Test/3/11.1c.png",
							"description": ""
						},
						"D": {
							"image": "https://resource.qchinese.net/images/Test/3/11.1d.png",
							"description": ""
						},
						"E": {
							"image": "https://resource.qchinese.net/images/Test/3/11.1e.png",
							"description": ""
						}
					},
					"body": [
						{
							"number": "1",
							"header": {
								"audio": "https://resource.qchinese.net/audios/Test/3/HSK3-11 - question 3.mp3"
							},
							"listenContent": "女:你一直看手表,有什么着急的事情吗?\n男:我九点前必须回到办公室,经理有事情找我,再见。"
						},
						{
							"number": "2",
							"header": {
								"audio": "https://resource.qchinese.net/audios/Test/3/HSK3-11 - question 4.mp3"
							},
							"listenContent": "男:你想什么呢?要出去吗?\n女:明天同学结婚,我在想穿哪双鞋好呢。"
						},
						{
							"number": "3",
							"header": {
								"audio": "https://resource.qchinese.net/audios/Test/3/HSK3-11 - question 5.mp3"
							},
							"listenContent": "女:你每天都骑自行车上下班?\n男:是,我骑了四个月了,一共瘦了六斤。"
						},
						{
							"number": "4",
							"header": {
								"audio": "https://resource.qchinese.net/audios/Test/3/HSK3-11 - question 6.mp3"
							},
							"listenContent": "男:真的不需要吃药吗?\n女:不需要,回去多喝水,休息两天就好了。"
						},
						{
							"number": "5",
							"header": {
								"audio": "https://resource.qchinese.net/audios/Test/3/HSK3-11 - question 7.mp3"
							},
							"listenContent": "女:你看,上次出现的问题,我已经解决了。\n男:好极了!只是你要注意身体,我记得你有一个多星期没去跑步了。"
						}
					],
					"category": "NGHE",
					"listenContent": ""
				},...
			],
			"submitDate": "2021-05-15 10:36:29.0",
			"isPromote": false,
			"time": 5
		},...
	]
}
⚠️ **GitHub.com Fallback** ⚠️