Hubspot API: Get generated live content for a page to index it (without hubl tags)
I want to index my Hubspot pages via an external Elasticsearch service that I have set up. Now when I get the content via the API for my pages the body html still has the HUBL tags ( {% … %} ) in it and is not really the live content as it is displayed when a visitor sees that page.
Is there a way to get this generated content via API? Or is there another way?
Hubspot API: Get generated live content for a page to index it (without hubl tags)
Sorry for the late reply, kinda forgot about this question.
I have sorted it out. We get the pages (blog or page) via API and then we get only the things that we want and filter the content to be indexed with following code:
First get all the pages:
/*
* GET HUBSPOT CONTENT
*/
// tip: how to add greater then > to a date: .'&publish_date__gt=0&deleted_at=0'
if($type == 'blog') {
$url = "http://api.hubapi.com/content/api/v2/blog-posts?hapikey=" . $settings['hapikey'];
} else {
$url = "http://api.hubapi.com/content/api/v2/pages?hapikey=" . $settings['hapikey'];
}
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$result = curl_exec($ch);
$info = curl_getinfo($ch);
$resultArray = json_decode($result, true);
curl_close($ch);
Then loop throught the pages and for each page do the following:
($type must be ‘blog’ or ‘page’ depending on the incoming result you got from the API curl)