Blog API List all published URL's


#1

Hi there,

I have about 550 blog posts on my account and I am looking to use the List blog posts API to get a list of all published URLs. I am following this guide: http://developers.hubspot.com/docs/methods/blogv2/get_blog_posts

Problem I am having is no matter what I try I only end up with 20 results. It does say in the documentation that there is a default limit of 20 records. In the documentation there is a parameter name titled “limit” so I figured this was easy to set. For whatever reason I can’t seem to get more then 20 records. Below is the curl command I am using.

curl https://api.hubapi.com/content/api/v2/blog-posts?hapikey=API-KEY-REMOVED?limit=1000

Any help would be great!


#2

Hi @Chris_Griffith

In the example URL you have, you have two ? in the URL, when the second one should be a &.

In general, you should keep the limit at 100 or lower to prevent timeouts, but you can use the offset= parameter to page through all of the results.
https://api.hubapi.com/content/api/v2/blog-posts?hapikey=demo&limit=100
https://api.hubapi.com/content/api/v2/blog-posts?hapikey=demo&limit=100&offset=100
https://api.hubapi.com/content/api/v2/blog-posts?hapikey=demo&limit=100&offset=200


#3

Hey thanks for the quick response. The ? was actually a typo. I was trying several different combinations without any luck. I copy and pasted exactly what you responded with only changing the api key. Still only received 20 records. There has got to be a bug in the API parameters. I don’t know what else to try at this point. Do you know of another way to get a list of all BlogIDs and published URLs? I have 545 blog posts total. Thanks again :slight_smile:


#4

Are you seeing all 100 posts when using the example URL with the demo key?
https://api.hubapi.com/content/api/v2/blog-posts?hapikey=demo&limit=100

Each request would only return the number of posts set in limit= (defaulting to 20), so you’d need to use the offset=parameter to get the next set of posts, until the offset would put you over the total_count returned in each response.

If you are seeing 100 with the demo key, but only 20 with your API key, can you send me your Hub ID? I’d need to take a look at the data in your specific portal.


#5

Sure thing. HubID=168372