I'm attempting to update some old legacy code using v2 of the HubSpot API to v3 with the new Private App authentication. In doing this I have to update a call to gather recent blog posts. With v2 of the API I used the following call and was able to get the 5 most recent blog posts:
https://api.hubapi.com/content/api/v2/blog-posts?hapikey=<--HUBSPOT API KEY -->&limit=5&state=PUBLISHED
How do I do this with v3? So far I have the following call, but it only returns published posts from the beginning of time (when we started posting blog posts):
"You can provide sorting and pagination options as query parameters. Specify the property name as the value to the sort query parameter to return the blog posts in the natural order of that property. You can reverse the sorting order by including a dash character before the property name (e.g., sort=-createdAt)."
"You can provide sorting and pagination options as query parameters. Specify the property name as the value to the sort query parameter to return the blog posts in the natural order of that property. You can reverse the sorting order by including a dash character before the property name (e.g., sort=-createdAt)."
This is the same URL that @skimura posted above, except I have the script writing and executing this CURL request use tomorrow's date so that it's always looking for the most recent posts and takes into account any posts that were posted today.