Blog Posts Api

The endpoint blog post api does not support sorting descending it always defaults to ascending (oldest first). Any plans to add desc support? The scenario which I want is to get the newest blogs based on the ‘publishDate’ (this property isn’t inclused in the docs but it works, but only asc.)

I have looked into it to see if there is any way to batch read the blog posts in order to get the latest first by API call - but no luck.

I would simply advice you to do the sorting in your own code.

In my case I get a lot of data that needs to be sorted in many different ways and the best and smothest way is to collect the data through the API and then sort it in your own code.

In PHP there are a huge amount of sorting functions to be used (but I have no clue what language you code in so hard for me to say). But all langugages (that I know of) have some kind of built in functions for sorting arrays so you should be good to go by fixing it that way.

Also - due to that reason I would think this is a low priority case for the API developers at HubSpot - but thats my guess.

I have put a suggestion in the ideas board - you can go in and follow and upvote it there:

https://community.hubspot.com/t5/HubSpot-Ideas/Ability-to-sort-by-ASC-and-DESC-in-HubSpot-API-results/idi-p/442137#M84109