tencent cloud

Cloud Object Storage

最新情報とお知らせ
製品アップデート情報
製品のお知らせ
製品概要
製品概要
機能概要
応用シナリオ
製品の優位性
基本概念
リージョンとアクセスドメイン名
仕様と制限
製品の課金
課金概要
課金方式
課金項目
無料利用枠
記帳例
請求書の確認とダウンロード
お支払い遅れについて
よくある質問
クイックスタート
コンソールクイックスタート
COSBrowserクイックスタート
ユーザーガイド
リクエストの作成
バケット
オブジェクト
データ管理
バッチ処理
グローバルアクセラレーション
監視とアラーム
運用管理センター
データ処理
インテリジェントツールボックス使用ガイド
データワークフロー
アプリ統合
ツールガイド
ツール概要
環境のインストールと設定
COSBrowserツール
COSCLIツール
COSCMDツール
COS Migrationツール
FTP Serverツール
Hadoopツール
COSDistCpツール
HDFS TO COSツール
オンラインツール (Onrain Tsūru)
セルフ診断ツール
実践チュートリアル
概要
アクセス制御と権限管理
パフォーマンスの最適化
AWS S3 SDKを使用したCOSアクセス
データディザスタリカバリバックアップ
ドメイン名管理の実践
画像処理の実践
COSオーディオビデオプレーヤーの実践
データセキュリティ
データ検証
COSコスト最適化ソリューション
サードパーティアプリケーションでのCOSの使用
移行ガイド
サードパーティクラウドストレージのデータをCOSへ移行
データレークストレージ
クラウドネイティブデータレイク
メタデータアクセラレーション
データアクセラレーター GooseFS
データ処理
データ処理概要
画像処理
メディア処理
コンテンツ審査
ファイル処理
ドキュメントプレビュー
トラブルシューティング
RequestId取得の操作ガイド
パブリックネットワーク経由でのCOSへのファイルアップロード速度の遅さ
COSへのアクセス時に403エラーコードが返される
リソースアクセス異常
POST Objectの一般的な異常
セキュリティとコンプライアンス
データ災害復帰
データセキュリティ
クラウドアクセスマネジメント
よくある質問
よくあるご質問
一般的な問題
従量課金に関するご質問
ドメインコンプライアンスに関するご質問
バケット設定に関する質問
ドメイン名とCDNに関するご質問
ファイル操作に関するご質問
権限管理に関するご質問
データ処理に関するご質問
データセキュリティに関するご質問
署名付きURLに関するご質問
SDKクラスに関するご質問
ツール類に関するご質問
APIクラスに関するご質問
Agreements
Service Level Agreement
プライバシーポリシー
データ処理とセキュリティ契約
連絡先
用語集
ドキュメントCloud Object Storage

Async Processing Job APIs

フォーカスモード
フォントサイズ
最終更新日: 2024-02-04 15:40:24

Overview

This document provides an overview of APIs and SDK code samples for async processing jobs.
Note:
COS PHP SDK v2.4.0 or later is required. Earlier versions may contain bugs and need to be upgraded to the latest version when used.
API
Operation
Description
Submitting file preview job
Submits file preview job.
Querying file preview job
Queries specified file preview job.
Pulling file preview jobs
Pulls eligible file preview jobs.

Submitting File Preview Job

Feature description

This API (CreateDocProcessJobs) is used to submit a file preview job.
Note:
Before using this API, make sure that the file processing feature has been enabled in the data processing section in the console; otherwise, the error doc bucket unbinded, bucket's host is unavailable will be reported.
To use the file to HTML conversion feature, directly put the request parameters after the URL. The SDK is only responsible for calculating the signature.

Sample code

<?php

require dirname(__FILE__) . '/../vendor/autoload.php';

