Missing Blog Posts

SOLVE
Highlighted
New Contributor

Here are some notes from my developer that I sent over earlier: So notes from my developer: Every time a blog post is added to hubspot we:

 

1. Run a job every 15 minutes to grab the post by slug and either update the post in our system or create a new record.

 

2. On nursingce.com/blog we make an API call to list all of our blog posts. On each card we have a button which sends the reader to nursingce.com/blog/selected-post-slug

 

3. Then when we hit the page with the actual content of the blog we make an API call to pull one blog post from Hubspot based on the slug.

 

4. The post is returned from Hubspot to NursingCE and presented to the reader. "The below is the only script of theirs we're loading in the head of our code." <!--HubSpot --> <script type="text/javascript" id="hs-script-loader" async defer src="js.hs-scripts.com/3826264.js"></script> This way we're able to keep our entire styling + ability to add our own styling and scripts where needed. Our tech engineer suggested we check with Hubspot because we are pulling 400 blog posts and ordering by publishing date in descending order and only showing ones with the state of published so we're not sure why our older posts aren't showing.

Reply
0 Upvotes
1 Accepted solution

Accepted Solutions
HubSpot Moderator

Hi, @exposition23.

 

To clarify, are you requesting all 400 blog posts at once from this endpoint with a request like:

 

https://api.hubspot.com/content/api/v2/blog-posts?hapikey={{yourHapiKey}}&limit=400

If so, the limit for that endpoint cannot exceed 300, so you'll have do do some pagination if you wish to retrieve 400 posts.

Apologies that this limit wasn't documented, I've added it to this article.

Isaac Takushi

HubSpot Developer Support
Reply
0 Upvotes
3 Replies 3
Community Manager

Hi @exposition23,

 

I hope all is well with you 😄

 

Just to clarify, by missing blog posts do you mean that when your developer is using this endpoint: List blog posts | CMS Blog API to grab all the blog posts from your HubSpot portal, they ain't seeing all the blog posts? Especially the older posts? 

 

If that's the case, I used the List blog posts | CMS Blog API and use the offset value all the way till 340 and I was able to see all 358 blog posts. 

  • To further explain this, the endpoint will return a limit of 20 response (which means 20 blog posts) each time it is called
  • In order to get another 20 blog posts, your team would need to add the offset value
    • E.g. the first 20 will have a offset value of 0 
    • To get the second page of 20, we would need to use a offset value of 20 like this:
    • https://api.hubspot.com/content/api/v2/blog-posts?hapikey={{yourHapiKey}}&offset=20
    • To get the third page, the offset value will be 30 and so on.

I hope this helps to clarify and if we're on a different direction do share over the HubSpot endpoint that your developer is using and the issues that they're facing. I can definitely take a further look into it on my end.

Reply
0 Upvotes
New Contributor

Hi there,

That's for pagination. We're pulling all of their blog posts. 400. So technically it should return all of the blog posts.

Reply
0 Upvotes
HubSpot Moderator

Hi, @exposition23.

 

To clarify, are you requesting all 400 blog posts at once from this endpoint with a request like:

 

https://api.hubspot.com/content/api/v2/blog-posts?hapikey={{yourHapiKey}}&limit=400

If so, the limit for that endpoint cannot exceed 300, so you'll have do do some pagination if you wish to retrieve 400 posts.

Apologies that this limit wasn't documented, I've added it to this article.

Isaac Takushi

HubSpot Developer Support
Reply
0 Upvotes