2026-02-03 10:18:48 +00:00
|
|
|
```java
|
2025-06-19 12:43:27 +00:00
|
|
|
import io.appwrite.Client;
|
|
|
|
|
import io.appwrite.coroutines.CoroutineCallback;
|
|
|
|
|
import io.appwrite.services.Sites;
|
|
|
|
|
import io.appwrite.enums.Framework;
|
|
|
|
|
import io.appwrite.enums.BuildRuntime;
|
2025-11-18 05:37:50 +00:00
|
|
|
import io.appwrite.enums.Adapter;
|
2025-06-19 12:43:27 +00:00
|
|
|
|
|
|
|
|
Client client = new Client()
|
|
|
|
|
.setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint
|
|
|
|
|
.setProject("<YOUR_PROJECT_ID>") // Your project ID
|
|
|
|
|
.setKey("<YOUR_API_KEY>"); // Your secret API key
|
|
|
|
|
|
|
|
|
|
Sites sites = new Sites(client);
|
|
|
|
|
|
|
|
|
|
sites.create(
|
|
|
|
|
"<SITE_ID>", // siteId
|
|
|
|
|
"<NAME>", // name
|
2025-11-18 05:37:50 +00:00
|
|
|
Framework.ANALOG, // framework
|
|
|
|
|
BuildRuntime.NODE_14_5, // buildRuntime
|
2025-06-19 12:43:27 +00:00
|
|
|
false, // enabled (optional)
|
|
|
|
|
false, // logging (optional)
|
|
|
|
|
1, // timeout (optional)
|
|
|
|
|
"<INSTALL_COMMAND>", // installCommand (optional)
|
|
|
|
|
"<BUILD_COMMAND>", // buildCommand (optional)
|
|
|
|
|
"<OUTPUT_DIRECTORY>", // outputDirectory (optional)
|
2025-11-18 05:37:50 +00:00
|
|
|
Adapter.STATIC, // adapter (optional)
|
2025-06-19 12:43:27 +00:00
|
|
|
"<INSTALLATION_ID>", // installationId (optional)
|
|
|
|
|
"<FALLBACK_FILE>", // fallbackFile (optional)
|
|
|
|
|
"<PROVIDER_REPOSITORY_ID>", // providerRepositoryId (optional)
|
|
|
|
|
"<PROVIDER_BRANCH>", // providerBranch (optional)
|
|
|
|
|
false, // providerSilentMode (optional)
|
|
|
|
|
"<PROVIDER_ROOT_DIRECTORY>", // providerRootDirectory (optional)
|
|
|
|
|
"", // specification (optional)
|
|
|
|
|
new CoroutineCallback<>((result, error) -> {
|
|
|
|
|
if (error != null) {
|
|
|
|
|
error.printStackTrace();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
System.out.println(result);
|
|
|
|
|
})
|
|
|
|
|
);
|
|
|
|
|
|
2026-02-03 10:18:48 +00:00
|
|
|
```
|