Skip to main content

Mentors

Admin APIs require authorization token with admin privileges. You check the following link to generate authorization token. You need to provide admin username and password to generate token with admin privileges.

Authentication

Admin Mentors API gives you access to create/view mentors and add/remove students to mentors.

Create Mentor

This endpoint creates a mentor.

HTTP Request

POST /api/v2.5/admin/mentors/

Fields

NameTypeDescription
usernamestringUsername of the mentor
passwordstringpassword of the mentor
first_namestringFirst name of the mentor
last_namestringLast name of the mentor
emailstringEmail of the mentor
birth_datedatestringBirth date of mentor. Should be in DD/MM/YYYY format
gender_codestringGender of mentor. Can be "male", "female" or "trans"
address1stringAddress of mentor
address2stringAddress of mentor
citystringCity of mentor
zipstringPincode of mentor
state_codestringState of mentor in ISO 3166-2:IN format (https://en.wikipedia.org/wiki/ISO_3166-2:IN)
phonestringPhone of mentor
curl --request POST \
--url http://demo.testpress.in/api/v2.5/admin/mentors/ \
--header 'authorization: JWT eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6MzgsInVzZXJfaWQiOjM4LCJlbWFpbCI6InN0ZWVwaGFuc2VsdmFyYWpAdGVzdHByZXNzLmluIiwiZXhwIjoxNDc1MDYyMTkwfQ.iwVg_UM4HBB6qs21fe2b6FlNz_JjRfqcs2VTML4Te3k' \
--header 'cache-control: no-cache' \
--header 'content-type: application/json' \
--header 'postman-token: 9624f4b4-d495-aaaa-df27-b99f0cef13b4' \
--data '{\n "username": "Georgebobby", \n "password":"password",\n "first_name": "George", \n "last_name": "Bobby", \n "email": "george@hotmail.com", \n "birth_date": "03/07/1990", \n "gender_code": "male", \n "address1": "21 New Street", \n "address2": "Chrompet", \n "city": "Chennai", \n "zip": "641003", \n "state_code": "IN-TN", \n "phone": "9876543210"\n}'

Response

{
"id": 45,
"username": "Georgebobby",
"email": "george@hotmail.com",
"first_name": "George",
"last_name": "Bobby",
"display_name": "George Bobby",
"gender": "Male",
"state": "Tamil Nadu",
"created": "2016-09-28T19:06:18.177Z",
}


View Mentors

This endpoint allows you to view all the mentors.

HTTP Request

GET /api/v2.3/admin/mentors/

Response Fields

NameTypeDescription
idintThe mentor unique ID
usernamestringUsername of the mentor
first_namestringFirst name of the mentor
last_namestringLast name of the mentor
display_namestringDisplay name of the mentor
genderstringGender of the mentor
statestringState of the mentor
createddatetimefieldDate and time when mentor created
studentsarrayStudent details.
curl --request GET \
--url http://demo.testpress.in/api/v2.3/admin/mentors/ \
--header 'authorization: JWT eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6MzgsInVzZXJfaWQiOjM4LCJlbWFpbCI6InN0ZWVwaGFuc2VsdmFyYWpAdGVzdHByZXNzLmluIiwiZXhwIjoxNDc1MDYyMTkwfQ.iwVg_UM4HBB6qs21fe2b6FlNz_JjRfqcs2VTML4Te3k' \
--header 'cache-control: no-cache' \
--header 'content-type: application/json' \
--header 'postman-token: 7b270310-b1fe-2434-5f1d-d6a5d4c5db73'

Response

 [
{
"id": 44,
"username": "Steevwilliam",
"email": "steev@yahoomail.com",
"first_name": "Steev",
"last_name": "William",
"display_name": "Steev William",
"gender": "Male",
"state": "Tamil Nadu",
"created": "2016-09-28T18:44:54.081Z",
"students": {
"url": "http://demo.testpress.in/api/v2.3/admin/mentors/44/students/",
"students_count": 150
}
},
{
"id": 45,
"username": "Georgebobby",
"email": "george@hotmail.com",
"first_name": "George",
"last_name": "Bobby",
"display_name": "George Bobby",
"gender": "Male",
"state": "Tamil Nadu",
"created": "2016-09-28T19:06:18.177Z",
"students": {
"url": "http://demo.testpress.in/api/v2.3/admin/mentors/45/students/",
"students_count": 100
}
}
]

View Students

This endpoint allows you to view students of a particular mentor.

HTTP Request

GET /api/v2.3/admin/mentors/<:id>/students/

URL Parameters

ParameterDescription
idUnique Id of the mentor to retrieve

Response Fields

NameTypeDescription
idintUnique Id of the student
usernamestringUsername of the student
first_namestringFirst name of the student
last_namestringLast name of the student
display_namestringName of the student to be displayed
emailstringEmail of the student
photostringOriginal image of the student as uploaded
large_imagestringProfile image with size 256x256
medium_imagestringProfile image with size 128x128
small_imagestringProfile image with size 48x48
xsmall_imagestringProfile image with size 32x32
mini_imagestringProfile image with size 24x24
birth_datedatestringBirth date of student. Should be in DD/MM/YYYY format
gender_codestringGender of student. Can be "male", "female" or "trans"
genderstring(Read only) Human readable gender of student. Can be "Male", "Female" or "Transgender"
address1stringAddress of student
address2stringAddress of student
citystringCity of student
zipstringPincode of student
state_codestringState of student in ISO 3166-2:IN format (https://en.wikipedia.org/wiki/ISO_3166-2:IN)
phonestringPhone of student
batchesarrayBatches to which student has access
curl --request GET \
--url http://demo.testpress.in/api/v2.3/admin/mentors/1/students \
--header 'authorization: JWT eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6MzgsInVzZXJfaWQiOjM4LCJlbWFpbCI6InN0ZWVwaGFuc2VsdmFyYWpAdGVzdHByZXNzLmluIiwiZXhwIjoxNDc1MDYyMTkwfQ.iwVg_UM4HBB6qs21fe2b6FlNz_JjRfqcs2VTML4Te3k' \
--header 'cache-control: no-cache' \
--header 'content-type: application/json' \
--header 'postman-token: 14b92c4f-a0ad-fafb-67f4-5dc5d47ae832'

Response

[
{
"id": 2,
"url": "http://demo.testpress.in/api/v2.2/admin/users/2/",
"username": "testpress",
"first_name": "John",
"last_name": "Appleseed",
"display_name": "John Appleseed",
"email": "selvasteephandfasdfasdf@gmail.com",
"photo": "https://s3-ap-southeast-1.amazonaws.com/media.testpress.in/i/d1b9192ef434443a963eced9b8747862.jpeg",
"large_image": "https://s3-ap-southeast-1.amazonaws.com/media.testpress.in/i/2e6f0eb3bc9d467ab4254c094b47611e.jpeg",
"medium_image": "https://s3-ap-southeast-1.amazonaws.com/media.testpress.in/i/7552ce50dff6479ba172f1102c56e72d.jpeg",
"small_image": "https://s3-ap-southeast-1.amazonaws.com/media.testpress.in/i/05764a619f09474d93caf0d49a43a4c0.jpeg",
"x_small_image": "https://s3-ap-southeast-1.amazonaws.com/media.testpress.in/i/5ae9976cc2224e08ab81510404dd8c93.jpeg",
"mini_image": "https://s3-ap-southeast-1.amazonaws.com/media.testpress.in/i/34d189e496f140b3aa772ee19df46e1b.jpeg",
"birth_date": "27/08/1994",
"gender_code": "male",
"gender": "Male",
"address1": "Chennai",
"address2": "Chennai",
"city": "Chennai",
"zip": "600069",
"state": "",
"state_code": "",
"phone": "9043570576",
"batches": [
{
"id": 30,
"name": "Testing Batch 1",
"url": "http://demo.testpress.in/api/v2.2/admin/batches/30/"
},
{
"id": 29,
"name": "new sample batch",
"url": "http://demo.testpress.in/api/v2.2/admin/batches/29/"
}
],
"batches_url": "http://demo.testpress.in/api/v2.2/admin/users/2/batches/"
},
{
"id": 345,
"url": "http://demo.testpress.in/api/v2.2/admin/users/345/",
"username": "hellouser",
"first_name": "hellouser",
"last_name": "",
"display_name": "hellouser",
"email": "testingsocialauth@gmail.com",
"photo": null,
"large_image": "",
"medium_image": "",
"small_image": "",
"x_small_image": "",
"mini_image": "",
"birth_date": null,
"gender_code": null,
"gender": null,
"address1": "",
"address2": "",
"city": "",
"zip": "",
"state": "",
"state_code": "",
"phone": "9898989898",
"batches": [
{
"id": 40,
"name": "Payubatch",
"url": "http://demo.testpress.in/api/v2.2/admin/batches/40/"
},
{
"id": 29,
"name": "new sample batch",
"url": "http://demo.testpress.in/api/v2.2/admin/batches/29/"
},
{
"id": 16,
"name": "EEE",
"url": "http://demo.testpress.in/api/v2.2/admin/batches/16/"
}
],
"batches_url": "http://demo.testpress.in/api/v2.2/admin/users/345/batches/"
}
]

Add Students

This endpoint allows you to add a students to a mentor.

HTTP Request

POST /api/v2.3/admin/mentors/<:id>/students

URL Parameters

ParameterDescription
idUnique Id of the mentor to retrieve

POST data

ParameterDescription
students_usernameArray of students username

Response Fields

NameTypeDescription
idintUnique Id of the student
usernamestringUsername of the student
first_namestringFirst name of the student
last_namestringLast name of the student
display_namestringName of the student to be displayed
emailstringEmail of the student
photostringOriginal image of the student as uploaded
large_imagestringProfile image with size 256x256
medium_imagestringProfile image with size 128x128
small_imagestringProfile image with size 48x48
xsmall_imagestringProfile image with size 32x32
mini_imagestringProfile image with size 24x24
birth_datedatestringBirth date of student. Should be in DD/MM/YYYY format
gender_codestringGender of student. Can be "male", "female" or "trans"
genderstring(Read only) Human readable gender of student. Can be "Male", "Female" or "Transgender"
address1stringAddress of student
address2stringAddress of student
citystringCity of student
zipstringPincode of student
state_codestringState of student in ISO 3166-2:IN format (https://en.wikipedia.org/wiki/ISO_3166-2:IN)
phonestringPhone of student
batchesarrayBatches to which student has access
curl --request POST \
--url http://demo.testpress.in/api/v2.3/admin/mentors/1/students/ \
--header 'authorization: JWT eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6MzgsInVzZXJfaWQiOjM4LCJlbWFpbCI6InN0ZWVwaGFuc2VsdmFyYWpAdGVzdHByZXNzLmluIiwiZXhwIjoxNDc1MDYyMTkwfQ.iwVg_UM4HBB6qs21fe2b6FlNz_JjRfqcs2VTML4Te3k' \
--header 'cache-control: no-cache' \
--header 'content-type: application/json' \
--header 'postman-token: 30305f4a-5150-4ff7-5781-30f4ab972452' \
--data '{ \n "students_username": [ "john", "ragav"]\n}'

Response

[
{
"id": 2,
"url": "http://demo.testpress.in/api/v2.2/admin/users/2/",
"username": "john",
"first_name": "John",
"last_name": "Appleseed",
"display_name": "John Appleseed",
"email": "selvasteephandfasdfasdf@gmail.com",
"photo": "https://s3-ap-southeast-1.amazonaws.com/media.testpress.in/i/d1b9192ef434443a963eced9b8747862.jpeg",
"large_image": "https://s3-ap-southeast-1.amazonaws.com/media.testpress.in/i/2e6f0eb3bc9d467ab4254c094b47611e.jpeg",
"medium_image": "https://s3-ap-southeast-1.amazonaws.com/media.testpress.in/i/7552ce50dff6479ba172f1102c56e72d.jpeg",
"small_image": "https://s3-ap-southeast-1.amazonaws.com/media.testpress.in/i/05764a619f09474d93caf0d49a43a4c0.jpeg",
"x_small_image": "https://s3-ap-southeast-1.amazonaws.com/media.testpress.in/i/5ae9976cc2224e08ab81510404dd8c93.jpeg",
"mini_image": "https://s3-ap-southeast-1.amazonaws.com/media.testpress.in/i/34d189e496f140b3aa772ee19df46e1b.jpeg",
"birth_date": "27/08/1994",
"gender_code": "male",
"gender": "Male",
"address1": "Chennai",
"address2": "Chennai",
"city": "Chennai",
"zip": "600069",
"state": "",
"state_code": "",
"phone": "9043570576",
"batches": [
{
"id": 30,
"name": "Testing Batch 1",
"url": "http://demo.testpress.in/api/v2.2/admin/batches/30/"
},
{
"id": 29,
"name": "new sample batch",
"url": "http://demo.testpress.in/api/v2.2/admin/batches/29/"
}
],
"batches_url": "http://demo.testpress.in/api/v2.2/admin/users/2/batches/"
},
{
"id": 345,
"url": "http://demo.testpress.in/api/v2.2/admin/users/345/",
"username": "ragav",
"first_name": "ragav",
"last_name": "",
"display_name": "ragav",
"email": "ragav@gmail.com",
"photo": null,
"large_image": "",
"medium_image": "",
"small_image": "",
"x_small_image": "",
"mini_image": "",
"birth_date": null,
"gender_code": null,
"gender": null,
"address1": "",
"address2": "",
"city": "",
"zip": "",
"state": "",
"state_code": "",
"phone": "9898989898",
"batches": [
{
"id": 40,
"name": "Payubatch",
"url": "http://demo.testpress.in/api/v2.2/admin/batches/40/"
},
{
"id": 29,
"name": "new sample batch",
"url": "http://demo.testpress.in/api/v2.2/admin/batches/29/"
},
{
"id": 16,
"name": "EEE",
"url": "http://demo.testpress.in/api/v2.2/admin/batches/16/"
}
],
"batches_url": "http://demo.testpress.in/api/v2.2/admin/users/345/batches/"
}
]

Remove Students

This endpoint allows you to remove students from mentor.

HTTP Request

DELETE /api/v2.3/admin/mentors/<:id>/students

URL Parameters

ParameterDescription
idUnique Id of the mentor to retrieve

POST data

ParameterDescription
students_usernameArray of students username
curl --request DELETE \
--url http://demo.testpress.in/api/v2.3/admin/mentors/1/students/ \
--header 'authorization: JWT eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6MzgsInVzZXJfaWQiOjM4LCJlbWFpbCI6InN0ZWVwaGFuc2VsdmFyYWpAdGVzdHByZXNzLmluIiwiZXhwIjoxNDc1MDYyMTkwfQ.iwVg_UM4HBB6qs21fe2b6FlNz_JjRfqcs2VTML4Te3k' \
--header 'cache-control: no-cache' \
--header 'content-type: application/json' \
--header 'postman-token: 7cd40e60-ac91-ddc3-e493-b103a6b0c2e7' \
--data '{ \n "students_username": [ "john", "ragav"]\n}'

The above command on success will return 204 NO CONTENT