Home Projects Jsjiit Api Reference Attendance Methods

Attendance Methods

Purpose and Scope

This document covers the attendance-related methods exposed by the WebPortal class, which enable retrieval of student attendance data from the JIIT Web Portal. These methods provide access to attendance metadata, semester-specific attendance details, and subject-level daily attendance records.

For authentication and session management required before calling these methods, see Authentication and Session Management. For the data model classes returned by these methods, refer to the Data Models section below and Data Models.


Attendance Retrieval Workflow

The attendance retrieval process follows a hierarchical structure where metadata must be retrieved first to obtain the necessary identifiers for more detailed queries.

Workflow Diagram

Architecture Diagram

Sources: src/wrapper.js243-300 README.md50-68


Method Reference

get_attendance_meta()

Retrieves attendance metadata including available headers and semesters. This method must be called first to obtain the AttendanceHeader and Semester objects required by subsequent attendance methods.

Signature

async get_attendance_meta()

Parameters

None.

Returns

Type Description
Promise<AttendanceMeta> Object containing lists of attendance headers and semesters

API Endpoint

  • URL: /StudentClassAttendance/getstudentInforegistrationforattendence
  • Method: POST
  • Authentication: Required

Payload Structure

{
  clientid: this.session.clientid,
  instituteid: this.session.instituteid,
  membertype: this.session.membertype
}

Implementation Details

The method constructs a payload using session data and sends it to the attendance metadata endpoint. The response is wrapped in an AttendanceMeta instance which provides convenient access to headers and semesters.

Architecture Diagram

Sources: src/wrapper.js243-254 src/attendance.js50-76


get_attendance()

Retrieves detailed attendance information for a specific semester using the provided header and semester objects.

Signature

async get_attendance(header, semester)

Parameters

Parameter Type Description
header AttendanceHeader Attendance header obtained from get_attendance_meta()
semester Semester Semester object obtained from get_attendance_meta()

Returns

Type Description
Promise<Object> Attendance details including subject-wise attendance records

Response Structure

The response contains a studentattendancelist array where each element represents a subject with the following key fields:

Field Description
subjectid Unique identifier for the subject
individualsubjectcode Subject code
Lsubjectcomponentid Lecture component ID (if applicable)
Psubjectcomponentid Practical component ID (if applicable)
Tsubjectcomponentid Tutorial component ID (if applicable)

API Endpoint

  • URL: /StudentClassAttendance/getstudentattendancedetail
  • Method: POST
  • Authentication: Required

Payload Structure

The payload is encrypted using serialize_payload() before transmission:

{
  clientid: this.session.clientid,
  instituteid: this.session.instituteid,
  registrationcode: semester.registration_code,
  registrationid: semester.registration_id,
  stynumber: header.stynumber
}

Sources: src/wrapper.js262-277 README.md50-56


get_subject_daily_attendance()

Retrieves attendance records for every class of a specific subject within a semester. This provides granular, class-by-class attendance data.

Signature

async get_subject_daily_attendance(semester, subjectid, individualsubjectcode, subjectcomponentids)

Parameters

Parameter Type Description
semester Semester Semester object
subjectid string Subject ID from attendance response
individualsubjectcode string Individual subject code from attendance response
subjectcomponentids Array<string> Array of component IDs (L/P/T)

Returns

Type Description
Promise<Object> Subject-specific attendance details with daily records

API Endpoint

  • URL: /StudentClassAttendance/getstudentsubjectpersentage
  • Method: POST
  • Authentication: Required

Payload Structure

The payload is encrypted and includes:

{
  cmpidkey: subjectcomponentids.map(id => ({ subjectcomponentid: id })),
  clientid: this.session.clientid,
  instituteid: this.session.instituteid,
  registrationcode: semester.registration_code,
  registrationid: semester.registration_id,
  subjectcode: individualsubjectcode,
  subjectid: subjectid
}

Extracting Component IDs

