メインコンテンツへスキップ
POST
/
v1
/
jobs
非同期ジョブ
curl --request POST \
  --url https://screenshot.cleariflow.com/v1/jobs \
  --header 'Content-Type: application/json' \
  --data '
{
  "request": {},
  "priority": 123
}
'
{
  "job_id": "550e8400-e29b-41d4-a716-446655440000"
}

はじめに

ベース URL

https://screenshot.cleariflow.com/v1/jobs

ジョブの作成

同期エンドポイントと同じ ScreenshotRequest ペイロードで非同期スクリーンショットジョブをキューに追加します。

リクエスト例

curl -X POST 'https://screenshot.cleariflow.com/v1/jobs' \
  -H 'Content-Type: application/json' \
  -d '{
    "request": {
      "api_key": "YOUR_UNIQUE_API_KEY",
      "url": "https://cleariflow.com"
    },
    "priority": 10
  }'
成功したリクエストはジョブ ID を返します:
{
  "job_id": "550e8400-e29b-41d4-a716-446655440000"
}

ジョブ作成パラメータ

request
Object
必須
同期スクリーンショットエンドポイントと同じフィールド(urlrenderactionscookies など)を持つ ScreenshotRequest オブジェクト。
priority
Integer
ジョブの優先度。値が大きいほど先に処理されます。デフォルト: 0。

ジョブステータスの取得

ID でジョブをポーリングし、ステータスを確認して完了後に結果を取得します。

ベース URL

https://screenshot.cleariflow.com/v1/jobs/{job_id}

リクエスト例

curl 'https://screenshot.cleariflow.com/v1/jobs/550e8400-e29b-41d4-a716-446655440000'
ジョブ実行中:
{
  "job_id": "550e8400-e29b-41d4-a716-446655440000",
  "status": "running"
}
ジョブが正常に完了した場合:
{
  "job_id": "550e8400-e29b-41d4-a716-446655440000",
  "status": "done",
  "result": {
    "ok": true,
    "image_base64": "/9j/4AAQSkZJRg...",
    "content_type": "image/jpeg",
    "meta": {
      "elapsed_ms": 8123
    }
  }
}

ジョブステータス値

ステータス説明
queuedジョブはキューで待機中です。
runningブラウザセッションがアクティブです。
doneスクリーンショット完了;result に出力が含まれます。
failedスクリーンショット失敗;error に説明が含まれます。

レスポンスパラメータ

job_id
String
非同期ジョブの一意の識別子。
status
String
現在のジョブステータス: queuedrunningdone または failed
result
Object
スクリーンショット結果オブジェクト(同期エンドポイントのレスポンスと同じ構造)。statusdone のときに存在します。
error
String
エラーメッセージ。statusfailed のときに存在します。
meta
Object
ジョブ実行に関する追加メタデータ。