$secretId = "SECRETID"; // Replace it with your actual `secretId`, which can be viewed and managed in the CAM console at https://console.tencentcloud.com/cam/capi.
$secretKey = "SECRETKEY"; // Replace it with your actual `secretKey`, which can be viewed and managed in the CAM console at https://console.tencentcloud.com/cam/capi.
$region = "ap-beijing"; // Replace it with the actual region, which can be viewed in the console at https://console.tencentcloud.com/cos5/bucket.
$cosClient = new Qcloud\\Cos\\Client(
array(
'region' => $region,
'schema' => 'https', // Protocol header, which is `http` by default.
'credentials'=> array(
'secretId' => $secretId ,
'secretKey' => $secretKey)));
try {
$result = $cosClient->createDocProcessJobs(array(
'Bucket' => 'examplebucket-1250000000', // Bucket name in the format of `BucketName-Appid`, which can be viewed in the COS console at https://console.tencentcloud.com/cos5/bucket
'Tag' => 'DocProcess', // Job type: DocProcess
'QueueId' => 'pd8e422a2ea134165a92f2012ea43****', // Queue ID of the job
'Input' => array(
'Object' => 'Append Test Feature.pdf' // The object to be processed
),
'Operation' => array(
'DocProcess' => array(
'SrcType' => 'pdf', // Source file extension
'TgtType' => 'png', // Target file extension
'SheetId' => 0, // Sheet parameter, indicating to convert the xth sheet. Default value: `1`.
'StartPage' => 1, // Start page number, indicating to convert the file starting from the xth page. Default value: `1`.
'EndPage' => 3, // End page number, indicating to convert the file till the Xth page. Default value: `-1` (convert all pages).
'ImageParams' => '', // Image processing parameters after the conversion
'DocPassword' => '', // Office file password
'Comments' => 0, // Whether to hide comments and apply track changes. Default value: `0`.
'PaperDirection' => 0, // Paper orientation of the spreadsheet. Default value: `0`.
'Quality' => 100, // Quality of the generated preview image. Value range: [1-100]. Default value: `100`.
'Zoom' => 100, // Scaling parameter of the preview image. Value range: [10-200]. Default value: `100`.
),
'Output' => array(
'Region' => $region, // Bucket region
'Bucket' => 'examplebucket-1250000000', // Result storage bucket
'Object' => 'pic-${Page}.jpg', // Output file path
),
),
));
// The request succeeded.
print_r($result);
} catch (\\Exception $e) {
// The request failed.
echo($e);
}

Parameter description

Request has the following sub-nodes:
Parameter
Type
Description
Required
Bucket
String
Bucket name in the format of BucketName-APPID
Yes
Operation
Array
Operation rule
Yes
Tag
String
Job type, which currently can only be DocProcess.
Yes
Input
Array
The object to be processed
Yes
QueueId
String
Queue ID of the job
Yes
Input has the following sub-nodes:
Parameter
Type
Description
Required
Object
String
File URL in COS. Bucket is specified by Host.
Yes
Operation has the following sub-nodes:
Parameter
Type
Description
Required
DocProcess
Array
Specifies the parameter for the job, which takes effect only if Tag is DocProcess.
Yes
Output
Array
Result output address
Yes
DocProcess has the following sub-nodes:
Parameter
Type
Description
Required
srcType
String
Source data type. Currently, the file conversion feature determines the source data type according to the file extension of the COS object. If the object has no extension, you can set this value.
No
tgtType
String
Type of the output target file. Valid values: png, jpg, pdf. If the input file format cannot be recognized, the jpg format will be used by default. You cannot specify pages for the pdf format.
No
sheetId
Integer
Sheet parameter, indicating to convert the xth sheet. Default value: 1. If this value is set to 0, all sheets will be converted.
No
startPage
Integer
Starts conversion from page X. A spreadsheet file may be split into multiple pages, with multiple images generated, and StartPage indicates to start the conversion from page X of the specified SheetId. Default value: 1.
No
endPage
Integer
Ends conversion on page X. A spreadsheet file may be split into multiple pages, with multiple images generated, and EndPage indicates to end the conversion on page X of the specified SheetId. Default value: -1 (converting all pages).
No
imageParams
String
Processing parameters for the output image. All parameters of basic image processing are supported. To specify multiple parameters, separate them by pipeline operator. In this way, the image can be processed by multiple parameters in sequence in the same request.
No
docPassword
String
Password to open the Office file. If you need to convert a password-protected file, set this field.
No
comments
Integer
Whether to hide comments and apply track changes. 0: Hide comments and apply track changes; 1: Show comments and track changes. Default value: 0.
No
paperDirection
Integer
Paper orientation of the spreadsheet. 0: Vertical; other values: Horizontal. Default value: 0.
No
quality
Integer
Quality of the generated preview image. Value range: [1-100]. Default value: 100. For example, if the value is 100, the quality of the generated image will be 100%.
No
zoom
Integer
Scaling parameter of the preview image. Value range: [10, 200]. Default value: 100. For example, if the value is 200, the image will be scaled up (enlarged) by 200%.
No
Output has the following sub-nodes:
Parameter
Type
Description
Required
Region
String
Bucket region
Yes
Bucket
String
Result storage bucket
Yes
Object
String
Output file path
Yes

Response parameter description

Parameter
Type
Description
Code
String
Error code, which will be returned only if State is Failed.
Message
String
Error message, which will be returned only if State is Failed.
JobId
String
Job ID
Tag
String
Job type: DocProcess
State
String
Job status. Valid values: Submitted, Running, Success, Failed, Pause, Cancel.
CreationTime
String
Job creation time
QueueId
String
ID of the queue which the job is in
Input
Array
Input file path of the job
Operation
Array
Operation rule

