For further reference, please consider the following sections:
The following guides illustrate how to use some features concretely:
Register
curl -v --header "Content-Type: application/json" \
--request POST \
--data '{"userName":"test","password":"fake"}' \
http://localhost:8080/user/register
Login
curl -v --user test:fake http://localhost:8080/user/login
Logout
curl http://localhost:8080/user/logout
Show Favorites
curl -v http://localhost:8080/user/test/favorites
Add Material to Favorites
curl -v --header "Content-Type: application/json" \
--request POST \
--data '{"id":"6017ac5f0a02022776965418"}' \
http://localhost:8080/user/test/favorites
Delete Material to Favorites
curl -v --header "Content-Type: application/json" \
--request DELETE \
--data '{"id":"6017ac5f0a02022776965418"}' \
http://localhost:8080/user/test/favorites
Show Root Categories
curl -v http://localhost:8080/categories
Show specific category info (will return an array including all its subCategories)
curl -v http://localhost:8080/categories/6017a128200eb739d8576281
Create Categories
curl -v --header "Content-Type: application/json" \
--request POST \
--data '{"name":"测试类root", "dummy": "nothing"}' \
http://localhost:8080/admin/materialCategories
curl -v --header "Content-Type: application/json" \
--request POST \
--data '{"name":"测试类root2", "parentId": "6017a0e7200eb739d8576280"}' \
http://localhost:8080/admin/materialCategories
curl -v --header "Content-Type: application/json" \
--request POST \
--data '{"name":"测试3", "parentId": "6017a0e7200eb739d8576280"}' \
http://localhost:8080/admin/materialCategories
Edit Category
curl -v --header "Content-Type: application/json" \
-X PUT \
--data '{"name":"测试类root2", "parentId": null}' \
http://localhost:8080/admin/categories/6017a128200eb739d8576281
Delete Category
curl -v --header "Content-Type: application/json" \
-X DELETE \
http://localhost:8080/admin/categories/6017a128200eb739d8576281
Create Material
curl -v --header "Content-Type: application/json" \
-X POST \
--data '{"name":"测试材料1", "description": "This is only for testing"}' \
http://localhost:8080/admin/materials
Edit Material
curl -v --header "Content-Type: application/json" \
-X PUT \
--data '{"name":"测试材料1", "description": "This is only for testing", "contents": "钊哥真帅"}' \
http://localhost:8080/admin/materials/6017a89cf3ae0e6d5288354d
Like Material
curl -v --header "Content-Type: application/json" \
-X POST \
--data '{"id":"601677a8e2f8a06e3d15c292"}' \
http://localhost:8080/materials/6017a89cf3ae0e6d5288354d/like
Read Material
curl -v --header "Content-Type: application/json" \
-X POST \
--data '{"id":"601677a8e2f8a06e3d15c292"}' \
http://localhost:8080/materials/6017a89cf3ae0e6d5288354d/read
Get Material
curl -v http://localhost:8080/materials/6017a89cf3ae0e6d5288354d
Delete Material
curl -v --header "Content-Type: application/json" \
-X DELETE \
http://localhost:8080/admin/materials/6017a89cf3ae0e6d5288354d
Start exam
curl -v --header "Content-Type: application/json" \
-X POST \
--data '{"userName":"testuser-JDWkEEmbvq"}' \
http://localhost:8080/exams/60332015f62a7768d567a023/start
End exam
curl -v --header "Content-Type: application/json" \
-X POST \
--data '{"userId":"testuser-JDWkEEmbvq", "points": 5}' \
http://localhost:8080/exams/60332015f62a7768d567a023/end