Description: Updates an existing 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: PUT /artifactory/api/retention/archive/policies/{key}
Produces: application/json
Consumes: application/json
Request Parameters:
Parameters | Type | Description | Required/Optional |
|---|---|---|---|
| string | Unique policy key that identifies the policy. | Required |
| boolean | Enable/disable policy. If disabled, policy execution is blocked. | Required |
| string | The Cron expression for scheduling the policy. | Required |
| string | Search for artifacts to be archived using Artifactory Query Language (AQL). This can be used instead of The AQL query can be based on these properties:
| Required if |
| string | Search Criteria Form for retention policy. This can be used instead of | Required if |
| string | Description for the policy. | Optional |
| long | The maximum duration (in minutes) for policy execution. If policy execution exceeds this period, it is stopped. Default value is 0. | Optional |
| long | The expiration period (in months) that it takes for archived artifacts to be cleaned up from the Cold instance. Default value is 0. | Optional |
| boolean | Prevent the transfer of the artifacts to the Trash Can repository, and allow the artifacts to be deleted by a full GC cleanup. Default value is | Optional |
Search Criteria Form
Field | Type | Description |
|---|---|---|
| string | Include/Exclude all properties with the specified "propertyKey" and a single "propertyValue". Supports and/or operator. Example "properties": {
"include": {
"operator": "or",
"values": [
{
"propertyKey": "example-prop-key-1",
"propertyValue": "prop-val-1"
},
{
"propertyKey": "example-prop-key-1",
"propertyValue": "prop-val-2"
}
]
},
"exclude": {
"operator": "or",
"values": [
{
"propertyKey": "example-prop-key-2",
"propertyValue": "prop-val-1"
}
]
}
} |
| string | Include/Exclude all repository keys. Supports and/or operator. ExampleExample "repositories": {
"include": {
"operator": "or",
"values": [
"repo-1",
"repo-2"
]
},
"exclude": {
"operator": "and",
"values": [
"repo-*",
"*-3"
]
}
} |
| string | Include/Exclude all items with specified paths Supports and/or operator. ExampleExample "paths": {
"include": {
"operator": "or",
"values": [
"path-1",
"path-2"
]
},
"exclude": {
"operator": "or",
"values": [
"path-3"
]
}
} |
| string | Include/Exclude all items with the specified names. Supports and/or operator. ExampleExample "names": {
"include": {
"operator": "or",
"values": [
"name-1",
"name-2"
]
},
"exclude": {
"operator": "or",
"values": [
"name-3"
]
}
} |
| long | Include all items that were created before the relative time provided (such as, 2 years ago, 3 months ago) |
| long | Include all items that were last downloaded before the relative time provided (such as, 2 years ago, 3 months ago) |
Sample Request: Using aqlQuery parameter
PUT https://[JFrogPlatformURL]/artifactory/api/retention/archive/policies/example-policy-key{
"key": "example-policy-key",
"enabled": true,
"description": "policy description",
"aqlQuery": "items.find({\"type\":{\"$eq\":\"file\"}})",
"cronExp": "0 15 10 L * ?",
"durationInMinutes": 0,
"expirationTimeInMonths": 0,
"skipTrashcan": true
}Sample Response: For aqlQuery parameter
{
"key": "example-policy-key",
"enabled": true,
"description": "policy description",
"aqlQuery": "items.find({\"type\":{\"$eq\":\"file\"}})",
"cronExp": "0 15 10 L * ?",
"durationInMinutes": 0,
"expirationTimeInMonths": 0,
"skipTrashcan": true
}Sample Request: Using searchCriteriaForm parameter
{
"key": "myPolicy",
"description": "Demo policy - archive using search criteria form",
"enabled": false,
"searchCriteriaForm": {
"properties": {
"include": {
"values": [{
"propertyKey":"updated",
"propertyValue":"updated"
}]
},
"exclude": {
"values": [
]
}
},
"repositories": {
"include": {
"values": [
"include-*",
"*-repo"
]
},
"exclude": {
"values": []
}
},
"paths": {
"include": {
"values": []
},
"exclude": {
"values": [
"exclude-*",
"*-path"
]
}
},
"createdBefore":2,
"downloadedBefore":3
}
}Sample Response: : Using searchCriteriaForm parameter
{
"key": "myPolicy",
"enabled": false,
"description": "Demo policy - archive using search criteria form",
"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
}
}Status:
201: Success