R2
Jobs
Background jobs on an R2 bucket.
Background jobs on an R2 bucket.
List
List background jobs for a bucket.
| Param | Type | Required | Default | Description |
|---|---|---|---|---|
accountId | string | Yes | Account Identifier. | |
bucketName | string | Yes | Bucket Name. | |
params | array | No | [] | Query Parameters: `jobType` (`prefixDelete`), `status` (`ENQUEUED`, `RUNNING`, `COMPLETED`, `FAILED` or `CANCELLED`, and only accepted alongside `jobType`), `maxKeys`, and `continuationToken` from the previous response's `nextContinuationToken`. |
jurisdiction | string|null | No | Jurisdiction where objects in this bucket are guaranteed to be stored. |
php
$response = $client->r2()->jobs()->list('ACCOUNT_ID', 'BUCKET_NAME', [], 'JURISDICTION');
Get
Get the current status of a background job.
$job = $client->r2()->objects()->emptyBucket('ACCOUNT_ID', 'my-bucket')->json('result.id');
$status = $client->r2()->jobs()->get('ACCOUNT_ID', 'my-bucket', $job)->json('result.status');
| Param | Type | Required | Default | Description |
|---|---|---|---|---|
accountId | string | Yes | Account Identifier. | |
bucketName | string | Yes | Bucket Name. | |
jobId | string | Yes | Job identifier, as returned when the operation was submitted. | |
jurisdiction | string|null | No | Jurisdiction where objects in this bucket are guaranteed to be stored. |
php
$response = $client->r2()->jobs()->get('ACCOUNT_ID', 'BUCKET_NAME', 'JOB_ID', 'JURISDICTION');

