Java

Use the Cells HTTP API from Java. No published Maven artifact exists yet.

Note
No Maven or Gradle package has been published. Use the REST API directly or generate a typed client from the OpenAPI spec.

HTTP example

Java (HttpClient)
import java.net.*;
import java.net.http.*;
import java.nio.charset.StandardCharsets;

public class Main {
    public static void main(String[] args) throws Exception {
        String projectId = System.getenv("CELLS_PROJECT_ID");
        String apiKey    = System.getenv("CELLS_API_KEY");

        String body = """
            {"language":"java","languageVersion":"21","timeoutSeconds":300}
            """;

        HttpRequest req = HttpRequest.newBuilder()
            .uri(URI.create("https://api.mudbase.dev/api/sandboxes/projects/" + projectId))
            .header("x-api-key", apiKey)
            .header("Content-Type", "application/json")
            .POST(HttpRequest.BodyPublishers.ofString(body))
            .build();

        HttpResponse<String> resp = HttpClient.newHttpClient()
            .send(req, HttpResponse.BodyHandlers.ofString());
        System.out.println(resp.body());
    }
}
import java.net.*;
import java.net.http.*;
import java.nio.charset.StandardCharsets;

public class Main {
    public static void main(String[] args) throws Exception {
        String projectId = System.getenv("CELLS_PROJECT_ID");
        String apiKey    = System.getenv("CELLS_API_KEY");

        String body = """
            {"language":"java","languageVersion":"21","timeoutSeconds":300}
            """;

        HttpRequest req = HttpRequest.newBuilder()
            .uri(URI.create("https://api.mudbase.dev/api/sandboxes/projects/" + projectId))
            .header("x-api-key", apiKey)
            .header("Content-Type", "application/json")
            .POST(HttpRequest.BodyPublishers.ofString(body))
            .build();

        HttpResponse<String> resp = HttpClient.newHttpClient()
            .send(req, HttpResponse.BodyHandlers.ofString());
        System.out.println(resp.body());
    }
}

Generate a typed client

openapi-generator
openapi-generator-cli generate \
  -i https://docs.cells.mudbase.dev/openapi.yaml \
  -g java \
  -o ./cells-client
openapi-generator-cli generate \
  -i https://docs.cells.mudbase.dev/openapi.yaml \
  -g java \
  -o ./cells-client