PUT /content/api/v2/blog-posts/:blog_post_id - Updates the Blog Post in the database. If not all the fields are included in the body, we will only update the included fields.
We would like to add a counter per blog post (in HS blog) that counts a specific action performed by the user, we ideally want to save that count in HS and that’s why we ended up using a widget to save this <field,value> on a per post basis.
Any other alternative we might use?
You could keep rewriting a module in the post, but you will end up having to make a lot of calls and keeping track of things on your end. Instead I would write something that you can simply embed into a blog post that when it loads it looks up into your database how many “actions” have been performed on that post. You could use HubL to get the internal ID of the post so you don’t have to rely on the URL of the post, which could change.
Sorry I didn’t read the title to of the post before I responded. HubSpot’s APIs do not allow cross origin requests (except for the javascript events API).
Where is this code living? Can you give me an idea of what you are trying to do? Right now it looks like you are trying to update a blog post based on what someone is doing on another webpage. You will likely have to proxy the request through your own server which allows CORS, however an example may reveal another work around.
The domain of your request should be api.hubapi.com, not your domain (info.localytics.com). If you change that out it should work. Let me know if you still have troubles.