CMS Development

karensantana
メンバー

Retrieve list of topics using API Jquery ajax request.

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:

 

Screenshot_9.png What Im doing wrong?

0 いいね!
1件の返信
DaniellePeters
トップ投稿者

Retrieve list of topics using API Jquery ajax request.

 

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