API call

Hi,
I am using the nexus 2.14 version and I am looking curl command to delete and get the list of old artifacts

I have to delete old artifacts from nexus using the API call and get list artifacts :

  1. how can I list old artifacts by the year like the 2015 API call
  2. and after the list delete old data using an API call.

You should be able to script something using the metadata information stored on disk

We keep the created time in the attributes file associated with all files in repository storage. These files can be found in paths like this:

sonatype-work/nexus/storage/<repo-id>/.nexus/attributes/path/to/artifact

Where “path/to/artifact” is the path name of the artifact in the storage directory.

The files in the hidden attributes directory are JSON files, and the attribute name where this information is stored is “storageItem-created”. The format of the field is a long, the value is a standard unix timestamp.

So you could write a script that reads these JSON files, parses out “storageItem-created”.

Then just delete what is not needed anymore, and follow the steps here to run some post delete tasks:

1 Like