git clone https://github.com/Shishya-App/shishyaBackend-user.git
virtualenv venv
venv/Scripts/activate
source venv/bin/activate
deactivate
After creating virtual environment
pip install -r requirements.txt
python manage.py makemigrations
python manage.py migrate
python manage.py runserver
https://shishya-backend-user.herokuapp.com/register/
Parameter | Type | Description |
---|---|---|
- | - | Registers new users (User side) |
curl --location --request POST 'https://shishya-backend-user.herokuapp.com/register/' \
--header 'Content-Type: application/json' \
--header 'Cookie: csrftoken=62KjlMixjCOIaieXB4eUNjQidMxmzhsxHmcrjhXZpaPlzMvZb4EhCqdOQNg5t8wx' \
--data-raw '{
"email": "[email protected]",
"password": "********",
"username": "mugdha2",
"first_name": "Mugdha",
"last_name" : "Sharma",
"adhaar_no": "<a string of length 12, integers>"
}'
As per the problem statement,after registration the user gets OTP at linked phone number with Adhaar card. Twilio free version was used for this purpose.As of now, register only works on some adhaar number because of limited database (if used on heroku url). For local trials, go to django admin and add adhaar number with phone number at DB before registration.
Then use the same adhaar to get OTP at registered mobile number.
https://shishya-backend-user.herokuapp.com/verify-otp/
Parameter | Type | Description |
---|---|---|
id | Integer | User ID (provided by django) |
OTP | string | string of length 12 characters made of integers |
{
"id": 17,
"OTP" : "****************"
}
https://shishya-backend-user.herokuapp.com/login/
Parameter | Type | Description |
---|---|---|
- | - | Login user (working both admin and user side) |
curl --location --request POST 'https://shishya-backend-user.herokuapp.com/login/' \
--header 'Content-Type: application/json' \
--data-raw '{
"password": "demopass",
"username": "mugdha1"
}'
sample output of a user
{
"username": "mugdha4",
"tokens": {
"refresh": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0b2tlbl90eXBlIjoicmVmcmVzaCIsImV4cCI6MTY3ODY4Mzk1OCwiaWF0IjoxNjYxNDAzOTU4LCJqdGkiOiJlZjY4Y2YxYmNiNDI0ZWEwOWYwOThmNjBiYmUyOTIyYyIsInVzZXJfaWQiOjR9.DX9IIWP2j6fR6H2fkbicS56kwAuztZm0-HiX6mY2Y7U",
"access": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0b2tlbl90eXBlIjoiYWNjZXNzIiwiZXhwIjoxNjc4NjgzOTU4LCJpYXQiOjE2NjE0MDM5NTgsImp0aSI6Ijg1MzAyYTE0OWI2OTRmNDI4ODQ2MTNlMWIxNzkzMDY5IiwidXNlcl9pZCI6NH0.CPKuozrnFPdApmbTHoTjT2C38lu6FLQp2a3SjWAVGmU"
},
"first_name": "Mugdha",
"last_name": "Sharma"
}
https://shishya-backend-user.herokuapp.com/adminpanel/personal-details/
Parameter | Type | Description |
---|---|---|
Bearer Token |
String |
Get API personal details of user |
curl --location --request GET 'https://shishya-backend-user.herokuapp.com/adminpanel/personal-details/' \
--header 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0b2tlbl90eXBlIjoiYWNjZXNzIiwiZXhwIjoxNjc3OTMxNjM5LCJpYXQiOjE2NjA2NTE2MzksImp0aSI6Ijk3OGIwZmE1YmVjMzQ5NjNhMTVjNGU3ZGRhNjQyMGJiIiwidXNlcl9pZCI6Mn0.WpnaBg8LL_dfXvLD38OFKEQBPyc6X05rgneGHbvbBFU'
https://shishya-backend-user.herokuapp.com/adminpanel/document/
Parameter | Type | Description |
---|---|---|
Bearer Token |
String |
Get API, get documents of an user |
Curl Request
curl --location --request GET 'https://shishya-backend-user.herokuapp.com/adminpanel/document/'
https://shishya-backend-user.herokuapp.com/adminpanel/all-questions/${form_id}
Parameter | Type | Description |
---|---|---|
form_id |
int |
View questions of a particular Form |
curl --location --request GET 'https://shishya-backend-user.herokuapp.com/adminpanel/questions/1' \
--header 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0b2tlbl90eXBlIjoiYWNjZXNzIiwiZXhwIjoxNjc3OTMxNjM5LCJpYXQiOjE2NjA2NTE2MzksImp0aSI6Ijk3OGIwZmE1YmVjMzQ5NjNhMTVjNGU3ZGRhNjQyMGJiIiwidXNlcl9pZCI6Mn0.WpnaBg8LL_dfXvLD38OFKEQBPyc6X05rgneGHbvbBFU'
Sample output
{
"text_questions": [],
"file_questions": [
{
"id": 1,
"form": 1,
"title": "Adhaar",
"answer": [],
"technique": "file_upload"
}
],
"MCQ_questions": [],
"pre_verified": [
{
"id": 2,
"form": 1,
"title": "BirthCertificate",
"answer": [],
"technique": "pre_verified"
},
{
"id": 3,
"form": 1,
"title": "HSC",
"answer": [],
"technique": "pre_verified"
}
]
}
https://shishya-backend-user.herokuapp.com/adminpanel/form/
https://shishya-backend-user.herokuapp.com/adminpanel/form/${form_id}
Parameter | Type | Description |
---|---|---|
Bearer Token |
String |
View all Forms |
id |
int |
View form from form.id |
curl --location --request GET 'https://shishya-backend-user.herokuapp.com/adminpanel/form/1' \
--header 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0b2tlbl90eXBlIjoiYWNjZXNzIiwiZXhwIjoxNjc3OTMxNjM5LCJpYXQiOjE2NjA2NTE2MzksImp0aSI6Ijk3OGIwZmE1YmVjMzQ5NjNhMTVjNGU3ZGRhNjQyMGJiIiwidXNlcl9pZCI6Mn0.WpnaBg8LL_dfXvLD38OFKEQBPyc6X05rgneGHbvbBFU'
https://shishya-backend-user.herokuapp.com/adminpanel/form/
Parameter | Type | Description |
---|---|---|
Bearer Token |
String |
Create new Form |
curl --location --request POST 'http://127.0.0.1:8000/adminpanel/form/' \
--header 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0b2tlbl90eXBlIjoiYWNjZXNzIiwiZXhwIjoxNjc5MDM5OTg1LCJpYXQiOjE2NjE3NTk5ODUsImp0aSI6IjcwZmFkZTYyNTEzZTQxNjFiN2VhN2U3ZGVkNTVhMmE1IiwidXNlcl9pZCI6NH0.0JZ1U7fFhohfwAWMgYX7YGZCq43i2zGX5nDK3fJY2w8' \
--header 'Content-Type: application/json' \
--header 'Cookie: csrftoken=62KjlMixjCOIaieXB4eUNjQidMxmzhsxHmcrjhXZpaPlzMvZb4EhCqdOQNg5t8wx' \
--data-raw '{
"title": "Form2",
"owner": 4,
"deadline": "2022-08-26",
"description": "sample description2",
"academic_year": 2020
}'
Sample Output:
{
"id": 2,
"title": "Form2",
"deadline": "2022-08-26",
"description": "sample description2",
"academic_year": 2020,
"owner": 4
}
Supports get request as well, it retrieves all forms of a user (provided we have bearer token in header)
8.
```http
https://shishya-backend-user.herokuapp.com/userpanel/profile-documents/
Parameter | Type | Description |
---|---|---|
Bearer Token |
String |
Retrieve NAD+Custom uploaded documents in profile section |
curl --location --request GET 'https://shishya-backend-user.herokuapp.com/userpanel/profile-documents/' \
--header 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0b2tlbl90eXBlIjoiYWNjZXNzIiwiZXhwIjoxNjc4MzQwODgwLCJpYXQiOjE2NjEwNjA4ODAsImp0aSI6IjRlOWYzZTZkZjE3NjRlMDI4M2M5ZGJmNmEwN2YxZWZjIiwidXNlcl9pZCI6Mn0.-X4_PHZ2XOBo_oTkOugPa-h9dRdrlmrZDHj-tXUVAps'
sample output
{
"user": 2,
"NAD_Document": [
{
"id": 1,
"user": 2,
"SSC": 1,
"HSC": 1,
"MigrationCertificate": 1,
"JEEmarksheet": 1,
"JEEallotmentLetter": 1,
"DisabilityCertificate": 1,
"DomicileCertificate": 1,
"PAN": 1,
"BirthCertificate": 1,
"SportsCertificate": 1,
"TransferCertificate": 1,
"CasteCertificate": 1,
"Passport": 1,
"IncomeCertificate": 1,
"MedicalCertificate": 1,
"NationalityCertificate": 1
}
],
"Custom_Document": []
}
"Custom_Document": [] , JSON in this will get auto appended whenever user uploads the document
https://shishya-backend-user.herokuapp.com/userpanel/custom-document/
Parameter | Type | Description |
---|---|---|
Bearer Token |
String |
Upload custom documents in profile section |
How to use?
{
"File": <upload from PC>, (required)
"PagesNo": <enter/retreive>, (required)
"Title": "Sample Title", (required)
"isVerified": false, (default)
"user": <This is auto fill field, which is handled by backend>
}
https://shishya-backend-user.herokuapp.com/userpanel/recent-upload/
Parameter | Type | Description |
---|---|---|
Bearer Token |
String |
Get recent 5 documents from the profile |
https://shishya-backend-user.herokuapp.com/adminpanel/bool-docs/
Parameter | Type | Description |
---|---|---|
Bearer Token |
String |
Check which pre-verified documents are already uploaded for user |
Sample Output:
{
"SSC": false,
"HSC": false,
"AdhaarFile": false,
"MigrationCertificate": false,
"JEEmarksheet": false,
"JEEallotmentLetter": false,
"DisabilityCertificate": false,
"DomicileCertificate": false,
"PAN": false,
"BirthCertificate": true,
"SportsCertificate": false,
"TransferCertificate": false,
"CasteCertificate": false,
"Passport": false,
"IncomeCertificate": false,
"MedicalCertificate": false,
"NationalityCertificate": false
}
- Get all Questions of a form
http://127.0.0.1:8000/adminpanel/questions/1
Parameter | Type | Description |
---|---|---|
pk |
String |
Check which pre-verified documents are already uploaded for user |
Sample Output:
{
"text_questions": [],
"file_questions": [
{
"id": 1,
"form": 1,
"title": "Adhaar",
"answer": [],
"technique": "file_upload"
}
],
"MCQ_questions": [],
"pre_verified": [
{
"id": 2,
"form": 1,
"title": "BirthCertificate",
"answer": [],
"technique": "pre_verified"
},
{
"id": 3,
"form": 1,
"title": "HSC",
"answer": [],
"technique": "pre_verified"
}
]
}
- Get all Responses of a form
Post: https://shishya-backend-user.herokuapp.com/adminpanel/view-responses/
{
"form":1
}
Sample Output:
{
"Custom_Upload": [
{
"id": 1,
"answer": "/media/docs/riya_--blr_to_abad_dxBRQeg.pdf",
"form": 1,
"user": 1,
"question": 1
},
{
"id": 2,
"answer": "/media/docs/riya_--blr_to_abad_nKqR3sV.pdf",
"form": 1,
"user": 4,
"question": 1
},
{
"id": 3,
"answer": "/media/docs/riya_--blr_to_abad_LVgs4za.pdf",
"form": 1,
"user": 1,
"question": 1
}
],
"Pre Verified": [
{
"id": 1,
"title": "HSC",
"form": 1,
"question": 3,
"file_id": 1,
"user": 4
}
]
}