- Updated: March 21, 2026
- 2 min read
Getting Started with the OpenClaw Rating API Java/Kotlin SDK
Getting Started with the OpenClaw Rating API Java/Kotlin SDK
Welcome to the UBOS developer guide for integrating the OpenClaw Rating API into your Java or Kotlin applications. This article walks you through installing the SDK, authenticating, submitting ratings, handling responses, and adopting best‑practice patterns for both Android and enterprise Java projects.
1. Install the SDK
Add the OpenClaw SDK to your project using Maven or Gradle.
// Maven
<dependency>
<groupId>tech.ubos.openclaw</groupId>
<artifactId>rating-sdk</artifactId>
<version>1.0.0</version>
</dependency>
// Gradle (Kotlin DSL)
implementation("tech.ubos.openclaw:rating-sdk:1.0.0")
2. Authentication
The SDK uses an API key that you obtain from your UBOS dashboard. Initialise the client with the key:
val client = RatingClient(apiKey = "YOUR_API_KEY")
3. Submit a Rating
Creating a rating request is straightforward:
val request = RatingRequest(
productId = "product-123",
userId = "user-456",
score = 4.5,
comment = "Great experience!"
)
val response = client.submitRating(request)
4. Handle the Response
The SDK returns a RatingResponse object. Check the status and act accordingly:
if (response.success) {
println("Rating submitted successfully. ID: ${response.ratingId}")
} else {
println("Failed to submit rating: ${response.errorMessage}")
}
5. Best‑Practice Patterns
- Android: Perform rating submissions on a background thread (e.g., using Kotlin coroutines or RxJava) to keep the UI responsive.
- Enterprise Java: Wrap the SDK calls in a service layer, add retry logic, and log outcomes for audit trails.
- Validation: Validate user input locally before sending it to the API to reduce unnecessary network traffic.
- Error handling: Implement exponential back‑off for transient network errors.
6. Self‑Hosting Option
If you prefer to host OpenClaw yourself, check out our guide on self‑hosting OpenClaw for detailed steps.
Happy coding!