Java SDK
Install and use the Misar.IO Java SDK
Installation
Add to pom.xml:
<dependency>
<groupId>io.misar</groupId>
<artifactId>misario-java</artifactId>
<version>1.0.0</version>
</dependency>
Quick Start
import io.misar.io.MisarIOClient;
import io.misar.io.models.*;
public class Main {
public static void main(String[] args) throws Exception {
MisarIOClient client = MisarIOClient.builder()
.apiKey(System.getenv("MISARIO_API_KEY"))
.build();
AccountProfile profile = client.account().get().get();
System.out.println("Hello, " + profile.getDisplayName() + "!");
client.close();
}
}
Available Methods
| Method | Description |
|--------|-------------|
| client.account().get() | Get the current account profile — returns CompletableFuture<AccountProfile> |
| client.account().update(request) | Update account details |
| client.sessions().list() | List active sessions |
| client.sessions().revoke(id) | Revoke a session |
| client.keys().list() | List API keys |
| client.keys().create(request) | Create an API key |
| client.keys().revoke(id) | Revoke an API key |
| client.sso().token(request) | Generate a cross-TLD SSO token |
| client.close() | Close the HTTP client |
Error Handling
import io.misar.io.exceptions.*;
try {
AccountProfile profile = client.account().get().get();
System.out.println("Hello, " + profile.getDisplayName() + "!");
} catch (ExecutionException e) {
if (e.getCause() instanceof MisarIOApiException api) {
System.out.println("API error " + api.getStatusCode() + ": " + api.getMessage());
}
}