Search code examples
artifactory

How do I use the artifactory REST api to search for artifacts by name since a specified date?


I tried making a GET request to this url:

https://artifactory.xxxxxx.com/artifactory/api/search/dates?dateFields=created&from=1675050197406&name=yyyyy-*.tgz/

but I ran into this error:

{
  "errors": [
    {
      "status": 500,
      "message": "Item not found for id '2649778966'"
    }
  ]
}

Thanks in advance.


Solution

  • You can use the AQL (Artifactory Query Language) to search for artifacts in Artifactory by name and last modified date. Here is an example AQL query to search for artifacts with a name starting with "my-artifact" modified after Jan 1, 2022:

    items.find(
      {
        "name": {"$match": "my-artifact*"},
        "$and": [
          {"modified": {"$gt": "2022-01-01T00:00:00.000Z"}}
        ]
      }
    )