Do HubSpot APIs support CORS / AJAX requests? I am getting error while calling ajax call
hi,
I would like to get blog details of your website through ajax call but I am getting “Uncaught SyntaxError: Unexpected identifier” please address it as soon as possible.
$.ajax({
type:“GET”,
dataType: “jsonp”,
jsonpCallback:‘callback’,
contentType:“application/json”,
url:"https://api.hubapi.com/content/api/v2/blog-posts/"+5067937629+"?hapikey=**********"
success: function (data) {} });
Do HubSpot APIs support CORS / AJAX requests? I am getting error while calling ajax call
Hi
I have to say that yesterday I was able to send request via CORS to the API successfully. though I got an error in the console (chrome), but in the response I got all the data (in my case contact information). And also I was able to manipulate contact properties via post and CORS.
Do HubSpot APIs support CORS / AJAX requests? I am getting error while calling ajax call
An easy way I have found to make requests to the API is using Google App Engine. It’s free to use on the first tier and it’s very easy to set up an endpoint that makes requests to the API. I am using the Java API for this so I don’t know what languages you’re fimiliar with but that has proven to be the cheapest and easiest way to avoid CORS errors. IME most APIs do not support cross origin requests so this is a helpful method to use with any API. This method also adds a layer of security to your API key as you can let the server only take requests from whitelisted URLs.
Do HubSpot APIs support CORS / AJAX requests? I am getting error while calling ajax call
@ume.a We only support server-side requests. Client-side requests aren’t typically allowed and if you see it in the browser console it is not by design.
Do HubSpot APIs support CORS / AJAX requests? I am getting error while calling ajax call
@pmanca
Ok thanks,
Actually, we are getting complete JSON data using URLhttps://api.hubapi.com/content/api/v2/blog-posts/BLOGContentID?hapikey=*****, through this URL but when we publish that Module to Pixentia website it through an uncaught syntax error unexpected token for blogs data.
when we run the same code in Hubspot it is working fine.Issue after we publish that data.
Thanks
Do HubSpot APIs support CORS / AJAX requests? I am getting error while calling ajax call
@nagavalli Are you trying to move one blog from one HubSpot account to a different HubSpot account? Where is your Pixentia website hosted? If it isn’t hosted on HubSpot the page where you are trying to push it to, the syntax error could be that the other system wouldn’t understand HubL which is our templating language.
Do HubSpot APIs support CORS / AJAX requests? I am getting error while calling ajax call
@nagavalli You are going to run into some code issues as our modules are wrapped in HubL which is a proprietary templating language. You will need to change/edit the code a bit so it will be compatible with Pixentia.
Do HubSpot APIs support CORS / AJAX requests? I am getting error while calling ajax call
Does that part actually work for you? We don’t allow Front-End requests to our APIs and require server-side requests. I’m surprised you are getting a blog properly returned to you with that.
Do HubSpot APIs support CORS / AJAX requests? I am getting error while calling ajax call
In the console do you see any HubL? It would look similar to Jinja. The browser would not be able to render this and that is why you are receiving that error.
Do HubSpot APIs support CORS / AJAX requests? I am getting error while calling ajax call
1.when we request blog data in Hubspot it is working fine where as we publish that module on our page it raising Allow Origin Access error, our blogs total content working only through HubSpot. our requirement is we want to pull our blog data through Hubspot to our site.
2.Is Hubspot support c# coding can we write c# code if yes where we have to add that data.
3.If we want to pull all Blog related JSON data to your site what are the different alternatives.
our company have Hubspot Marketing and sales account through that they will publish the Blogs website http://pixentia.com/ in this website total Blogs and resources are completely handled by Hubspot.
our requirement is we have to pull blogs data based on the topicId we have to give one popup based on topicId.