10 25, 2018 3:06 PM
Hello,
I'm trying to retrieve the list of topics of a Blog using API example:
$.ajax({ 'method': 'GET', 'url': 'https://api.hubapi.com/blogs/v3/topics?hapikey=demo', 'dataType': 'jsonp', 'crossDomain': true }).success(function(jsondata) { var jResponse = $(this).text(); console.log(jResponse); }).error(function(){ });
But everytime I make the request it shows me the following error:
What Im doing wrong?
10 26, 2018 4:06 PM
HubSpot APIs generally do not support AJAX requests because it would exposes any authentication to the client. You will have to make the request server side.
https://developers.hubspot.com/docs/faq/do-hubspot-apis-support-ajax-request
If you are trying to render blog topics on a HubSpot page or template, you can use the blog-topics HubL function:
https://designers.hubspot.com/en/docs/hubl/hubl-supported-functions#blog-topics