๐Ÿ“ข API Documentation

Signup API

Users can create a new account by providing their information.

๐Ÿ”— Endpoint:
POST https://www.ta2.today/api/signup/
๐Ÿ“Œ Request Example:
{
"username": "newuser123",
"email": "user@example.com",
"password": "password123",
"confirm_password": "password123"
}
๐Ÿ“Œ Response Example:
{
"message": "User registered successfully. Please login to continue."
}

Login API

User can log in using their credentials to receive access and refresh tokens.

๐Ÿ”— Endpoint:
POST https://www.ta2.today/api/login/
๐Ÿ“Œ Request Example:
{
"username": "user123",
"password": "password123"
}
๐Ÿ“Œ Response Example:
{
"access": "ACCESS_TOKEN",
"refresh": "REFRESH_TOKEN"
}

User Profile API

Submit user details such as class, syllabus, and medium. This API requires authentication using an access token.

๐Ÿ”— Endpoint:
POST https://www.ta2.today/submit-details/
๐Ÿ›ก๏ธ Authorization: Add the access token in the headers using the format:
Authorization: Bearer ACCESS_TOKEN
๐Ÿ“Œ Request Example:
{
    "class_name": "10",
    "syllabus": "CBSE",
    "medium": "English"
}
๐Ÿ“Œ Response Example:
{
    "message": "Details submitted successfully."
}

4. Get Videos API

Fetch videos by chapter and topic number. Optionally, specify the medium (e.g., 'malayalam') as a query parameter.

Endpoint:
GET https://www.ta2.today/videos/<chapter_number>/<topic_number>/
Example URL:
GET https://ta2.today/videos/1/1/?medium=malayalam
Response Example:
[
    {
        "id": 1,
        "chapter": {
            "id": 3,
            "name": "เดธเดฎเดพเดจเตเดคเดฐเดถเตเดฐเต‡เดฃเดฟเด•เตพ",
            "chapter_number": 1,
            "number_of_topics": 7
        },
        "topic": {
            "id": 4,
            "name": "เดธเด‚เด–เตเดฏเด•เตเดฐเดฎเด™เตเด™เตพ",
            "topic_number": 1
        },
        "video_file": "https://sam1chapterstopics.s3.amazonaws.com/videos/chap1topic1.mp4"
    }
]

AI Response API

Ask a question to the AI Tutor (General AI Response).

๐Ÿ”— Endpoint:
POST https://www.ta2.today/get-response/
๐Ÿ“Œ Request Example:
{
    "question": "What is 2 + 2?"
}
๐Ÿ“Œ Response Example:
{
    "response": "2 + 2 is 4"
}

GPT AI Response API

Get a GPT-4 AI-generated response.

๐Ÿ”— Endpoint:
POST https://www.ta2.today/get-gpt-response/
๐Ÿ“Œ Request Example:
{
    "question": "Explain Pythagoras theorem."
}
๐Ÿ“Œ Response Example:
{
    "response": "The Pythagorean theorem states that in a right triangle, the square of the hypotenuse is equal to the sum of the squares of the other two sides."
}

Get Subjects API

Retrieve a list of all subjects.

๐Ÿ”— Endpoint:
GET https://www.ta2.today/subjects/
๐Ÿ“Œ Response Example:
[
    {
        "id": 1,
        "name": "Mathematics"
    }
]

Get Chapters API

Fetch chapters of a specific subject.

๐Ÿ”— Endpoint:
GET https://www.ta2.today/subjects/<subject_id>/chapters/
๐Ÿ“Œ Response Example:
[
    {
        "id": 1,
        "name": "Arithmetic Sequence",
        "subject_id": 1
        "number_of_topics" :7
    }
]

Get Chapter Introduction API

Retrieve an introduction to a specific chapter.

๐Ÿ”— Endpoint:
GET https://www.ta2.today/chapters/<chapter_id>/intro/
๐Ÿ“Œ Response Example:
{
    "intro": "Hi students, this chapter is Arithmetic Sequence and we have to cover 5 topics. The first topic is Number Pattern."
}

Get Topics API

Fetch topics for a specific chapter.

๐Ÿ”— Endpoint:
GET https://www.ta2.today/chapters/<chapter_id>/topics/
๐Ÿ“Œ Response Example:
[
    {
        "id": 1,
        "name": "Number Pattern",
        "topic_number": 1
    },
    {
        "id": 2,
        "name": "Algebra of Sequance",
        "topic_number": 2
    }
]

Mark Video as Watched API

Mark a video as watched by the user. This API requires authentication using an access token.

๐Ÿ”— Endpoint:
POST https://www.ta2.today/mark_video_watched/
๐Ÿ›ก๏ธ Authorization: Add the access token in the headers using the format:
Authorization: Bearer ACCESS_TOKEN
๐Ÿ“Œ Request Example:
{
    "video_id": 123
}
๐Ÿ“Œ Response Example:
{
    "message": "Video marked as watched successfully!"
}
๐Ÿ“Œ Error Responses:
{
    "error": "Video ID is required!"
}

{
    "error": "Video not found!"
}

User Progress API

Fetch the progress of a specific user by their user ID.

๐Ÿ”— Endpoint:
GET https://www.ta2.today/user_progress/<user_id>/
๐Ÿ“Œ Response Example:
{
    "username": "student123",
    "subjects": [
        {
            "id": 1,
            "name": "Mathematics",
            "chapters": [
                {
                    "id": 1,
                    "name": "Arithmetic Sequence",
                    "chapter_number": 1,
                    "topics": [
                        {
                            "id": 1,
                            "name": "Number Pattern",
                            "topic_number": 1,
                            "completed": true
                        },
                        {
                            "id": 2,
                            "name": "Series and Progressions",
                            "topic_number": 2,
                            "completed": false
                        }
                    ]
                }
            ]
        }
    ]
}
๐Ÿ“Œ Error Response Example (User Not Found):
{
    "error": "User not found"
}