The subjectcomponentids array must be constructed by checking which component types exist for the subject:

const possibleComponentCodes = [
  "Lsubjectcomponentid",  // Lecture
  "Psubjectcomponentid",  // Practical
  "Tsubjectcomponentid"   // Tutorial
];

Sources: src/wrapper.js287-300 README.md57-68


Data Models

AttendanceHeader

Represents header information for attendance queries.

Architecture Diagram

Property Type Description
branchdesc string Branch description (e.g., "Computer Science Engineering")
name string Student name
programdesc string Program description (e.g., "B.Tech")
stynumber string Style number identifier used in API requests

Sources: src/attendance.js4-27


Semester

Represents a semester registration.

Architecture Diagram

Property Type Description
registration_code string Semester code (e.g., "2023ODD")
registration_id string Unique registration identifier

Sources: src/attendance.js29-48


AttendanceMeta

Container for attendance metadata including headers and semesters.

Architecture Diagram

Property Type Description
raw_response Object Original API response
headers Array<AttendanceHeader> List of attendance headers
semesters Array<Semester> List of available semesters

Methods

Method Returns Description
latest_header() AttendanceHeader Returns first (most recent) header
latest_semester() Semester Returns first (most recent) semester

Sources: src/attendance.js50-76


Complete Usage Example

The following example demonstrates the full workflow for retrieving attendance data:

// Step 1: Get attendance metadata
const meta = await portal.get_attendance_meta();
const semester = meta.latest_semester();
const header = meta.latest_header();

// Step 2: Get attendance for the semester
const attendance = await portal.get_attendance(header, semester);

// Step 3: Select a subject (e.g., second subject in the list)
const subjectIndex = 1;
const subject = attendance.studentattendancelist[subjectIndex];

// Step 4: Extract subject identifiers
const subjectid = subject.subjectid;
const individualsubjectcode = subject.individualsubjectcode;

// Step 5: Collect all available component IDs
const possibleComponentCodes = [
  "Lsubjectcomponentid",
  "Psubjectcomponentid", 
  "Tsubjectcomponentid"
];

const subjectcomponentids = [];
for (let code of possibleComponentCodes) {
  if (subject[code]) {
    subjectcomponentids.push(subject[code]);
  }
}

// Step 6: Get daily attendance for the subject
const subjectAttendance = await portal.get_subject_daily_attendance(
  semester,
  subjectid,
  individualsubjectcode,
  subjectcomponentids
);

Sources: README.md50-68


Method Dependencies and Call Graph

Architecture Diagram

Sources: src/wrapper.js243-300 src/wrapper.js168-186


Authentication Requirements

All attendance methods require an authenticated session. They are decorated with the authenticated decorator which validates that this.session is not null before execution.

Method Authentication Required Decorator Applied
get_attendance_meta() Yes Line 696
get_attendance() Yes Line 697
get_subject_daily_attendance() Yes Line 698

If called without authentication, these methods throw a NotLoggedIn exception.

Sources: src/wrapper.js692-719 src/exceptions.js


Encryption and Security

Both get_attendance() and get_subject_daily_attendance() use encrypted payloads via the serialize_payload() function from the encryption module. This applies AES-CBC encryption to sensitive data before transmission.

For details on the encryption mechanism, see Encryption and Security.

Sources: src/wrapper.js265-271 src/wrapper.js289-297 src/encryption.js


API Endpoint Summary

Method Endpoint Path Encryption Required
get_attendance_meta() /StudentClassAttendance/getstudentInforegistrationforattendence No
get_attendance() /StudentClassAttendance/getstudentattendancedetail Yes
get_subject_daily_attendance() /StudentClassAttendance/getstudentsubjectpersentage Yes

All endpoints are prefixed with the base API URL: https://webportal.jiit.ac.in:6011/StudentPortalAPI

Sources: src/wrapper.js14 src/wrapper.js244 src/wrapper.js263 src/wrapper.js288