Convert Search Criteria Form to AQL

JFrog REST APIs

Products
JFrog Xray
Content Type
REST API
ft:sourceType
Paligo

Description: Generates an AQL query according to the given search criteria form. The generated AQL query can then be used to perform a search.

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: POST /api/retention/archive/policies/convertToAql

Produces: application/json

Consumes: text/plain

Query Parameters:

Field

Type

Description

properties

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"
          }
        ]
      }
    }

repositories

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"
        ]
      }
    }

path

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"
        ]
      }
    }

name

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"
        ]
      }
    }

createdBefore

long

Include all items that were created before the time provided (in months)

downloadedBefore

long

Include all items that were last downloaded before the time provided (in months)

Sample Request:

POST /api/retention/archive/policies/convertToAql

{
    "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"
          }
        ]
      }
    },
    "repositories": {
      "include": {
        "operator": "or",
        "values": [
          "repo-1",
          "repo-2"
        ]
      },
      "exclude": {
        "operator": "and",
        "values": [
          "repo-*",
          "*-3"
        ]
      }
    },
    "paths": {
      "include": {
        "operator": "or",
        "values": [
          "path-1",
          "path-2"
        ]
      },
      "exclude": {
        "operator": "or",
        "values": [
          "path-3"
        ]
      }
    },
    "names": {
      "include": {
        "operator": "or",
        "values": [
          "name-1",
          "name-2"
        ]
      },
      "exclude": {
        "operator": "or",
        "values": [
          "name-3"
        ]
      }
    },
    "createdBefore": 1628668945,
    "downloadedBefore": 1628668945
    }

Sample Response:

items.find(
  {
    "$and": [
        {
            "$or": [
                {
                    "@example-prop-key-1": {
                        "$match": "prop-val-1"
                    }
                },
                {
                    "@example-prop-key-1": {
                        "$match": "prop-val-2"
                    }
                }
            ]
        },
        {
            "$or": [
                {
                    "@example-prop-key-2": {
                        "$nmatch": "prop-val-1"
                    }
                }
            ]
        },
        {
            "$or": [
                {
                    "repo": {
                        "$match": "repo-1"
                    }
                },
                {
                    "repo": {
                        "$match": "repo-2"
                    }
                }
            ]
        },
        {
            "$and": [
                {
                    "repo": {
                        "$nmatch": "repo-*"
                    }
                },
                {
                    "repo": {
                        "$nmatch": "*-3"
                    }
                }
            ]
        },
        {
            "$or": [
                {
                    "path": {
                        "$match": "path-1"
                    }
                },
                {
                    "path": {
                        "$match": "path-2"
                    }
                }
            ]
        },
        {
            "$or": [
                {
                    "path": {
                        "$nmatch": "path-3"
                    }
                }
            ]
        },
        {
            "$or": [
                {
                    "name": {
                        "$match": "name-1"
                    }
                },
                {
                    "name": {
                        "$match": "name-2"
                    }
                }
            ]
        },
        {
            "$or": [
                {
                    "name": {
                        "$nmatch": "name-3"
                    }
                }
            ]
        },
        {
            "created": {
                "$lt": "1628668945"
            }
        },
        {
            "stat.downloaded": {
                "$lt": "1628668945"
            }
        }
    ]
}
)

Status:

200: Success