• Resolved jools73

    (@jools73)


    Is there a TablePress API method for importing JSON data into a table?

    I have a set of tables which are populated by an external JSON source. The data tends to change once a week, but when it does I want to pull it in ASAP.

    I currently use the Auto-import plugin, but that has the side effect that if I run it every 15 minutes, it causes TablePress to flushing the entire WP Super Cache (see earlier thread), which is killing my site performance.

    I’m considering writing a cron job that will pull in the data on the irregular schedule that I need, so that I can keep the cache flushing to a minimum. Ideally, i’d like to keep using TablePress and the Auto-import plug-in as it’s really stable, and saves me hand-rolling a whole load of code.

    https://www.ads-software.com/extend/plugins/tablepress/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Tobias B?thge

    (@tobiasbg)

    Hi,

    thanks for the question.

    No, there’s not really an API for the import. The functions that the Auto-Import Extension come closest to being called an “API”.
    So, extracting the relevant code from there and wrapping it in your custom cron handler might be the best choice for your use case.

    Or, why don’t you set the interval in the Auto-Import Extension higher, and maybe turn off the automatic cache flushing with that small code snippet that I suggested in the other thread?

    Regards,
    Tobias

    Thread Starter jools73

    (@jools73)

    OK, will have a look at that – may come back here to double-check stuff!!!

    I’d prefer to not switch off the cache flush as for all other tables it does more good than harm – and prevents me having to remind people to hit the “Delete Cache” button whenever they update a table!!

    It’s just this one scenario of these other tables I want to nail. Like I say, they only update about once a week (the site is for a Rugby Club, and the tables contain results and League Tables), but when they do update I want to run the update as soon as possible.

    Will come back to you with more questions no doubt!!

    Keep up the great work!

    Plugin Author Tobias B?thge

    (@tobiasbg)

    Hi,

    thanks for the clarification! Indeed, deactivating cache flushing is not really an option then.

    Yes, then it might be the best idea to extend the Auto-Import Extension to your custom needs, either by extending the interval to a week in there, or by extracting the relevant import code and run that with your custom cron handler. With that, you could maybe first check if the data changed on the other site and only then do the import.

    Best wishes,
    Tobias

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Scripting JSON import into TablePress’ is closed to new replies.