APIs & Integrations

mucar
Member

Content Search API v2

SOLVE

Hi,

 

I'm trying to search posts from our Hubspot-powered blog with the help of Content Search API v2.  Found the following call from the documentation, which I'm using as the starting point: 

https://api.hubapi.com/contentsearch/v2/search?portalId=62515&term=hubspot

In this call I'm replacing the portalId to our Hubspot ID and the term to any term from the blog. In the attached screenshot you can see the response I get in Postman.

 

Since I'm not getting any result, I believe I'm doing something fundamentally wrong but don't know what that is. Much appreciated if anyone can point me in the right direction.

 

Thank you

 

p.s. I'm not filtering for blog posts during the testing but when I get this working I'll add the filter.

 

Screenshot 2020-12-15 at 21.19.38.jpg

0 Upvotes
1 Accepted solution
mucar
Solution
Member

Content Search API v2

SOLVE

Thank you @prosa for the suggestion. The portal ID was correct.

 

The issue was related to robots.txt for the blog. Added the following to the file and then API started to work.

# Block all bots
User-agent: *
Disallow: /

# Allow HubSpot Site Search Indexing
User-agent: HubSpotContentSearchBot
Allow: /

 Here's the reference from the documentation for anyone who faces the same problem.

 

Thank you

View solution in original post

3 Replies 3
mucar
Solution
Member

Content Search API v2

SOLVE

Thank you @prosa for the suggestion. The portal ID was correct.

 

The issue was related to robots.txt for the blog. Added the following to the file and then API started to work.

# Block all bots
User-agent: *
Disallow: /

# Allow HubSpot Site Search Indexing
User-agent: HubSpotContentSearchBot
Allow: /

 Here's the reference from the documentation for anyone who faces the same problem.

 

Thank you

JVallejo7
Contributor

Content Search API v2

SOLVE

I have the robots enable like you said but I don't receive any answer too

JVallejo7_0-1651573283778.png

JVallejo7_1-1651573314507.png

You can see this test here

http://hubspot-developers-18iodbe-25237078.hs-sites-eu1.com/blogreformermodificado/emoji-vs.-herogly...

 

0 Upvotes
prosa
Top Contributor

Content Search API v2

SOLVE

Please verify your portal ID

If this post helped you resolve your issue, please consider marking it as the solution. Thank you for supporting our HubSpot community.