<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Get Recent Blog Posts using v3 of HubSpot API in APIs &amp; Integrations</title>
    <link>https://community.hubspot.com/t5/APIs-Integrations/Get-Recent-Blog-Posts-using-v3-of-HubSpot-API/m-p/724413#M59150</link>
    <description>&lt;P&gt;Hello!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;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:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;https://api.hubapi.com/content/api/v2/blog-posts?hapikey=&amp;lt;--HUBSPOT API KEY --&amp;gt;&amp;amp;limit=5&amp;amp;state=PUBLISHED&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;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):&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;https://api.hubapi.com/cms/v3/blogs/posts?createdAt__lte=2022-11-29&amp;amp;sort=createdAt&amp;amp;limit=5&amp;amp;state=PUBLISHED&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for any help you can provide!&lt;/P&gt;&lt;P&gt;-Jon&lt;/P&gt;</description>
    <pubDate>Tue, 29 Nov 2022 22:52:26 GMT</pubDate>
    <dc:creator>JGallup</dc:creator>
    <dc:date>2022-11-29T22:52:26Z</dc:date>
    <item>
      <title>Get Recent Blog Posts using v3 of HubSpot API</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Get-Recent-Blog-Posts-using-v3-of-HubSpot-API/m-p/724413#M59150</link>
      <description>&lt;P&gt;Hello!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;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:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;https://api.hubapi.com/content/api/v2/blog-posts?hapikey=&amp;lt;--HUBSPOT API KEY --&amp;gt;&amp;amp;limit=5&amp;amp;state=PUBLISHED&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;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):&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;https://api.hubapi.com/cms/v3/blogs/posts?createdAt__lte=2022-11-29&amp;amp;sort=createdAt&amp;amp;limit=5&amp;amp;state=PUBLISHED&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for any help you can provide!&lt;/P&gt;&lt;P&gt;-Jon&lt;/P&gt;</description>
      <pubDate>Tue, 29 Nov 2022 22:52:26 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Get-Recent-Blog-Posts-using-v3-of-HubSpot-API/m-p/724413#M59150</guid>
      <dc:creator>JGallup</dc:creator>
      <dc:date>2022-11-29T22:52:26Z</dc:date>
    </item>
    <item>
      <title>Re: Get Recent Blog Posts using v3 of HubSpot API</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Get-Recent-Blog-Posts-using-v3-of-HubSpot-API/m-p/724569#M59163</link>
      <description>&lt;P&gt;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/484269"&gt;@JGallup&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hi.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How about this?（change query 'sort=createdAt' → 'sort=-created' )&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;https://api.hubapi.com/cms/v3/blogs/posts?createdAt__lte=2022-11-29&amp;amp;sort=-created&amp;amp;limit=5&amp;amp;state=PUBLISHED&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://developers.hubspot.com/docs/api/cms/blog-post#sorting-and-paginating" target="_blank"&gt;https://developers.hubspot.com/docs/api/cms/blog-post#sorting-and-paginating&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;"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)."&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT size="4"&gt;Thanks.&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 30 Nov 2022 08:56:26 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Get-Recent-Blog-Posts-using-v3-of-HubSpot-API/m-p/724569#M59163</guid>
      <dc:creator>skimura</dc:creator>
      <dc:date>2022-11-30T08:56:26Z</dc:date>
    </item>
    <item>
      <title>Re: Get Recent Blog Posts using v3 of HubSpot API</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Get-Recent-Blog-Posts-using-v3-of-HubSpot-API/m-p/724726#M59174</link>
      <description>&lt;P&gt;That was it! Thank you so much!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For everyone's reference, the way I'm making this work on my end is to query the Private App with the following URL to get the most recent posts:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;https://api.hubapi.com/cms/v3/blogs/posts?createdAt__lte=&amp;lt;--tomorrows date--&amp;gt;&amp;amp;sort=-created&amp;amp;limit=5&amp;amp;state=PUBLISHED&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is the same URL that &lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/388267"&gt;@skimura&lt;/a&gt; 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.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;Jon&lt;/P&gt;</description>
      <pubDate>Wed, 30 Nov 2022 14:10:57 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Get-Recent-Blog-Posts-using-v3-of-HubSpot-API/m-p/724726#M59174</guid>
      <dc:creator>JGallup</dc:creator>
      <dc:date>2022-11-30T14:10:57Z</dc:date>
    </item>
  </channel>
</rss>

