Is there a way to list assets sorted asset by updated date ?

ZecKa
ZecKa Member Posts: 8
edited November 8 in General

I try to list all recently updated assets (metadata update, tags update, …)

Is there a way with search api or with another api to achieve that ?

Here is my current request

Url
https://api.cloudinary.com/v1_1/{{cloud_name}}/resources/search

Body:

{
    "expression": "resource_type:image",
    "with_field": [
         "context",
         "tags"
     ],
    
}

Tagged:

Best Answer

  • ZecKa
    ZecKa Member Posts: 8
    Answer ✓

    My bad, I finally find a solution myself.

    {
        "expression": "resource_type:image",
        "with_field": [
             "context",
             "tags"
         ],
        "sort_by": [
            {"last_updated.updated_at": "desc"}
        ]
    }
    

    However, I'm still unsure how many fields exist under last_updated.

    I found the following fields:

    • access_control_updated_at
    • context_updated_at
    • metadata_updated_at
    • public_id_updated_at
    • tags_updated_at
    • updated_at

    But I couldn't find documentation on this. Are there any additional fields? Does updated_at always reflect the most recent date among all of these fields?

Answers

  • Tom
    Tom Member, Cloudinary Staff Posts: 108

    Hi @ZecKa ,

    Thanks for reaching out.

    Here are all the fields supported with last_updated: Search by last updated fields / Search for resources.

    Yes, updated_at does reflect the most recent update made to any of these fields.

    Please let me know if you have any other questions or queries.

    Kind Regards,

    Thomas