Content by Date Range

Last Updated: Jul 16, 2020
documentation for the dotCMS Content Management System

Any Date field on content can be searched via RESTful webservices for a specific date range.  Here is the proper API call format:

/api/content/render/false/query/+contentType:[ContentTypeVariable] +[ContentTypeVariable.DateField]:[ [year][month][day][time]to[year][month][day][time] ]

The following example filters the demo site content API for Blog content where the Publish Date field on the Blog Content falls between 01/01/2010 to 01/01/2025. URL encoding needs to be added between the parameters to test via URL as shown below:

https://demo.dotcms.com/api/content/render/false/query/+contentType:Blog%20+Blog.sysPublishDate:%5B20100101140000%20to%2020250101160000%5D%20

The next example filters the demo site for News Content where:

  1. the Publish Date field on the News Content falls between 01/01/2010 to 01/01/2025
    +News.sysPublishDate:[20100101140000to2025101160000]
  2. The language is set to default language 1
    +languageId:1
  3. Archived content is excluded and working content is included
    +deleted:false+working:true
  4. The News Content is ordered by the latest Publish Date descending
    /orderby/News.sysPublishDate desc

The URL encoded example below uses all of the listed filters above to query for News Content via API Call:

https://demo.dotcms.com/api/content/render/false/query/+contentType:News%20+News.sysPublishDate:%5B20100101140000%20to%202025101160000%5D%20+languageId:1%20+deleted:false%20+working:true/orderby/News.sysPublishDate%20desc

On this page

×

We Dig Feedback

Selected excerpt:

×