Java SDK
Official Misar.Dev SDK for Java — build, deploy, and manage apps via api.misar.io/dev.
The official Misar.Dev client SDK for Java.
Installation
Maven (pom.xml):
<dependency>
<groupId>io.misar.dev</groupId>
<artifactId>misar-dev-sdk</artifactId>
<version>1.0.0</version>
</dependency>
Gradle (build.gradle):
implementation 'io.misar.dev:misar-dev-sdk:1.0.0'
Requires Java 17+. Uses the built-in java.net.http.HttpClient and org.json for JSON.
Quick start
The client is built via a Builder. The API key must start with mdk_:
import io.misar.dev.MisarDevClient;
import org.json.JSONObject;
MisarDevClient client = new MisarDevClient.Builder("mdk_your_api_key")
.build();
JSONObject projects = client.projectsList();
System.out.println(projects);
The builder also accepts a custom base URL and retry count:
MisarDevClient client = new MisarDevClient.Builder("mdk_your_api_key")
.baseUrl("https://api.misar.io/dev")
.maxRetries(3)
.build();
Configuration
Base URL https://api.misar.io/dev; auth Authorization: Bearer <key> (set on every request). Retries (default 3) apply to 429, 500, 502, 503, 504 with exponential backoff (base 500 ms); 401 is never retried. Connect and request timeouts are 30 s. Every method returns an org.json.JSONObject.
Resources
This Java port (v1.0.0) implements a subset of the full Misar.Dev API:
JSONObject projectsList()
JSONObject projectsCreate(Map<String, Object> params)
JSONObject apiKeysList()
JSONObject usageGet()
JSONObject chatComplete(Map<String, Object> params)
JSONObject templatesList()
projects—projectsList,projectsCreateapiKeys—apiKeysListusage—usageGetchat—chatCompletetemplates—templatesList
Error handling
All failures throw MisarDevException (a RuntimeException) exposing getStatusCode() and getBody(). The factory MisarDevException.fromStatus(...) produces these subclasses by status:
AuthException—401RateLimitException—429ServerException—5xx
import io.misar.dev.MisarDevException;
try {
client.projectsList();
} catch (MisarDevException.AuthException e) {
System.err.println("Auth failed: " + e.getStatusCode());
} catch (MisarDevException e) {
System.err.println("Request failed (" + e.getStatusCode() + "): " + e.getBody());
}