Skip to main content

Java OpenSDK Overview

What is this?

Lovrabet Java OpenSDK is a lightweight Java client library for accessing Lovrabet CloudRabbit platform's OpenAPI services from Java applications.

With this SDK, you can easily:

  • 📊 Read Data - Retrieve business data from the Lovrabet CloudRabbit platform
  • ✏️ Write Data - Create and update your business records
  • 🔐 Secure Access - Automatically handle signature authentication to ensure data security
  • 🚀 Quick Integration - Complete integration with just a few lines of code

What problems does it solve?

Scenario 1: Integrate Lovrabet data into existing Java systems

Problem: You manage business data like customers, orders, and sales funnels on the Lovrabet CloudRabbit platform, and need to use this data in your Java backend system.

Using OpenSDK:

// In your Spring Boot application
@Service
public class CustomerService {
private final LovrabetSDKClient sdkClient;

public List<Customer> getSalesLeads() {
LovrabetRequest request = new LovrabetRequest();
request.setAppCode("app-xxx");
request.setModelCode("customer-dataset");

// Get sales leads data
LovrabetResult<?> result = sdkClient.getList(request);

if (result.isSuccess()) {
return parseCustomers(result.getData());
}
return Collections.emptyList();
}
}

Value:

  • ✅ No need to manually manage HTTP requests and signature logic
  • ✅ Type-safe API calls
  • ✅ Unified error handling
  • ✅ Ready-to-use authentication mechanism

Scenario 2: Sync data from Java application to Lovrabet

Problem: Your Java system generates new business data (such as orders, work tickets) that needs to be synced to the Lovrabet CloudRabbit platform for visual analytics and report generation.

Using OpenSDK:

// In your order service
@Service
public class OrderSyncService {
private final LovrabetSDKClient sdkClient;

public void syncOrder(Order order) {
LovrabetRequest request = new LovrabetRequest();
request.setAppCode("app-xxx");
request.setModelCode("orders-dataset");

// Build order data
Map<String, Object> orderData = new HashMap<>();
orderData.put("order_no", order.getOrderNo());
orderData.put("amount", order.getAmount());
orderData.put("customer_name", order.getCustomerName());
orderData.put("create_date", order.getCreateDate());
request.setParamMap(orderData);

// Create order record
LovrabetResult<String> result = sdkClient.create(request);

if (result.isSuccess()) {
logger.info("Order synced successfully: {}", result.getData());
} else {
logger.error("Order sync failed: {}", result.getResultMsg());
}
}
}

Value:

  • ✅ Real-time data synchronization
  • ✅ Reduce manual data import work
  • ✅ Unified data source for cross-system analytics

Scenario 3: Build data hub in microservices architecture

Problem: In a microservices architecture, multiple services need to access Lovrabet's unified data, but you don't want each service to integrate with OpenAPI directly.

Using OpenSDK:

// Build unified data service
@RestController
@RequestMapping("/api/data")
public class DataGatewayController {
private final LovrabetSDKClient sdkClient;

// Provide unified data access interface for internal microservices
@GetMapping("/customers")
public ResponseEntity<List<Map<String, Object>>> getCustomers(
@RequestParam(defaultValue = "1") int page,
@RequestParam(defaultValue = "20") int size
) {
LovrabetRequest request = new LovrabetRequest();
request.setAppCode("app-xxx");
request.setModelCode("customers");

Map<String, Object> params = new HashMap<>();
params.put("currentPage", page);
params.put("pageSize", size);
request.setParamMap(params);

LovrabetResult<?> result = sdkClient.getList(request);

if (result.isSuccess()) {
return ResponseEntity.ok((List<Map<String, Object>>) result.getData());
}
return ResponseEntity.status(500).build();
}
}

Value:

  • ✅ Unified data access layer
  • ✅ Centralized credential management
  • ✅ Reduced system coupling
  • ✅ Support for access control and auditing

Applicable Scenarios

ScenarioApplicableDescription
✅ Spring Boot BackendRecommendedPerfect integration with Spring ecosystem
✅ Scheduled Tasks/Data SyncRecommendedBuild reliable data sync services with OpenSDK
✅ Microservices Data HubRecommendedBuild unified data access layer
✅ Traditional Java Web AppsApplicableServlet, Struts, JSP all supported
⚠️ Direct Frontend CallsNot RecommendedUse Node.js SDK or browser SDK instead
⚠️ Android AppsNot RecommendedUse dedicated mobile SDK instead

Core Advantages

1. Simple and Easy to Use

// Complete data query in just 3 steps
LovrabetSDKClient client = new LovrabetSDKClient(accessKey, baseUrl);
LovrabetRequest request = new LovrabetRequest();
request.setAppCode("app-xxx");
LovrabetResult<?> result = client.getDatasetCodeList(request);

2. Secure and Reliable

  • Auto Signature - SDK automatically handles HMAC-SHA256 signatures, no manual calculation needed
  • Key Protection - AccessKey is only used server-side, never exposed to frontend
  • HTTPS Transport - All requests transmitted via HTTPS encryption

3. Complete Error Handling

LovrabetResult<?> result = client.getOne(request);

if (result.isSuccess()) {
// Success: process business data
Object data = result.getData();
} else {
// Failure: get error code and message
String errorCode = result.getResultCode();
String errorMsg = result.getResultMsg();
logger.error("Query failed [{}]: {}", errorCode, errorMsg);
}

4. Production-Grade Quality

  • ✅ Thread-safe, supports high concurrency
  • ✅ Unified response format
  • ✅ Detailed error messages
  • ✅ Support for retry and timeout control

Quick Start

1. Add Dependency

<dependency>
<groupId>com.lovrabet.runtime</groupId>
<artifactId>lovrabet-runtime-opensdk</artifactId>
<version>1.0.0-SNAPSHOT</version>
</dependency>

2. Get Access Credentials

  1. Log in to Lovrabet CloudRabbit Platform
  2. Go to Application Management and get the Application Code (AppCode)
  3. Enable OpenAPI feature and generate Access Key (AccessKey)

3. Write Your First Program

import com.lovrabet.runtime.opensdk.client.LovrabetSDKClient;
import com.lovrabet.runtime.opensdk.model.LovrabetRequest;
import com.lovrabet.runtime.opensdk.model.LovrabetResult;

public class HelloLovrabet {
public static void main(String[] args) {
// 1. Create client
String accessKey = "ak-your-access-key";
String baseUrl = "https://runtime.lovrabet.com/openapi";
LovrabetSDKClient client = new LovrabetSDKClient(accessKey, baseUrl);

// 2. Build request
LovrabetRequest request = new LovrabetRequest();
request.setAppCode("app-xxx");

// 3. Call API
LovrabetResult<?> result = client.getDatasetCodeList(request);

// 4. Handle result
if (result.isSuccess()) {
System.out.println("Dataset list: " + result.getData());
} else {
System.err.println("Failed: " + result.getResultMsg());
}
}
}

4. Learning Path

Follow this sequence to master SDK usage step by step:

  1. 📖 Quick Start - Complete your first CRUD program in 5 minutes
  2. 📚 Core Concepts - Deep dive into SDK working principles
  3. 📋 API Reference - Browse complete interface documentation
  4. 💡 Examples - Learn 5 real-world scenario implementations
  5. 🚀 Best Practices - Master production environment optimization techniques
  6. FAQ - Resolve usage questions

Technical Support

If you encounter issues, get help through:


Document Version: 1.0.0 Last Updated: 2025-10-12 Applies to: lovrabet-runtime-opensdk 1.0.0+