PHP code example of gamingsolved / paperspace-api-client

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

    

gamingsolved / paperspace-api-client example snippets




amingsolved\Paperspace\Api\Client\Version0_1_3 as PaperspaceApiClient;

$config = PaperspaceApiClient\Configuration::getDefaultConfiguration();
$config->setApiKey('X-API-Key', 'your-api-key-here');

$createMachineParams = new PaperspaceApiClient\Model\CreateMachineParams();
$createMachineParams->setRegion('East Coast (NY2)');
$createMachineParams->setMachineType('Air');
$createMachineParams->setSize(50);
$createMachineParams->setBillingType('hourly');
$createMachineParams->setMachineName('My first machine');
$createMachineParams->setTemplateId('t23ol2r'); // Windows 10 (Server 2016) Quadro - Licensed

$machinesApiClient = new PaperspaceApiClient\Api\MachinesApi(null, $config);

try {
  $result = $machinesApi->createMachine($createMachineParams);
  print_r($result);
} catch (\Exception $e) {
  echo 'Exception when calling MachinesApi->createMachine: ', $e->getMessage(), PHP_EOL;
}