Can Runway-based sites consume *other* headless data providers?

  • Looking at Perch for a quick win to allow the end-client to maintain certain aspects of his own site.

    I know Perch can act as a headless data server, but can it be configured to include other data sources?

    I have complex, dynamic data already existing in another platform, I wondered about building it in to a site front-ended by Perch. NB it's *not* an SQL source.

    :?:

  • drewm

    Approved the thread.
  • Hello Marc,


    Yes, it can. How you implement this ultimately depends on your needs. At a minimum you can fetch the data from your external source, convert it into an array and render it using perch_template():


    PHP
    1. $json = file_get_contents('https://example.com/data.json');
    2. $data = json_decode($json, true);
    3. perch_template('my_template.html', $data);


    The above is not very practical as you probably do not want to fetch a large set of data from an external resource on every page load.


    If you do not need to filter/sort the data or paginate the output, you can write a custom Perch app to periodically fetch the data and save it in a file on your server. This way you do not need to download the data from your external source on every page load.


    Otherwise, you could write a custom Perch app to periodically fetch your data and import it into Perch Runway Collections (or your own custom database tables).

  • When I say another data source, I mean on the same physical machine. It's dynamic data, so a periodic refresh isn't going to hack it.

    I have an existing, complex (non-SQL) database that I want to simplify front-ending by making it essentially a data server.

    Apologies that it took so long to get back to this thread. The notification email was erroneously routed to junk, and then Christmas happened.... and then I remembered I'd asked the question and came back to see....:)