CMS Development

sjay
メンバー | Diamond Partner
メンバー | Diamond Partner

how to Get all blogs using blog portal id

解決

Hi Team,

 

Can anyone help me out with how to list all the blogs using the blog portal ID?

sjay_0-1678454104802.png


We can use contents, but I was using another template. I just wanted to write code to get all the blogs from another portal ID.

sjay_1-1678454182270.png

 

 

0 いいね!
1件の承認済みベストアンサー
himanshurauthan
解決策
ソートリーダー | Elite Partner
ソートリーダー | Elite Partner

how to Get all blogs using blog portal id

解決

Hello @sjay 

Here's an example of how to get all the blogs using the HubSpot API and a blog portal ID:

First, you'll need to get your API key from HubSpot. You can find instructions on how to do that here: https://developers.hubspot.com/docs/api/overview.

Next, you'll need to make a GET request to the HubSpot Blogs API endpoint, passing in your API key and the blog portal ID you want to retrieve the blogs from. Here's an example using JavaScript and the axios library:

const axios = require('axios');

const apiKey = 'your_api_key_here';
const blogPortalId = 'your_blog_portal_id_here';

axios.get(`https://api.hubapi.com/blogs/v3/blog-posts?portalId=${blogPortalId}&hapikey=${apiKey}`)
  .then(response => {
    const blogs = response.data.objects;
    console.log(blogs);
  })
  .catch(error => {
    console.log(error);
  });

 

This code will make a GET request to the /blogs/v3/blog-posts endpoint and retrieve all the blogs associated with the specified blog portal ID. The response.data.objects property contains an array of blog objects, each with information such as the blog title, publish date, and author.

I hope this helps! Let me know if you have any other questions.

Digital Marketing & Inbound Expert In Growth Hacking Technology

元の投稿で解決策を見る

1件の返信
himanshurauthan
解決策
ソートリーダー | Elite Partner
ソートリーダー | Elite Partner

how to Get all blogs using blog portal id

解決

Hello @sjay 

Here's an example of how to get all the blogs using the HubSpot API and a blog portal ID:

First, you'll need to get your API key from HubSpot. You can find instructions on how to do that here: https://developers.hubspot.com/docs/api/overview.

Next, you'll need to make a GET request to the HubSpot Blogs API endpoint, passing in your API key and the blog portal ID you want to retrieve the blogs from. Here's an example using JavaScript and the axios library:

const axios = require('axios');

const apiKey = 'your_api_key_here';
const blogPortalId = 'your_blog_portal_id_here';

axios.get(`https://api.hubapi.com/blogs/v3/blog-posts?portalId=${blogPortalId}&hapikey=${apiKey}`)
  .then(response => {
    const blogs = response.data.objects;
    console.log(blogs);
  })
  .catch(error => {
    console.log(error);
  });

 

This code will make a GET request to the /blogs/v3/blog-posts endpoint and retrieve all the blogs associated with the specified blog portal ID. The response.data.objects property contains an array of blog objects, each with information such as the blog title, publish date, and author.

I hope this helps! Let me know if you have any other questions.

Digital Marketing & Inbound Expert In Growth Hacking Technology