ListJobsCommand

This operation lists jobs for a vault, including jobs that are in-progress and jobs that have recently finished. The List Job operation returns a list of these jobs sorted by job initiation time.

Amazon Glacier retains recently completed jobs for a period before deleting them; however, it eventually removes completed jobs. The output of completed jobs can be retrieved. Retaining completed jobs for a period of time after they have completed enables you to get a job output in the event you miss the job completion notification or your first attempt to download it fails. For example, suppose you start an archive retrieval job to download an archive. After the job completes, you start to download the archive but encounter a network error. In this scenario, you can retry and download the archive while the job exists.

The List Jobs operation supports pagination. You should always check the response Marker field. If there are no more jobs to list, the Marker field is set to null. If there are more jobs to list, the Marker field is set to a non-null value, which you can use to continue the pagination of the list. To return a list of jobs that begins at a specific job, set the marker request parameter to the Marker value for that job that you obtained from a previous List Jobs request.

You can set a maximum limit for the number of jobs returned in the response by specifying the limit parameter in the request. The default limit is 50. The number of jobs returned might be fewer than the limit, but the number of returned jobs never exceeds the limit.

Additionally, you can filter the jobs list returned by specifying the optional statuscode parameter or completed parameter, or both. Using the statuscode parameter, you can specify to return only jobs that match either the InProgress, Succeeded, or Failed status. Using the completed parameter, you can specify to return only jobs that were completed (true) or jobs that were not completed (false).

For more information about using this operation, see the documentation for the underlying REST API List Jobs .

Example Syntax

Use a bare-bones client and the command you need to make an API call.

import { GlacierClient, ListJobsCommand } from "@aws-sdk/client-glacier"; // ES Modules import
// const { GlacierClient, ListJobsCommand } = require("@aws-sdk/client-glacier"); // CommonJS import
const client = new GlacierClient(config);
const input = { // ListJobsInput
  accountId: "STRING_VALUE", // required
  vaultName: "STRING_VALUE", // required
  limit: Number("int"),
  marker: "STRING_VALUE",
  statuscode: "STRING_VALUE",
  completed: "STRING_VALUE",
};
const command = new ListJobsCommand(input);
const response = await client.send(command);
// { // ListJobsOutput
//   JobList: [ // JobList
//     { // GlacierJobDescription
//       JobId: "STRING_VALUE",
//       JobDescription: "STRING_VALUE",
//       Action: "ArchiveRetrieval" || "InventoryRetrieval" || "Select",
//       ArchiveId: "STRING_VALUE",
//       VaultARN: "STRING_VALUE",
//       CreationDate: "STRING_VALUE",
//       Completed: true || false,
//       StatusCode: "InProgress" || "Succeeded" || "Failed",
//       StatusMessage: "STRING_VALUE",
//       ArchiveSizeInBytes: Number("long"),
//       InventorySizeInBytes: Number("long"),
//       SNSTopic: "STRING_VALUE",
//       CompletionDate: "STRING_VALUE",
//       SHA256TreeHash: "STRING_VALUE",
//       ArchiveSHA256TreeHash: "STRING_VALUE",
//       RetrievalByteRange: "STRING_VALUE",
//       Tier: "STRING_VALUE",
//       InventoryRetrievalParameters: { // InventoryRetrievalJobDescription
//         Format: "STRING_VALUE",
//         StartDate: "STRING_VALUE",
//         EndDate: "STRING_VALUE",
//         Limit: "STRING_VALUE",
//         Marker: "STRING_VALUE",
//       },
//       JobOutputPath: "STRING_VALUE",
//       SelectParameters: { // SelectParameters
//         InputSerialization: { // InputSerialization
//           csv: { // CSVInput
//             FileHeaderInfo: "USE" || "IGNORE" || "NONE",
//             Comments: "STRING_VALUE",
//             QuoteEscapeCharacter: "STRING_VALUE",
//             RecordDelimiter: "STRING_VALUE",
//             FieldDelimiter: "STRING_VALUE",
//             QuoteCharacter: "STRING_VALUE",
//           },
//         },
//         ExpressionType: "SQL",
//         Expression: "STRING_VALUE",
//         OutputSerialization: { // OutputSerialization
//           csv: { // CSVOutput
//             QuoteFields: "ALWAYS" || "ASNEEDED",
//             QuoteEscapeCharacter: "STRING_VALUE",
//             RecordDelimiter: "STRING_VALUE",
//             FieldDelimiter: "STRING_VALUE",
//             QuoteCharacter: "STRING_VALUE",
//           },
//         },
//       },
//       OutputLocation: { // OutputLocation
//         S3: { // S3Location
//           BucketName: "STRING_VALUE",
//           Prefix: "STRING_VALUE",
//           Encryption: { // Encryption
//             EncryptionType: "aws:kms" || "AES256",
//             KMSKeyId: "STRING_VALUE",
//             KMSContext: "STRING_VALUE",
//           },
//           CannedACL: "private" || "public-read" || "public-read-write" || "aws-exec-read" || "authenticated-read" || "bucket-owner-read" || "bucket-owner-full-control",
//           AccessControlList: [ // AccessControlPolicyList
//             { // Grant
//               Grantee: { // Grantee
//                 Type: "AmazonCustomerByEmail" || "CanonicalUser" || "Group", // required
//                 DisplayName: "STRING_VALUE",
//                 URI: "STRING_VALUE",
//                 ID: "STRING_VALUE",
//                 EmailAddress: "STRING_VALUE",
//               },
//               Permission: "FULL_CONTROL" || "WRITE" || "WRITE_ACP" || "READ" || "READ_ACP",
//             },
//           ],
//           Tagging: { // hashmap
//             "<keys>": "STRING_VALUE",
//           },
//           UserMetadata: {
//             "<keys>": "STRING_VALUE",
//           },
//           StorageClass: "STANDARD" || "REDUCED_REDUNDANCY" || "STANDARD_IA",
//         },
//       },
//     },
//   ],
//   Marker: "STRING_VALUE",
// };

