Have you tried this API.
findExpiringAssets(Session session, java.util.Calendar lowerBound, java.util.Calendar upperBound)
Find all dam assets which are getting expired between lowerBound and upperBound.
I tried this api passing workflow session as first parameter and calendar object in the other two parameters, giving a lower bound and upper bound values, but it doesn't return anything.
Though sending null as the last two parameters retrieves all the images under /content/dam. There seems to be an issue here. Is there something wrong in what i have done?
I guess It should be JCR session (javax.jcr.Session) not workflow session. But in that case it should throw error. Have you seen logs for errors.
By looking at the code you are correct if you pass both null it will simply show all the assets in DAM.
Actually it internally creates query.
QueryManager queryManager = session.getWorkspace().getQueryManager();
QueryObjectModelFactory qomf = queryManager.getQOMFactory();