Controller API

Initialization

Initializing the SimpleCloud Controller API

Dependencies

Before you can use the Controller API, you need to add our dependencies to your project.

Please refer to following guides, depending on your platform:

Initialization

After adding the dependencies, you can initialize the Controller API.

Initialize with Default Configuration

If you are using the Controller API in any platform, we automatically set the secret token with CONTROLLER_SECRET environment variable.

val controllerApi = ControllerApi.createCoroutineApi()

Connect with Secret Token

val controllerApi = ControllerApi.createCoroutineApi("your-secret-key")

Best Practices

  • Multiple Instances: Don't create multiple instances of the Controller API. While it's possible to create multiple instances, we don't recommend it. Just create a single instance and use it everywhere (preferd with dependency injection).
  • Asynchronous Operations: Use Coroutines for asynchronous operations in Kotlin, or CompletableFuture for Java. We don't recommend using our API in sync operations.
  • Error Handling: We don't throw any exceptions, we return null or Future objects. You should handle errors by yourself.

On this page