How do I convert my Twitter static date ranges to dynamic date ranges?

Many Klips that use Twitter data need a date range that is dynamic (for example, past 30 days). In this section, we're going to change the query from a fixed range to a dynamic one.

  1. Add a ? to the end of the URL.
  2. Enter start-date={date.last30Days} at the end of your Query URL (after the ?).
  3. Enter &end-date={date.today} at the end of your Query URL (after the start-date parameter).
  4. At Data Format, use the drop-down menu to select JSON.
  5. Click the Get Resource button.
  6. Click the Continue button once you verify you have retrieved the correct data to Save your data source.

This may override other parameters in your Query URL such as count=50. To resolve this issue, delete the parameter. The Query URL will return all the data within the period specified. If you modify the sample query provided above using a date range, this is what it will look like: 
https://api.twitter.com/1.1/statuses/mentions_timeline.json?start-date={date.last30Days}&end-date={date.today}

Common date range expressions:

  • {date.today}
  • {date.last30Days}
  • {date.startOfQuarter}