1

I need to get blog posts from hubspot api using this approach. http://developers.hubspot.com/docs/methods/blogv2/get_blog_posts

Since craft uses twig I'm unable to use php in the templates, so I thought I could just use jQuery getJson but this causes a cross origin request blocked error.

So is creating a plugin and using php my only option to get json results from an api call?

Has anyone used hubspot api?

4

This works great for templates too: https://github.com/engram-design/FeedMe

Just tested it for a RSS feed, but apparently it also supports JSON.

The RSS example:

{% set params = {
    url: 'http://url.to/feed.rss',
    type: 'rss',
    element: 'item',
    cache: 60,
} %}

{% set feed = craft.feedme.feed(params) %}
{% for node in feed %}
    Title: {{ node.title }}
    Publish Date: {{ node.pubdate }}
    Content: {{ node.description }}
{% endfor %}
  • Thanks I will have to check that out, for now I decided to just use .get using an rss url which seems to be working fine. I am thinking about just using this rss feed url, and creating a matrix field for the category example url from hubspot blog.hubspot.com/marketing/rss.xml so field for category to replace marekting with what ever category they want, then a field for number of post to display which I can check in the loop. Using this way I can create a matrix field and then dynamically display these posts etc. – Bowenac May 6 '15 at 16:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.