0% found this document useful (0 votes)
93 views

API Documentation

This API documentation describes authentication and assignment microservices. The authentication microservice allows users to register with a username and password as either a student or tutor, and to login to obtain a JWT token for authentication in other requests. The assignment microservice allows tutors to add, delete, and retrieve assignments, and allows students to submit assignments and view assigned or pending assignments. Requests are authenticated with JWT bearer tokens and include parameters like assignment IDs, descriptions, and deadlines.

Uploaded by

Param Shah
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
93 views

API Documentation

This API documentation describes authentication and assignment microservices. The authentication microservice allows users to register with a username and password as either a student or tutor, and to login to obtain a JWT token for authentication in other requests. The assignment microservice allows tutors to add, delete, and retrieve assignments, and allows students to submit assignments and view assigned or pending assignments. Requests are authenticated with JWT bearer tokens and include parameters like assignment IDs, descriptions, and deadlines.

Uploaded by

Param Shah
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

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'

You might also like