PHP code example of shellrent / veeam-vspc-api-client

1. Go to this page and download the library: Download shellrent/veeam-vspc-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/ */

    

shellrent / veeam-vspc-api-client example snippets


use Shellrent\VeeamVspcApiClient\VeeamSPCClient;

$client = new VeeamSPCClient(
    endpoint: 'https://vspc.example.com',
    token: null,
    options: [
        // Any Guzzle option (timeouts, proxies, etc.)
    ]
);

use Shellrent\VeeamVspcApiClient\Payloads\OAuthPayload;
use Shellrent\VeeamVspcApiClient\Repositories\AuthenticationRepository;

$authRepository = new AuthenticationRepository();
$request = $authRepository->postOAuthAuthentication(new OAuthPayload('username', 'password'));

$tokenResponse = $client->jsonResponse($request);
$token = $tokenResponse->access_token ?? null;

use Shellrent\VeeamVspcApiClient\Repositories\CompanyRepository;

$companyRepository = new CompanyRepository();
$request = $companyRepository->getCompanies();

$response = $client->jsonResponse($request);