I would like to get list of artifacts which are created 30 days ago and before.
I have a script which it was providing with in time period bound, but where I need to change time in milliseconds every time. Its bit tough every time so I need to get list of artifacts which are created 30 days back with out modifying my script every time.
This is what i am using now
RESULTS=`curl -s -X GET -u <username>:<password> \
"https://<domain>.artifactoryonline.com/<domain>/api/search/creation?from=$START_TIME&to=$END_TIME&repos=$REPO" \
| grep uri \
| awk '{print $3}' \
| sed s'/.$//' \
| sed s'/.$//' \
| sed -r 's/^.{1}//'`
Your best option here is probably to use JFrog's AQL and query for artifacts with "created" older than X days, for example, you can use an AQL query like:
items.find({"created" : {"$before" : "30d"}})
You can read more about AQL in general and about "Relative Time Operators" specifically, here
So, an example curl with a limit of 10 artifacts would look like:
curl -X POST -u <user>:<password> -H "content-type: text/plain" -d 'items.find({"created":{"$before":"30d"}}).sort({"$desc" : ["created"]}).limit(10)' https://<your Artifactory server>:<port>/artifactory/api/search/aql
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.