# API call

**URL:** <https://community.sonatype.com/t/api-call/5984>\
**Category:** Sonatype Nexus Repository\
**Created:** [March 4, 2021, 2:19am UTC](https://community.sonatype.com/t/api-call/5984 "2021-03-04T02:19:28Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![turganbaevanurkan](https://avatars.discourse-cdn.com/v4/letter/t/13edae/32.png) [@turganbaevanurkan](https://community.sonatype.com/u/turganbaevanurkan)\
**Post date:** [March 4, 2021, 2:19am UTC](https://community.sonatype.com/t/api-call/5984/1 "2021-03-04T02:19:28Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![rseddon](https://yyz1.discourse-cdn.com/flex047/user_avatar/community.sonatype.com/rseddon/32/341_2.png) [@rseddon](https://community.sonatype.com/u/rseddon)\
**Post date:** [March 4, 2021, 6:02pm UTC](https://community.sonatype.com/t/api-call/5984/2 "2021-03-04T18:02:06Z")

</div>

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:

```auto
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:

> **[Can I directly update artifacts in Nexus Repository 2 local storage on disk?](https://support.sonatype.com/hc/en-us/articles/213465608-Can-I-directly-update-artifacts-in-Nexus-Repository-2-local-storage-on-disk)**
>
> Nexus Repository 2 officially sunsetted June 30, 2025. Visit my.sonatype.com for archived documentation. Migrate to Sonatype Nexus Repository 3 as soon as possible.
> In general, it is OK to directly...
