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

admin2025-01-07  5

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.

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.

Share Improve this question edited Jun 15, 2020 at 8:21 CommunityBot 1 asked Nov 21, 2015 at 10:37 Emlyn JonesEmlyn Jones 431 silver badge7 bronze badges 2
  • 1 probably too broad. You need to store some data that needs to be accessed in some way..... It is hard to give a specific answer to such a broad question. – Mark Kaplun Commented Nov 21, 2015 at 11:20
  • Hi Mark, thanks for taking the time to comment. I disagree that the question is as broad as you imply, but I will try to clarify in the question. – Emlyn Jones Commented Nov 22, 2015 at 15:29
Add a comment  | 

1 Answer 1

Reset to default 0

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.

转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1736256896a397.html

最新回复(0)