本文为您提供了服务端 PHP SDK 的空间管理模块的接口调用示例。
接口请求参数和返回参数详见 OpenAPI:创建空间。
<?php
require('../../vendor/autoload.php');
use Volc\Service\Vod\Models\Request\VodCreateSpaceRequest;
use Volc\Service\Vod\Models\Response\VodCreateSpaceResponse;
use Volc\Service\Vod\Vod;
// Create a VOD instance in the specified region.
// $client = Vod::getInstance('cn-north-1');
$client = Vod::getInstance();
// Configure your Access Key ID (AK) and Secret Access Key (SK) in the environment variables or in the local ~/.volc/config file. For detailed instructions, see https://www.volcengine.com/docs/4/4408.
// The SDK will automatically fetch the AK and SK from the environment variables or the ~/.volc/config file as needed.
// During testing, you may use the following code snippet. However, do not store the AK and SK directly in your project code to prevent potential leakage and safeguard the security of all resources associated with your account.
// $client->setAccessKey('your ak');
// $client->setSecretKey('your sk');
$req = new VodCreateSpaceRequest();
$req->setSpaceName("your space name");
$req->setDescription("your desc");
$req->setProjectName("your project");
$response = new VodCreateSpaceResponse();
try {
$response = $client->createSpace($req);
} catch (Exception $e) {
echo $e, "\n";
} catch (Throwable $e) {
echo $e, "\n";
}
if ($response->getResponseMetadata()->getError() != null) {
print_r($response->getResponseMetadata()->getError());
}
接口请求参数和返回参数详见 OpenAPI:获取空间列表。
<?php
require('../../vendor/autoload.php');
use Volc\Service\Vod\Models\Request\VodListSpaceRequest;
use Volc\Service\Vod\Models\Response\VodListSpaceResponse;
use Volc\Service\Vod\Vod;
// Create a VOD instance in the specified region.
// $client = Vod::getInstance('cn-north-1');
$client = Vod::getInstance();
// Configure your Access Key ID (AK) and Secret Access Key (SK) in the environment variables or in the local ~/.volc/config file. For detailed instructions, see https://www.volcengine.com/docs/4/4408.
// The SDK will automatically fetch the AK and SK from the environment variables or the ~/.volc/config file as needed.
// During testing, you may use the following code snippet. However, do not store the AK and SK directly in your project code to prevent potential leakage and safeguard the security of all resources associated with your account.
// $client->setAccessKey('your ak');
// $client->setSecretKey('your sk');
$req = new VodListSpaceRequest();
$response = new VodListSpaceResponse();
try {
$response = $client->listSpace($req);
} catch (Exception $e) {
echo $e, "\n";
} catch (Throwable $e) {
echo $e, "\n";
}
if ($response->getResponseMetadata()->getError() != null) {
print_r($response->getResponseMetadata()->getError());
}
接口请求参数和返回参数详见 OpenAPI:获取空间详细信息。
<?php
require('../../vendor/autoload.php');
use Volc\Service\Vod\Models\Request\VodGetSpaceDetailRequest;
use Volc\Service\Vod\Models\Response\VodGetSpaceDetailResponse;
use Volc\Service\Vod\Vod;
// Create a VOD instance in the specified region.
// $client = Vod::getInstance('cn-north-1');
$client = Vod::getInstance();
// Configure your Access Key ID (AK) and Secret Access Key (SK) in the environment variables or in the local ~/.volc/config file. For detailed instructions, see https://www.volcengine.com/docs/4/4408.
// The SDK will automatically fetch the AK and SK from the environment variables or the ~/.volc/config file as needed.
// During testing, you may use the following code snippet. However, do not store the AK and SK directly in your project code to prevent potential leakage and safeguard the security of all resources associated with your account.
// $client->setAccessKey('your ak');
// $client->setSecretKey('your sk');
$req = new VodGetSpaceDetailRequest();
$req->setSpaceName("your space name");
$response = new VodGetSpaceDetailResponse();
try {
$response = $client->GetSpaceDetail($req);
} catch (Exception $e) {
echo $e, "\n";
} catch (Throwable $e) {
echo $e, "\n";
}
if ($response->getResponseMetadata()->getError() != null) {
print_r($response->getResponseMetadata()->getError());
}
接口请求参数和返回参数详见 OpenAPI:更新空间信息。
<?php
require('../../vendor/autoload.php');
use Volc\Service\Vod\Models\Request\VodUpdateSpaceRequest;
use Volc\Service\Vod\Models\Response\VodUpdateSpaceResponse;
use Volc\Service\Vod\Vod;
// Create a VOD instance in the specified region.
// $client = Vod::getInstance('cn-north-1');
$client = Vod::getInstance();
// Configure your Access Key ID (AK) and Secret Access Key (SK) in the environment variables or in the local ~/.volc/config file. For detailed instructions, see https://www.volcengine.com/docs/4/4408.
// The SDK will automatically fetch the AK and SK from the environment variables or the ~/.volc/config file as needed.
// During testing, you may use the following code snippet. However, do not store the AK and SK directly in your project code to prevent potential leakage and safeguard the security of all resources associated with your account.
// $client->setAccessKey('your ak');
// $client->setSecretKey('your sk');
$req = new VodUpdateSpaceRequest();
$req->setSpaceName("your space name");
$req->setDescription("your desc");
$response = new VodUpdateSpaceResponse();
try {
$response = $client->UpdateSpace($req);
} catch (Exception $e) {
echo $e, "\n";
} catch (Throwable $e) {
echo $e, "\n";
}
if ($response->getResponseMetadata()->getError() != null) {
print_r($response->getResponseMetadata()->getError());
}
接口请求参数和返回参数说明详见 UpdateSpaceUploadConfig。
<?php
require('../../vendor/autoload.php');
// Create a VOD instance in the specified region.
// $client = Volc\Service\Vod\Vod::getInstance('cn-north-1');
$client = Volc\Service\Vod\Vod::getInstance();
// Configure your Access Key ID (AK) and Secret Access Key (SK) in the environment variables or in the local ~/.volc/config file. For detailed instructions, see https://www.volcengine.com/docs/4/4408.
// The SDK will automatically fetch the AK and SK from the environment variables or the ~/.volc/config file as needed.
// During testing, you may use the following code snippet. However, do not store the AK and SK directly in your project code to prevent potential leakage and safeguard the security of all resources associated with your account.
// $client->setAccessKey('your ak');
// $client->setSecretKey('your sk');
$request = new Volc\Service\Vod\Models\Request\VodUpdateUploadSpaceConfigRequest();
$request->setSpaceName("your SpaceName");
$request->setAutoPoster("your AutoPoster");
$request->setCustomPosterConfig(new Volc\Service\Vod\Models\Business\CustomPosterConfig());
$request->setGetPosterMode("your GetPosterMode");
$request->setAutoPosterCandidate("your AutoPosterCandidate");
$request->setAutoTranscode("your AutoTranscode");
$request->setTranscodeConfig(new Volc\Service\Vod\Models\Business\TranscodeConfig());
$request->setAutoSetVideoStatus("your AutoSetVideoStatus");
$request->setUploadOverwrite("your UploadOverwrite");
$request->setCallbackReturnPlayUrl("your CallbackReturnPlayUrl");
$request->setCallbackReturnRunId("your CallbackReturnRunId");
$request->setGetMetaMode("your GetMetaMode");
$request->setAutoGetArchiveVideoMeta("your AutoGetArchiveVideoMeta");
$request->setAutoGetIAVideoMeta("your AutoGetIAVideoMeta");
$request->setMetaGetMd5("your MetaGetMd5");
$response = new Volc\Service\Vod\Models\Response\VodUpdateUploadSpaceConfigResponse();
try {
$response = $client->updateUploadSpaceConfig($request);
} catch (Exception $e) {
echo $e, "\n";
} catch (Throwable $e) {
echo $e, "\n";
}
if ($response != null && $response->getResponseMetadata() != null && $response->getResponseMetadata()->getError() != null) {
echo $response->getResponseMetadata()->getError()->serializeToJsonString(), "\n";
} else {
echo $response->serializeToJsonString(), "\n";
}
接口请求参数和返回参数说明详见 DescribeUploadSpaceConfig。
<?php
require('../../vendor/autoload.php');
// Create a VOD instance in the specified region.
// $client = Volc\Service\Vod\Vod::getInstance('cn-north-1');
$client = Volc\Service\Vod\Vod::getInstance();
// Configure your Access Key ID (AK) and Secret Access Key (SK) in the environment variables or in the local ~/.volc/config file. For detailed instructions, see https://www.volcengine.com/docs/4/4408.
// The SDK will automatically fetch the AK and SK from the environment variables or the ~/.volc/config file as needed.
// During testing, you may use the following code snippet. However, do not store the AK and SK directly in your project code to prevent potential leakage and safeguard the security of all resources associated with your account.
// $client->setAccessKey('your ak');
// $client->setSecretKey('your sk');
$request = new Volc\Service\Vod\Models\Request\VodDescribeUploadSpaceConfigRequest();
$request->setSpaceName("your SpaceName");
$response = new Volc\Service\Vod\Models\Response\VodDescribeUploadSpaceConfigResponse();
try {
$response = $client->describeUploadSpaceConfig($request);
} catch (Exception $e) {
echo $e, "\n";
} catch (Throwable $e) {
echo $e, "\n";
}
if ($response != null && $response->getResponseMetadata() != null && $response->getResponseMetadata()->getError() != null) {
echo $response->getResponseMetadata()->getError()->serializeToJsonString(), "\n";
} else {
echo $response->serializeToJsonString(), "\n";
}