rootatkali / MashovAPI

Java client for the Mashov API, used in the Israeli education system.
MIT License
1 stars 1 forks source link
api client israel java school

MashovAPI Build Status

An open-source API for the Israeli Mashov school management system, written in Java. This API is WIP.

Installation

Installations for gradle:

// ...
repositories {
  // ...
  jcenter() // Use the main jcenter repository.
}

// ...

dependencies {
  implementation 'de.faceco:MashovAPI:1.0.11' // For the latest version
}

For more platforms, see the Bintray repo.

Usage

This is how to start using the API:

API api = API.getInstance();

The first step is to fetch a single school, or all of the schools:

// Single school
int schoolId = 580019;
api.fetchSchool(schoolId);

// All the schools
School[] all = api.getAllSchools();

After selecting a school, you need to log in:

LoginResult loginResult = api.login(2020, "username", "password");
if (loginResult instanceof LoginInfo) {
  LoginInfo loginInfo = (LoginInfo) loginResult;
}

After logging in, you can either read the login info or request more data, such as the grades of the student:

Grade[] grades = api.getGrades();
int gradeSum = 0;
for (Grade g : grades) {
  gradeSum += g.getGrade();
}
System.out.println(gradeSum / grades.length);