REST API used for SCORM Cloud integrations.
This PHP package is automatically generated by the Swagger Codegen project:
- API version: 2.0
- Package version: 1.0.0
- Build package: io.swagger.codegen.languages.PhpClientCodegen
PHP 5.4.0 and later
To install the bindings via Composer, add the following to composer.json
:
{
"repositories": [
{
"type": "git",
"url": "https://github.com/RusticiSoftware/scormcloud-api-v2-client-php.git"
}
],
"require": {
"RusticiSoftware/scormcloud-api-v2-client-php": "*@dev"
}
}
Then run composer install
Download the files and include autoload.php
:
require_once('/path/to/scormcloud-api-v2-client-php/autoload.php');
Please follow the installation procedure and then run the following:
<?php
require_once(__DIR__ . '/vendor/autoload.php');
// Configure HTTP basic authorization: APP_NORMAL
RusticiSoftware\Cloud\V2\Configuration::getDefaultConfiguration()->setUsername('SCORM_CLOUD_APP_ID');
RusticiSoftware\Cloud\V2\Configuration::getDefaultConfiguration()->setPassword('SECRET_KEY_FOR_APP_ID');
// Then (optionally) further authenticate via Oauth2 token access
$app_management_api = new RusticiSoftware\Cloud\V2\Api\ApplicationManagementApi();
$permissions = new \RusticiSoftware\Cloud\V2\Model\PermissionsSchema([ 'scopes' => ['read:registration']]);
$expiry = new DateTime("now");
$expiry->modify('+60 minutes');
$token_request = new \RusticiSoftware\Cloud\V2\Model\TokenRequestSchema([ 'permissions' => $permissions, 'expiry' => $expiry]);
try {
$response = $app_management_api->createToken($token_request);
RusticiSoftware\Cloud\V2\Configuration::getDefaultConfiguration()->setAccessToken($response->getResult());
// this call will now use Oauth2 with the "read:registration" scope
$registration_api = new \RusticiSoftware\Cloud\V2\Api\RegistrationApi();
$registrations_list = $registration_api->getRegistrations();
print_r($registrations_list);
} catch (\RusticiSoftware\Cloud\V2\ApiException $e) {
print_r($e->getResponseBody());
}
?>