Console management client
Business backends use application business APIs with client and application credentials. This client is for tenant management and requires a tenant login session. Its HTTP address is the console-api address.
ConsoleClient provides 88 console management operations through console-api using a tenant access token. This chapter applies to source builds containing ConsoleClient; the public 0.1.5 packages do not contain this client.
Clients and authentication
| Client | Service | Credentials | Capabilities |
|---|---|---|---|
client | edu server-api | appKey, appSecret; local signing also uses appId | Classrooms, members, permissions, entry codes, courseware bindings, live video and sources |
whiteboardClient | whiteboard server-api | Whiteboard application credentials | Private whiteboards, recordings, captures, conversion |
consoleClient | edu console-api | Tenant accessToken | Applications, accounts, and all console management operations |
baseUrl is the console-api deployment URL without /v1. The local service defaults to http://localhost:3101. Addresses are configured explicitly. Obtain accessToken through account sign-in. It is distinct from classroom user tokens and whiteboard room tokens.
Application-scoped calls send the first appId argument as x-app-id. Application management methods apps.get, apps.updateConfig, and apps.updateWebhook send appId in query parameters or JSON as specified by those endpoints. The server checks ownership. Public authentication methods omit tenant credentials, and console calls omit application secrets.
Five languages
The examples read the console URL, tenant access token, and target application ID from environment variables. Configuration names follow each language’s conventions; HTTP field names remain camelCase.
Node.js / TypeScript
import { Eduskit } from '@eduskit/server-sdk';
const sdk = new Eduskit({
consoleClient: {
baseUrl: process.env.EDU_CONSOLE_URL!,
accessToken: process.env.EDU_TENANT_ACCESS_TOKEN!,
},
});
const c = sdk.consoleClient;
const apps = await c.apps.list();
const users = await c.users.list(process.env.EDU_APP_ID!, { page: 1, pageSize: 20 });
Python
import os
from eduskit import Eduskit
sdk = Eduskit(console_client={
"base_url": os.environ["EDU_CONSOLE_URL"],
"access_token": os.environ["EDU_TENANT_ACCESS_TOKEN"],
})
c = sdk.console_client
apps = c.apps.list()
users = c.users.list(os.environ["EDU_APP_ID"], page=1, pageSize=20)
Java
import com.eduskit.sdk.ConsoleClient;
import com.eduskit.sdk.ConsoleConfig;
import java.util.Map;
ConsoleClient c = new ConsoleClient(new ConsoleConfig(
System.getenv("EDU_CONSOLE_URL"),
System.getenv("EDU_TENANT_ACCESS_TOKEN")));
var apps = c.apps.list();
var users = c.users.list(System.getenv("EDU_APP_ID"), Map.of("page", 1, "pageSize", 20));
Go
package main
import (
"context"
"log"
"os"
eduskit "github.com/eduskit/server-sdk-go"
)
func main() {
c := eduskit.NewConsoleClient(eduskit.ConsoleConfig{
BaseURL: os.Getenv("EDU_CONSOLE_URL"),
AccessToken: os.Getenv("EDU_TENANT_ACCESS_TOKEN"),
})
var apps []map[string]any
if err := c.Apps.List(context.Background(), &apps); err != nil { log.Fatal(err) }
var users map[string]any
if err := c.Users.List(context.Background(), os.Getenv("EDU_APP_ID"),
map[string]any{"page": 1, "pageSize": 20}, &users); err != nil { log.Fatal(err) }
}
PHP
<?php
require __DIR__ . '/vendor/autoload.php';
$c = new \Eduskit\ConsoleClient([
'baseUrl' => getenv('EDU_CONSOLE_URL'),
'accessToken' => getenv('EDU_TENANT_ACCESS_TOKEN'),
]);
$apps = $c->apps->list();
$users = $c->users->list(getenv('EDU_APP_ID'), ['page' => 1, 'pageSize' => 20]);
Sessions, responses, and errors
auth.refresh({ refreshToken }) returns a new session. Persist its refresh token and call setAccessToken(session.accessToken) to update the client. Python uses set_access_token and Go uses SetAccessToken. The SDK does not automatically refresh, persist sessions, or retry. Clear the local token after logout by setting it to an empty string.
Successful calls return envelope data. Go decodes it into the last out argument; use nil to ignore it. Pagination fields retain server values. Billing points remain strings to preserve precision.
| Error code | Meaning |
|---|---|
SDK_CLIENT_NOT_CONFIGURED | Console client was not configured |
SDK_CONSOLE_TOKEN_REQUIRED | Protected call requires a tenant token |
SDK_CONSOLE_APP_ID_REQUIRED | Application-scoped call requires appId |
SDK_QUERY_INVALID | Query value is not a string, number, or boolean |
SDK_UPLOAD_FAILED | Object storage returned a non-2xx status |
Errors retain source=console, service error codes, HTTP status, and trace IDs. lastTraceId is the most recent response on a shared client. The application determines whether to retry based on the error and operation outcome.
Capabilities
| Console feature | SDK reference |
|---|---|
| Sign-in, phone and WeChat binding, profile, logout | Accounts and sessions |
| Application creation, credentials, configuration, webhook rotation | Applications |
| User list, search, creation, status, token tools | Users |
| Scheduling, details, lifecycle, rosters, courseware, live sources, diagnostics and export | Classrooms |
| Entry code issuance, claims, rotation and revocation | Entry codes |
| Activity list, tracks, overview and evidence | Activity logs |
| Upload, conversion, preview, retry and deletion | Courseware |
| Video upload, asset list and deletion | Live video |
| Overview, trends, classrooms, quality, usage and issues | Dashboard |
| Wallet, entitlements, plans, packages, ledger, usage, reservations, estimates and auto recharge | Billing |
See shared models for fields and management workflows for complete examples.