Many Klips that use Twitter data need a date range that is dynamic (for example, past 30 days).
To change the query from a fixed range to a dynamic one:
- Add a ? to the end of the URL.
- Enter
start-date={date.last30Days}
at the end of your Query URL (after the?
). - Enter
&end-date={date.today}
at the end of your Query URL (after thestart-date
parameter). - At Data Format, use the drop-down menu to select JSON.
- Click Get data.
- Ensure this is the data you’re looking for and, optionally, select the checkbox to Model your data. Learn more about modelling your data source here.
- Click Continue.
- Name, choose refresh settings, and, optionally, share your data source.
- Click Save.
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}