PHP code example of keboola / sandboxes-service-api-client

1. Go to this page and download the library: Download keboola/sandboxes-service-api-client library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

keboola / sandboxes-service-api-client example snippets


use Keboola\SandboxesServiceApiClient\Sandboxes\SandboxesApiClient;
use Keboola\SandboxesServiceApiClient\ApiClientConfiguration;

$client = new SandboxesApiClient(new ApiClientConfiguration(
    baseUrl: 'https://data-science.keboola.com',
    storageToken: '{storage-api-token}',
    userAgent: 'My App',
));

$result = $client->createSandbox([
    'componentId' => 'keboola.data-apps',
    'configurationId' => '123',
    'configurationVersion' => '4',
    'type' => 'streamlit',
]);

use Keboola\SandboxesServiceApiClient\Apps\AppsApiClient;
use Keboola\SandboxesServiceApiClient\ApiClientConfiguration;

$client = new AppsApiClient(new ApiClientConfiguration(
    baseUrl: 'https://data-apps.keboola.com',
    storageToken: '{storage-api-token}',
    userAgent: 'My App',
));

// List all apps
$apps = $client->listApps();

// Get specific app
$app = $client->getApp('app-id');

// Update app state
$client->patchApp('app-id', [
    'desiredState' => 'running',
    'restartIfRunning' => true,
]);

// Create new app (