TransWikia.com

Should I store external API data in my WP database or keep it as a transient?

WordPress Development Asked by Emlyn Jones on December 3, 2021

I am in a situation where I need to use data from an API (XML) served by a third party in my WordPress site. The data will be updated on that third party application.

Specifically this is data about properties that is stored on said 3rd party web application. The data is made available in XML format. I would like to allow displaying of this data in a WP website, as well as searching, and eventual portal to said application for booking.

At the moment I have three options, and I would like to know if one is preferred over the others.

Option 1:

Store an xml with all data as using transient API in WordPress and access the data using Ajax in a post template

Option 2:

Store an xml with all data as using transient API in WordPress and access the data using php in a post template

Option 3:

Importing the data into the WP database as custom posts and associated metadata?

The data is only available as an XML format (which is why I mention it).

My specific worries are that not having the data stored in WP database might lead to inability to search/sort data using WP functions.

I am just beginning development of a plugin now, and the decision as to how to utilise the data will dictate the direction of development.

One Answer

The way you are going about it is wrong. The source of data should not be relevant to how you store it in the DB. If the fact that this is a 3rd party service that supplies the data in some buzzword format confuses you, maybe you should try to imagine the input as coming from a low paid student doing a daily data input and how would you have built the DB then.

Answered by Mark Kaplun on December 3, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP