BabelBirdBabelBird Docs

Development API Overview

BabelBird develops APIs to connect the authentication, file, sharing, organization, messaging and login capabilities of enterprise network disks to third-party business systems. The left column is grouped by interface function, and the callable endpoints are listed directly in the group.

Call overview

  • The enterprise administrator creates a developer account in the private cloud enterprise management background and obtains client_id, client_secret and JWT related keys.
  • In the OAuth callback method, use /api/authorize.do to obtain the authorization code, and then use /api/token.do to obtain access_token.
  • JWT login-free method uses /api/authorizeByJWT.do or /account/tokenLogin.do, and private deployment needs to enable the corresponding configuration.
  • File access API requests need to carry Authorization: Bearer <access_token> in the HTTP Header.
  • POST, PUT, DELETE requests usually use Content-Type: application/json.

Java JWT Integration Example

The following example is adapted from the BabelBird API integration sample. It demonstrates how to generate a JWT string. In a real project, replace the secret, enterprise domain, user email, phone number, employee ID and client_id with values provided by the enterprise admin console or implementation team. Do not expose the JWT secret in frontend pages, client packages or public repositories.

The JWT payload contains three core fields:

Field Description
time Token generation timestamp in milliseconds
duration Token validity duration in seconds
payload Business payload. For user login-free access, use email, phone or babelId; for /api/authorizeByJWT.do, use client_id

Common usage:

  • User login-free access: generate userToken, then open /account/tokenLogin.do?userToken=<JWT_TOKEN>.
  • OAuth/JWT authorization: generate jwt_token, then open /api/authorizeByJWT.do?response_type=code&client_id=<CLIENT_ID>&jwt_token=<JWT_TOKEN>&email=<USER_EMAIL>, and exchange the returned code for access_token.
  • File API calls: after obtaining access_token, include Authorization: Bearer <access_token> in subsequent file, sharing and enterprise API requests.

Minimal implementation outline: first build payload, for example {email: "user@example.com"} for user login-free access or {client_id: "<CLIENT_ID>"} for developer authorization; then build JWT claims as {time: current Unix timestamp in milliseconds, duration: 60, payload: payload}; sign the claims with the enterprise JWT secret using HS256 / HmacSHA256; finally pass the signed JWT string as userToken or jwt_token in the corresponding URL.

import java.nio.charset.StandardCharsets;
import java.util.HashMap;
import java.util.Map;
import javax.crypto.SecretKey;
import io.jsonwebtoken.Jwts;
import io.jsonwebtoken.security.Keys;

public final class BabelJwtExample {
    public static String createToken(Map<String, Object> payload) {
        String secret = System.getenv("BABEL_JWT_SECRET");
        if (secret == null || secret.isEmpty()) {
            throw new IllegalStateException("BABEL_JWT_SECRET is required");
        }
        SecretKey key = Keys.hmacShaKeyFor(secret.getBytes(StandardCharsets.UTF_8));
        Map<String, Object> claims = new HashMap<>();
        claims.put("time", System.currentTimeMillis());
        claims.put("duration", 60);
        claims.put("payload", payload);
        return Jwts.builder().claims(claims).signWith(key, Jwts.SIG.HS256).compact();
    }
}

This sample uses JJWT 0.12.x. Use matching versions of jjwt-api, jjwt-impl, and jjwt-jackson; see the official JJWT documentation. The BabelBird example uses the secret's UTF-8 bytes. Confirm any different encoding with the implementation team instead of truncating, padding, or transforming the key. HS256 requires a key of at least 256 bits; request a suitable key if the library rejects it.

This function signs a token; it is not a login service or complete JWT validator. BabelBird's time and duration are custom fields, not the standard exp claim. Resolve the user identity from an authenticated server-side session, never log generated tokens, and validate authorization and expiry behavior against the target deployment.

API Grouping

Grouping Main purpose Typical entrance
Authentication API Developer account, OAuth callback, JWT login-free, Token acquisition and refresh Get token
File API File list, file information, upload and download, version, move copy, recycle bin, material library classification Get file list
Sharing API Sharing link, sharing permissions, participants, attention reminders Get file sharing url
Enterprise API Enterprise information, departments, members, enterprise logs Get current enterprise information
Message and login API Announcements, department discussions, JWT token login, common status codes JWT token login

Single interface page

Each API entry has an independent page, allowing developers to check paths, methods, parameters and return information by interface.

JWT Identity and Confidentiality

Explicitly pass the intended user's email, phone or babelId to /api/authorizeByJWT.do. The source permits an administrator identity when omitted. Do not omit identity or trust an unverified caller-supplied identity. Signing does not encrypt a JWT payload; avoid sensitive cleartext and do not log production tokens.

BabelBird capabilities may change by product version, licensed modules and deployment configuration; actual availability depends on the deployed environment and administrator settings.