Java

Java

Overview

Our open source Java client provides a simple way to invoke the API from Java.

Installation

You can download the Java API from/clients/java-api-client.zip and include it in your project.

Dependencies: http://unirest.io/java.html and http://www.json.org/java/

Initialization

You need to import the following classes and then initialize the API class with your Host URL and Api Key:

import com.cypherlearning.client.Api;
import com.cypherlearning.client.exception.ApiException;
Api api_client = new Api("http://example.com", "YOUR API KEY");

Exception Handling

All of the exceptions raised within the Api object are encapsulated into an ApiException exception. You can easily make a separation between your exceptions and between Api thrown exceptions.

try{
  // api_client...
} catch (ApiException e){
  // handle exception
}

Shutting down all requests

When you exit your application please make sure to call api_client.shutdown() to exit all pending connections.

API Methods

Return      | Method        | Input 
value       | signature     | params
 int getVersion()
boolean isAuthenticated(java.lang.String username, java.lang.String password)
Map getMyAccount()
ArrayList getAllUsers()
ArrayList getUsersWithIds(int[] user_ids)
ArrayList getUsersThatMatch(java.util.Map<java.lang.String,java.lang.Object> params)
int archiveStudents(int[] student_ids)
int reactivateStudents(int[] student_ids)
ArrayList getAllClasses()
ArrayList getClassesWithIDs(int[] class_ids)
ArrayList getClassesThatMatch(java.util.Map<java.lang.String,java.lang.Object> params)
ArrayList getClassesForOrganization(int organization_id)
ArrayList getArchivedClasses()
int archiveClasses(int[] class_ids)
int reactivateClasses(int[] class_ids)
void deleteClasses(int[] class_ids)
void restoreClasses(int[] class_ids)
ArrayList getClassesTaughtBy(int user_id)
ArrayList getClassesEnrolledBy(int user_id)
ArrayList getTeachersForClass(int class_id)
ArrayList getStudentsForClass(int class_id)
int addStudentsToClass(int class_id, int[] user_ids)
int removeStudentsFromClass(int class_id, int[] user_ids)
int addTeachersToClass(int class_id, int[] user_ids)
int removeTeachersFromClass(int class_id, int[] user_ids)
ArrayList getStatusOfClasses(int user_id)
ArrayList getAllGroups()
ArrayList getGroupsWithIds(int[] group_ids)
ArrayList getGroupsThatMatch(java.util.Map<java.lang.String,java.lang.Object> params)
ArrayList getMembersForGroup(int group_id)
void addMembersToGroup(int group_id, int[] user_ids)
void removeMembersFromGroup(int group_id, int[] user_ids)
ArrayList getAdminsForGroup(int group_id)
void addAdminsToGroup(int group_id, int[] user_ids)
void removeAdminsFromGroup(int group_id, int[] user_ids)
ArrayList getGroupsWithMember(int user_id)
ArrayList getGroupsWithAdmin(int user_id)
Map addGroup(java.util.Map<java.lang.String,java.lang.Object> params)
Map editGroup(int group_id, Map<String, Object> params)
void deleteGroups(int[] group_ids)
ArrayList getResources(Map<String, Object> params)
ArrayList getAllOrganizations()
ArrayList getOrganizationsWithIds(int[] organization_ids)
Map editOrganization(int organization_id, Map<String, Object> params)
void deleteOrganizations(int[] organization_ids)
ArrayList getAllPaths()
ArrayList getPathsWithIds(int[] path_ids)
ArrayList getAdminForPath(int path_id)
ArrayList getStudentsForPath(int path_id)
int addStudentsToPath(int path_id, int[] user_ids)
int removeStudentsFromPath(int path_id, int[] user_ids)
ArrayList getAllCertificates()
ArrayList getCertificatesWithIds(int[] certificate_ids)
ArrayList getAllCurricula()
ArrayList getCurriculaWithIds(int[] curriculum_ids)
ArrayList getProficienciesForCurriculum(int curriculum_id)
ArrayList getLessonsForClass(int class_id)
ArrayList getAssignmentsForClass(int class_id)
ArrayList getGradesForUser(int user_id)
ArrayList getGradesForClass(int class_id)
Map setGradesForAssignment(int assignment_id, java.util.Map[] grades)
ArrayList getAllAttendance(int class_id)
ArrayList getAttendance(int class_id, java.util.Date date_and_time)
int postClassAnnouncement(int class_id, java.lang.String message, java.util.Map<java.lang.String,java.lang.Object> options)
int postClassMessage(int class_id, java.lang.String message, java.util.Map options)
int postGroupAnnouncement(int group_id, java.lang.String message, java.util.Map options)
int postGroupMessage(int group_id, java.lang.String message, java.util.Map options)
int postSiteAnnouncement(java.lang.String message, java.util.Map options)
int postSiteMessage(java.lang.String message, java.util.Map options)
ArrayList getGamesForSite()
ArrayList getGamesForClass(int class_id)
ArrayList getStatusForAllPlayers(int game_id)
ArrayList getStatusForPlayers(int game_id, int[] user_ids)
ArrayList getSessionDetails(int[] user_ids)
ArrayList getClassReport(int class_id, java.util.Map<java.lang.String,java.lang.Object> conditions)
Map addUser
Map getMyAccount()
int getVersion()
void shutdown()
    • Related Articles

    • API 3.0

      Introduction Welcome to the help area for API 3.0, the third generation of our Application Programming Interface. API 3.0 implements RESTFUL best practices whenever possible, and includes an OpenAPI 3.0.2 specification so that it can be easily ...
    • Javascript

      Overview Our open source Javascript client provides a simple way to invoke the API from Javascript. To download the Javascript client, right-click /javascripts/lms_api.js and the save the contents to your local computer. The Javascript client is ...
    • NET

      Overview Our open source C# client provides a simple way to invoke the API from C#. Installation You can download the C# API from /clients/csharp-api-client.zip and include it in your project. Depencencies: https://github.com/mgholam/fastJSON ...
    • PHP

      Overview Our open source PHP client provides a simple way to invoke the API from PHP. To download the PHP client, right-click /clients/lms_api.php and then save the contents to your local computer. Example: code The following example lists all the ...
    • Ruby

      Our open source Ruby client provides a simple way to invoke the API from Ruby. Overview To download the Ruby client, right-click /clients/lms_api.rb and the save the contents to your local computer. Example: code The following example lists all the ...