Example Usage

// The example lists jobs for the vault named my-vault.
const input = {
"accountId": "-",
"vaultName": "my-vault"
};
const command = new ListJobsCommand(input);
const response = await client.send(command);
/* response ==
{
"JobList": [
{
"Action": "ArchiveRetrieval",
"ArchiveId": "kKB7ymWJVpPSwhGP6ycSOAekp9ZYe_--zM_mw6k76ZFGEIWQX-ybtRDvc2VkPSDtfKmQrj0IRQLSGsNuDp
          -AJVlu2ccmDSyDUmZwKbwbpAdGATGDiB3hHO0bjbGehXTcApVud_wyDw",
"ArchiveSHA256TreeHash": "9628195fcdbcbbe76cdde932d4646fa7de5f219fb39823836d81f0cc0e18aa67",
"ArchiveSizeInBytes": 3145728,
"Completed": false,
"CreationDate": "2015-07-17T21:16:13.840Z",
"JobDescription": "Retrieve archive on 2015-07-17",
"JobId": "l7IL5-EkXyEY9Ws95fClzIbk2O5uLYaFdAYOi-azsX_Z8V6NH4yERHzars8wTKYQMX6nBDI9cMNHzyZJO59-8N9aHWav",
"RetrievalByteRange": "0-3145727",
"SHA256TreeHash": "9628195fcdbcbbe76cdde932d4646fa7de5f219fb39823836d81f0cc0e18aa67",
"SNSTopic": "arn:aws:sns:us-west-2:0123456789012:my-vault",
"StatusCode": "InProgress",
"VaultARN": "arn:aws:glacier:us-west-2:0123456789012:vaults/my-vault"
},
{
"Action": "InventoryRetrieval",
"Completed": false,
"CreationDate": "2015-07-17T20:23:41.616Z",
"InventoryRetrievalParameters": {
"Format": "JSON"
},
"JobId": "zbxcm3Z_3z5UkoroF7SuZKrxgGoDc3RloGduS7Eg-RO47Yc6FxsdGBgf_Q2DK5Ejh18CnTS5XW4_XqlNHS61dsO4CnMW",
"StatusCode": "InProgress",
"VaultARN": "arn:aws:glacier:us-west-2:0123456789012:vaults/my-vault"
}
]
}
*\/
// example id: to-list-jobs-for-a-vault-1481920530537
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
JavaScriptLn 1, Col 1
Errors: 0 Warnings: 0

ListJobsCommand Input

See ListJobsCommandInput for more details

Parameter
Type
Description
accountId
Required
string | undefined

The AccountId value is the AWS account ID of the account that owns the vault. You can either specify an AWS account ID or optionally a single '-' (hyphen), in which case Amazon S3 Glacier uses the AWS account ID associated with the credentials used to sign the request. If you use an account ID, do not include any hyphens ('-') in the ID.

vaultName
Required
string | undefined

The name of the vault.

completed
string | undefined

The state of the jobs to return. You can specify true or false.

limit
number | undefined

The maximum number of jobs to be returned. The default limit is 50. The number of jobs returned might be fewer than the specified limit, but the number of returned jobs never exceeds the limit.

marker
string | undefined

An opaque string used for pagination. This value specifies the job at which the listing of jobs should begin. Get the marker value from a previous List Jobs response. You only need to include the marker if you are continuing the pagination of results started in a previous List Jobs request.

statuscode
string | undefined

The type of job status to return. You can specify the following values: InProgress, Succeeded, or Failed.

ListJobsCommand Output

See ListJobsCommandOutput for details

Parameter
Type
Description
$metadata
Required
ResponseMetadata
Metadata pertaining to this request.
JobList
GlacierJobDescription[] | undefined

A list of job objects. Each job object contains metadata describing the job.

Marker
string | undefined

An opaque string used for pagination that specifies the job at which the listing of jobs should begin. You get the marker value from a previous List Jobs response. You only need to include the marker if you are continuing the pagination of the results started in a previous List Jobs request.

Throws

Name
Fault
Details
InvalidParameterValueException
client

Returned if a parameter of the request is incorrectly specified.

MissingParameterValueException
client

Returned if a required header or parameter is missing from the request.

ResourceNotFoundException
client

Returned if the specified resource (such as a vault, upload ID, or job ID) doesn't exist.

ServiceUnavailableException
server

Returned if the service cannot complete the request.

GlacierServiceException
Base exception class for all service exceptions from Glacier service.