API documentation
● Auth microservices:
1) Register: Register as either student or tutor with username and password.
Request format :
curl --location --request POST 'http://127.0.0.1:4000/auth/register' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'username=trial_username_student_1' \
--data-urlencode 'password=param12345' \
--data-urlencode 'user_type=student'
2) login: login with username and password and sign for JWT token which will be
forwarded for other requests.
Request format :
curl --location --request POST 'http://127.0.0.1:4000/auth/login' \
--header 'Authorization: Bearer
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6NSwidXNlcl90eXBlIjoic3R1ZGVudCIsImlhdCI6MTY0Mz
EwMTA0OCwiZXhwIjoxNjQzMTA0NjQ4fQ.a-AQIrsqJQcQMoHzB1431Snyvh4mxfZEv4ewhtfnU9c' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'username=trial_username_student' \
--data-urlencode 'password=param1234'
● Assignment services :
1) Add Assignment: only the tutor is allowed to add assignment with required
fields.
Request format:
curl --location --request POST 'http://127.0.0.1:3000/assignment/addassignment' \
--header 'Authorization: Bearer
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6NCwidXNlcl90eXBlIjoidHV0b3IiLCJpYXQiOjE2
NDMwOTM2MjYsImV4cCI6MTY0MzA5NzIyNn0.cGq1cA3JqkUlJ-XLDxMQtmxHa2Jhtq2iUifZAKSb
X0M' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'description=trial description for that purpose' \
--data-urlencode 'published_at=1000-01-01 00:00:00.000000' \
--data-urlencode 'deadline_date=1000-05-01 00:00:00.000000' \
--data-urlencode 'studentlist=trial_username_student,trial_username_student_1'
2) Student submission: only students can submit the assignment.
Request format :
curl --location --request POST 'http://127.0.0.1:3000/assignment/submitassignment' \
--header 'Authorization: Bearer
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6NSwidXNlcl90eXBlIjoic3R1ZGVudCIsImlhdCI6
MTY0MzEwMTEzMSwiZXhwIjoxNjQzMTA0NzMxfQ.JS41szjzt_Qjkg1c5NY5xHGyB4SFOxAXkgeGI
5jxqqE' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'assignment_id=25' \
--data-urlencode 'remark=trial remark for trial purpose'
3) Delete assignment : only the tutor can delete the assignment.
Request format:
curl --location --request POST
'http://127.0.0.1:3000/assignment/deleteassignment?assignment_id=25' \
--header 'Authorization: Bearer
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6NSwidXNlcl90eXBlIjoic3R1ZGVudCIsImlhdCI6
MTY0MzEwMTEzMSwiZXhwIjoxNjQzMTA0NzMxfQ.JS41szjzt_Qjkg1c5NY5xHGyB4SFOxAXkgeGI
5jxqqE'
4) Get assignment: Students and tutors can call this API to get their
submitted assignments or assignments uploaded by all the students
incase it is called by tutor.
Request format :
curl --location --request POST 'http://127.0.0.1:3000/assignment/getassignment?assignment_id=25'
\
--header 'Authorization: Bearer
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6NSwidXNlcl90eXBlIjoic3R1ZGVudCIsImlhdCI6
MTY0MzEwMTEzMSwiZXhwIjoxNjQzMTA0NzMxfQ.JS41szjzt_Qjkg1c5NY5xHGyB4SFOxAXkgeGI
5jxqqE'
5) Assignment feed : Students can know their assigned assignments or the
tutor can know the assignments they have uploaded.
In this case there are optional parametersincase published_at is provided
only those assignments will be returned. Incase student is requesting and
asking for assignments with particular status only those will be returned.
Request Format:
Incase of tutor :
curl --location --request POST 'http://127.0.0.1:3000/assignment/feedassignment?published_at
=2022-01-25T12:51:08.337Z' \
--header 'Authorization: Bearer
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6NSwidXNlcl90eXBlIjoic3R1ZGVudCIsImlhdCI6
MTY0MzEwMTEzMSwiZXhwIjoxNjQzMTA0NzMxfQ.JS41szjzt_Qjkg1c5NY5xHGyB4SFOxAXkgeGI
5jxqqE'
Incase of student:
curl --location --request POST
'http://127.0.0.1:3000/assignment/feedassignment?status=PENDING' \
--header 'Authorization: Bearer
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6NSwidXNlcl90eXBlIjoic3R1ZGVudCIsImlhdCI6
MTY0MzEwMTEzMSwiZXhwIjoxNjQzMTA0NzMxfQ.JS41szjzt_Qjkg1c5NY5xHGyB4SFOxAXkgeGI
5jxqqE'