Get an Archive Policy

JFrog REST APIs

Products
JFrog Xray
Content Type
REST API
ft:sourceType
Paligo

Description: Returns an archive policy based on the policy key.

Note

This Cold Storage feature is available only for Artifactory Enterprise and Enterprise+ users.

Since: Artifactory 7.27.3

Security: Requires an admin user

Usage: GET /api/retention/archive/policies/{policyKey}

Produces: application/json

URL Parameter:

Parameters

Type

Description

Required/Optional

policyKey

string

The policy key for which the archive policy details need to be retrieved.

Required

Sample Request:

GET /api/retention/archive/policies/myPolicy2

Sample Response for Artifact Policy:

[ 
   {
        "key": "myPolicy2",
        "enabled": true,
        "description": "Demo policy - archive using search criteria form",
        "cronExp": "0 0 0/1 ? * * *",
        "durationInMinutes": 0,
        "expirationTimeInMonths": 0,
        "skipTrashcan": false,
        "searchCriteriaForm": {
            "properties": {
                "include": {
                    "operator": "or",
                    "values": [
                        {
                            "propertyKey": "updated",
                            "propertyValue": "updated"
                        }
                    ]
                },
                "exclude": {
                    "operator": "or",
                    "values": []
                }
            },
            "repositories": {
                "include": {
                    "operator": "or",
                    "values": [
                        "include-*",
                        "*-repo"
                    ]
                },
                "exclude": {
                    "operator": "or",
                    "values": []
                }
            },
            "paths": {
                "include": {
                    "operator": "or",
                    "values": []
                },
                "exclude": {
                    "operator": "or",
                    "values": [
                        "exclude-*",
                        "*-path"
                    ]
                }
            },
            "createdBefore": 2,
            "downloadedBefore": 3
        },
        "lastRunStatus": {
            "migrationIdentifier": "retention_archive_myPolicy2_OUYEVKCIO3",
            "state": "COMPLETE",
            "completedNumberOfArtifacts": 0,
            "failedNumberOfArtifacts": 0,
            "totalNumberOfArtifacts": 0,
            "progressPercentage": 0,
            "startTime": 1632915823313,
            "finishTime": 1632915823355,
            "totalByteSize": 0,
            "successByteSize": 0,
            "failureByteSize": 0,
            "triggeredBy": "admin",
            "policyName": "myPolicy2"
        },
        "nextExecutionTime": 1632916800000
    }
]

The response displays the following information:

Property

Description

key

Unique policy key that identifies the policy.

enabled

If the policy is enabled/disabled for execution.

description

Description for the policy.

aqlQuery

The Artifactory Query Language query used to search for the artifacts to be archived.

cronExp

The Cron expression used for scheduling the archive policy.

nextExecutionTime

Time when the policy is scheduled to run next. This depends on the cronExp and the previous execution time.

durationInMinutes

The maximum duration (in minutes) for policy execution.

lastRunStatus

Shows the status of the last policy run. It can be one of the following:

  • PENDING: The policy has never been executed.

  • IN_PROGRESS: The policy execution is in progress.

  • IN_PROGRESS_WITH_ERRORS: The policy execution is in progress but encountered one or more errors.

  • COMPLETE: The policy executed successfully without any errors.

  • COMPLETE_WITH_ERRORS: The policy executed, but encountered one or more errors.

  • FAILED: The policy execution failed.

totalNumberOfArtifacts

Total number of artifacts to be archived.

completedNumberOfArtifacts

Total number of artifacts that were successfully archived.

failedNumberOfArtifacts

Total number of artifacts that could not be archived.

progressPercentage

The progress of the archive policy (in percentage).

startTime

Time when the policy started executing. Value is in Unix epoch time in milliseconds.

finishTime

Time when the policy finished executing. Value is in Unix epoch time in milliseconds.

totalByteSize

The total size of the artifacts included in the policy.

successByteSize

The size of the artifacts that were archived.

failureByteSize

The size of the artifacts that couldn't be archived.

expirationTimeInMonths

The expiration period (in months) that it takes for archived artifacts to be cleaned up from the Cold instance.

skipTrashcan

If the transfer of the artifacts to the trash can repository is enabled or disabled.

Sample Response for Package Policy:

{
  "key": "package-local-to-local-policy-5655",
  "enabled": true,
  "durationInMinutes": 0,
  "expirationTimeInMonths": 0,
  "skipTrashcan": true,
  "packageRetention": true,
  "packageSearchCriteriaForm": {
    "packageType": "docker",
    "packageRepos": [
      "package-archive-local-to-local-repo-5655"
    ]
  },
  "lastRunStatus": {
    "state": "PENDING",
    "policyName": "package-local-to-local-policy-5655"
  }
}

In addition to the properties listed above, package policies include the following properties:

Property

Description

packageRetention

Determines whether the archive policy works on packages (true) or artifacts (false).

packageSearchCriteriaForm

See Create an Archive Policy for details.

Status:

200: Success