artifactoryartifactory-query-lang

artifactory - get file date creation and modification from repo


I tried to google didn't really get the result I was looking for. Was wondering does any know how to get the date creation and date modification date of an artifact from artifactory?

thanks


Solution

  • There are several options, here are two -

    To get the information on a specific file in Artifactory you can use the File Info REST API:

    GET https://artifacotry.my.org/artifactory/api/storage/my-repo/path/to/some-file.txt
    
    200
    {
      "repo": "my-repo",
      "path": "path/to/some-file.txt",
      "created": ISO8601 (yyyy-MM-dd'T'HH:mm:ss.SSSZ),
      "lastModified": ISO8601 (yyyy-MM-dd'T'HH:mm:ss.SSSZ),
      ...
    {
    

    To execute a query (can be complex) to find files you can use AQL (Artifactory Query Language), just make sure to include the relevant fields in the result, e.g.:

    POST https://artifacotry.my.org/artifactory/api/search/aql
    items.find(
        {
            "repo":"my-repo"
        }
    ).include(
        "item.repo",
        "item.path",
        "item.name",
        "item.created",
        "item.updated"
    )
    
    200
    {
      "results" : [
        {
          "repo" : "my-repo",
          "path" : "path/to",
          "name" : "some-file.txt",
          "created" : "2015-01-01T10:10:52.383+02:00",
          "updated" : "2015-01-01T10:12:25.182+02:00"
        }, 
        ...
      ], 
      ...
    }