1

I have just started using Feed me to import a festival schedule, and I have run into an issue with how their API is set up. The URL I have to use for the feed (with the token) outputs only a <link>URL.xml</link> to a temporary XML-file with a unique filename each time. So there's pretty much a feed inside the feed. Any way of getting Feed Me to look at the linked XML-file, or any other suggestions on how to solve this?

3

There's no current way for Feed Me to handle this I'm afraid. My best suggestion would be to write a module to fetch the XML from your first URL, parse that, find the <link> note, fetch and parse that, and output the XML. You'd then point Feed Me to that URL, with the actual content of the feed that's required.

It could be a Craft module, a standalone PHP script, or even JS - whatever you're comfortable work.

It's a bit of extra work, but custom development would be the only option for the moment.

EDIT: The other option you could create a template (let's say my-feed.xml) in your templates directory with:

{% header "Content-Type: application/xml;" %}

{% set params = {
    url: 'http://path.to/feed/',
    type: 'xml',
} %}

{% set feed = craft.feedme.feed(params) %}

{% for node in feed %}
    {# Find the node that contains the link #}
    {% set link = node.myLinkNode %}

    {# Get the raw data and output it #}
    {% set xml = craft.feedme.getDataTypes().getRawData(link) %}

    {{ xml }}
3
  • I see, could you give me a very quick summary on how you would solve this with JS? No code, just a few words to push me in the right direction. I was hoping that I could create a separate feed and save the xml as an asset, but it looks like Feed Me only handles image files. – Håvard LJ Jan 22 at 0:15
  • When I mention JS, I'm probably referring to server-side JS with Node, doing the same thing, fetching, parsing, then fetching, parsing again. Any language you'd be comfortable with, but just needs to be a "middle-man" between your original feed and Feed Me. I've also just added another method above – crawf Jan 22 at 2:38
  • Is craft.feedme.getDataTypes().getRawData() something that should work out of the box? – Håvard LJ Jan 22 at 9:18

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.