APIs & Integrations

Not applicable

Knowledge Base articles API for search and get content

Hi all,

we're currently in a migration process and before Hubspot we were using a service that offered an API to query search strings to find relevant articles and receive the content of those articles to present it directly in our app.

By guessing, I could find a query that I can use for Hubspot Knowledge Base to at least search for relevant articles, but it is not yet documented:
https://api.hubapi.com/contentsearch/v2/search?portalId=<id>&type=KNOWLEDGE_ARTICLE

But the response only returns a list of links to the absolute URL on Hubspot and not the full content of each article. Is there an additional parameter to get the full content?

And also my hope was to get the content of any specific article by using this API query, but it didn't work so far:
https://api.hubapi.com/content/api/v2/knowledge-articles/<articleId>?hapikey=

Those are my questions and any feedback is appreciated.

Best regards,
Stefan

6 Replies 6
YBederov
Participant

Knowledge Base articles API for search and get content

0 Upvotes
MikeJennings
Participant

Knowledge Base articles API for search and get content

This search API is a good start.  Is there a way to cause it to search on specific metadata, like SEO tags?  I could use this to work around the fact that I can't have an article in multiple categories.

0 Upvotes
Mohesh_Borah
Participant

Knowledge Base articles API for search and get content

Hi This is feasible.

I have tried with the below url and which is providing me the result.

But make sure your knowledge articles has been published first else this is not gonna work

Basic URL=> https://api.hubapi.com/contentsearch/v2/search?portalId=YOUR_PORTAL_ID&term=SEARCH_KEY_WORD&type=KNO...

Eg: https://api.hubapi.com/contentsearch/v2/search?portalId=1234567&term=How&type=KNOWLEDGE_ARTICLE

 

Thanks & Regards,

Mohesh Borah

 

Derek_Gervais
HubSpot Alumni
HubSpot Alumni

Knowledge Base articles API for search and get content

Hi @stefan-myprofitsee,

The Site Search endpoint doesn't yet document the ability to search Knowledge Base articles, but technically it's currently capable of providing Knowledge Base search results. I'm not able to replicate your issue of only receiving absolute URLs though; can you give me an example of the raw response body?

Regarding you other question; there is not article-specific endpoint. The Content Search API is the only way to pull Knowledge Base article search results.

speedplane
Participant

Knowledge Base articles API for search and get content

Once you have the knowledge base search results, how do you get the content? 

OTanti
Participant

Knowledge Base articles API for search and get content

The only way I managed to fetch some content was through GET/cms/v3/site-search/indexed-data/{contentId}?type=KNOWLEDGE_ARTICLE

 

But unfortunately the content will not include any href links, or any tables in html format etc.. just the indexed properties.

Not sure if someone else managed to get the content in HTML or raw format

0 Upvotes