Skip to main content

Java server integration

Install​

Java 11+. Add the dependency below to your Maven project and save the example as src/main/java/ClassroomExample.java. Gson is a transitive dependency.

<dependency>
<groupId>com.eduskit</groupId>
<artifactId>server-sdk</artifactId>
<version>0.1.5</version>
</dependency>

Gradle:

implementation 'com.eduskit:server-sdk:0.1.5'

Inputs are Map<String, Object> and results are Gson JsonElement. The four-argument ClientConfig includes appId; the older constructor without it cannot sign local tokens.

Create a classroom and issue a student credential​

Set the backend environment variables. This example uses separate teacher and student accounts. Replace the example avatar URLs with accessible resources. Each run creates a new classroom; originId only makes user registration idempotent.

import com.eduskit.sdk.ClientConfig;
import com.eduskit.sdk.Eduskit;
import com.eduskit.sdk.EduskitError;
import java.time.Instant;
import java.time.temporal.ChronoUnit;
import java.util.List;
import java.util.Map;

public class ClassroomExample {
private static String required(String name) {
String value = System.getenv(name);
if (value == null || value.isBlank()) throw new IllegalArgumentException("Missing " + name);
return value.trim();
}

public static Map<String, String> createDemoClassroom() {
Eduskit sdk = new Eduskit(new ClientConfig(
required("EDU_SERVER_URL"), required("EDU_APP_ID"),
required("EDU_APP_KEY"), required("EDU_APP_SECRET")
), null);
var teacher = sdk.client().users.register(Map.of(
"originId", "demo-teacher-001", "nickname", "Teacher",
"avatar", "https://example.com/teacher.png"
)).getAsJsonObject();
var student = sdk.client().users.register(Map.of(
"originId", "demo-student-001", "nickname", "Student",
"avatar", "https://example.com/student.png"
)).getAsJsonObject();
String studentId = student.get("eduUserId").getAsString();
var classroom = sdk.client().classrooms.create(Map.<String, Object>of(
"name", "SDK integration",
"startsAt", Instant.now().plus(15, ChronoUnit.MINUTES).toString(),
"durationMinutes", 60,
"teacherEduUserId", teacher.get("eduUserId").getAsString(),
"studentEduUserIds", List.of(studentId),
"joinPolicy", "invite_only"
)).getAsJsonObject();
var token = sdk.client().auth.issueToken(Map.of(
"eduUserId", studentId, "originId", "demo-student-001", "expiresIn", 3600
)).getAsJsonObject();
return Map.of(
"appId", token.get("appId").getAsString(),
"classroomId", classroom.get("classroomId").getAsString(),
"userId", studentId,
"userToken", token.get("accessToken").getAsString(),
"expiresAt", token.get("expiresAt").getAsString()
);
}

public static void main(String[] args) {
try {
var entry = createDemoClassroom();
System.out.println(entry.get("classroomId") + " " + entry.get("userId"));
} catch (EduskitError error) {
System.err.println(error.getErrorCode() + " " + error.getStatus() + " " + error.getTraceId());
System.exit(1);
}
}
}

Return userToken through your entry endpoint to the authenticated student. In production, create classrooms during scheduling and issue tokens when users enter.

Calling conventions​

sdk.client() / sdk.whiteboardClient(). Pass null for an unused side. Use the full ClientConfig constructor with Duration, lang and HttpClient for custom transport settings.

See Classroom API for members, permissions, courseware and start/end methods. See Whiteboard server integration for recordings and conversion, and Errors and troubleshooting for failure and retry behavior.

Application and tenant APIs​

Source builds provide 50 application-authenticated HTTP routes through client, including users, classrooms, courseware libraries, live assets, and diagnostics. See application business APIs and workflow examples. The separate tenant management client uses tenant sessions for account, application, dashboard, and billing operations. The new methods require the matching server-api deployment and a source build; public 0.1.5 packages do not include them.