Get Images from a folder sorted by date using Admin api

Comments

1 comment

  • Avatar
    Eric Pasos

    Hi Anjan,

    The parameter direction can be used to sort the result by created_at date (see https://cloudinary.com/documentation/admin_api#optional_parameters), for example,

    const options = {
    type: 'upload',
    prefix: uploadDir,
    max_results: 10,
    direction: 1,
    }

    Alternatively, you can also use the Search API expression parameters (see https://cloudinary.com/documentation/search_api#expressions), for example:

    search.expression(<some_filter>).sort_by('created_at','desc').max_result(10)

    Then you could also use the next_cursor to go through the next 10 items in the result list.

    Hope this helps, please let me know if you have any further questions.

     

     

    0
    Comment actions Permalink

Please sign in to leave a comment.