Content API cURL request to pull content by date

Hi to you all,
I’ve been trying to execute this cURL fro my Mac and I always get the same results:

curl -H "Accept-Version: v5.0" "{myhiddenAPIkey}&fields=title,url,published_at,updated_at&published_at:now-30d" | json_pp

No matter the relative date I set, I get the same list in return. Thanks for your help.

You’re getting the most recent content because Ghost doesn’t understand that published_at is a filter.

You need to pass in that published_at as a filter. &filter=published_at:now-30d (or you maybe meant :> or :< ?) And you’ll probably need to URLencode it.

1 Like

Oh, thanks! And what if I want to give a date range using the same approach? How do we use the AND operator?

Here’s the link to the documentation. :) Ghost Content API Documentation
Short answer: +

1 Like