Querying Specified File Preview Job

Feature description

This API (DescribeDocProcessJob) is used to query a specified file preview job.

Sample code

<?php

require dirname(__FILE__) . '/../vendor/autoload.php';

$secretId = "SECRETID"; // Replace it with your actual `secretId`, which can be viewed and managed in the CAM console at https://console.tencentcloud.com/cam/capi.
$secretKey = "SECRETKEY"; // Replace it with your actual `secretKey`, which can be viewed and managed in the CAM console at https://console.tencentcloud.com/cam/capi.
$region = "ap-beijing"; // Replace it with the actual region, which can be viewed in the console at https://console.tencentcloud.com/cos5/bucket.
$cosClient = new Qcloud\\Cos\\Client(
array(
'region' => $region,
'schema' => 'https', // Protocol header, which is `http` by default.
'credentials'=> array(
'secretId' => $secretId ,
'secretKey' => $secretKey)));
try {
$result = $cosClient->describeDocProcessJob(array(
'Bucket' => 'examplebucket-1250000000', // Bucket name in the format of `BucketName-Appid`, which can be viewed in the COS console at https://console.tencentcloud.com/cos5/bucket
'Key' => 'examplejobid', // JobId
));
// The request succeeded.
print_r($result);
} catch (\\Exception $e) {
// The request failed.
echo($e);
}

Parameter description

Parameter
Type
Description
Bucket
COS bucket name
String
Key
Job ID
String

Response parameter description

Parameter
Type
Description
jobsDetail
Job details
Array

Pulling File Preview Job

Feature description

The API (DescribeDocProcessJobs) is used to pull file preview jobs that meet specified conditions.

Sample code

<?php

require dirname(__FILE__) . '/../vendor/autoload.php';

$secretId = "SECRETID"; // Replace it with your actual `secretId`, which can be viewed and managed in the CAM console at https://console.tencentcloud.com/cam/capi.
$secretKey = "SECRETKEY"; // Replace it with your actual `secretKey`, which can be viewed and managed in the CAM console at https://console.tencentcloud.com/cam/capi.
$region = "ap-beijing"; // Replace it with the actual region, which can be viewed in the console at https://console.tencentcloud.com/cos5/bucket.
$cosClient = new Qcloud\\Cos\\Client(
array(
'region' => $region,
'schema' => 'https', // Protocol header, which is `http` by default.
'credentials'=> array(
'secretId' => $secretId ,
'secretKey' => $secretKey)));
try {
$result = $cosClient->getDescribeDocProcessJobs(array(
'Bucket' => 'examplebucket-1250000000', // Bucket name in the format of `BucketName-Appid`, which can be viewed in the COS console at https://console.tencentcloud.com/cos5/bucket
'QueueId' => 'pd8e422a2ea134165a92f2012ea43****', // ID of the queue from which jobs are pulled
'Tag' => 'DocProcess', // Job type: DocProcess
// 'NextToken' => '143486', // Context token for pagination
// 'OrderByTime' => 'Desc', // `Desc` (default) or `Asc`
// 'Size' => 2, // Maximum number of jobs that can be pulled. Default value: `10`. Maximum value: `100`.
// 'States' => 'All', // Status of the jobs to pull. If you enter multiple job statuses, separate them by comma. Valid values: `All` (default), `Submitted`, `Running`, `Success`, `Failed`, `Pause`, `Cancel`.
// 'StartCreationTime' => '2021-10-10T16:20:07+0800', // Start time of the time range for job pulling
// 'EndCreationTime' => '2021-10-10T16:20:07+0800', // End time of the time range for job pulling
));
// The request succeeded.
print_r($result);
} catch (\\Exception $e) {
// The request failed.
echo($e);
}

Parameter description

Parameter
Type
Description
Required
Bucket
String
COS bucket name
Yes
QueueId
String
ID of the queue from which jobs are pulled
Yes
Tag
String
Job type: DocProcess
Yes
OrderByTime
String
Desc (default) or Asc
No
NextToken
String
Context token for pagination
No
Size
Integer
Maximum number of jobs that can be pulled. The default value is 10. The maximum value is 100.
No
States
String
Status of the jobs to pull. If you enter multiple job statuses, separate them by comma. Valid values: All (default), Submitted, Running, Success, Failed, Pause, Cancel.
No
StartCreationTime
String
Start time of the time range for job pulling in the format of %Y-%m-%dT%H:%m:%S%z.
No
EndCreationTime
String
End time of the time range for job pulling in the format of %Y-%m-%dT%H:%m:%S%z.
No

Response parameter description

Parameter
Type
Description
JobDetail
Array
List of job details
nextToken
String
Context token for pagination

ヘルプとサポート

この記事はお役に立ちましたか?

フィードバック