• Resolved vipasane

    (@vipasane)


    Question:
    How can I use a dynamic source which is XML formatted? But does not have .xml ending.
    Static XML file from URI this process showed in a tutorial was a breeze.

    Errors:
    WPDataTables: Create a Table: Create table: Create a data table linked to an existing data source. (one with XML option)

    Another when form validation fails in with full URI
    And with short URI: (https://promesta.likeit.fi/servlet/XML?handler=duuni.Advert)
    “There was an error while trying to save the table! error There has been a critical error on this website.”


    Background:
    I have an API which lists job adds and those would need to be added to WP site. API and production content available here:
    https://promesta.likeit.fi/servlet/XML?handler=duuni.Advert&state=-1&loginuser=guest&loginpass=vieras

    Justification:
    And for sure I can provide jquery datatables ajax url to fetch content on client side just by providing URL.
    But I would need to make this functionality more usable for those who are creating content and layout (=not technical or coder friendly)

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter vipasane

    (@vipasane)

    For some reason image blocks with following links were not showing up.
    Screenshots:
    https://ibb.co/YTVKhBz
    https://ibb.co/ky0KBQt

    Plugin Author wpDataTables

    (@wpdatatables)

    Hello.
    1. In regards to using your initial link from the short URI you shared with us,

    if we try to follow the URL from our browsers, it says you have some syntax error in that file. Here is a screenshot what happens if we try to load your URL in a browser :

    (https://promesta.likeit.fi/servlet/XML?handler=duuni.Advert)

    So it seems that you have some error in that path, or the XML format itself,
    but our support does not cover finding errors from your source file or URL path.

    And also you asked if it is possible to link a dataTable from XML, when the path URL to the source file does not end with an .XML extension,
    sorry to disappoint you, but that is not possible,
    the file needs to be accessible online, and the path has to end with the XML extention.
    Also for XML format, please check the format that is explained here.
    If i understood, you were able to make a table on your WordPress linked from our sample XML data set available from this link,
    then this means that the issue is coming either from the format of your file,
    or the server.
    Our support does not cover finding the exact error in your file/ or on the server configuration.


    2. In regards of providing data source from an API for our dataTables,
    it is not possible to have it in form of XML.

    If you wish to use API, and to pull data from it,  then you will have to adapt it to PHP Array, and make a table linked to PHP Array.

    Alternatively, if you convert this data to JSON,
    If you link the table to a JSON file, this file has to have structure as we pointed out on this documentation. I will copy the important part here :

     Currently, wpDataTables accepts this, and only this format of JSON (see example on the docs page): 

    a one-level array of same-structured objects where each object will be parsed as a row, and each field inside of the object as a cell.

     If your software does not return this format, you would need to prepare, for example, some PHP adapter to return one of the formats that wpDataTables would accept.

    2. If your JSON file has multiple levels, then you will have to try our NESTED JSON method.

    Kind regards.

    Thread Starter vipasane

    (@vipasane)

    Thank you for your quick and detailed response. Yes there are occasional errors in api while one is using short uri. Can I fake URL by providing a get parameter which ends xml since I really can’t make any changes to a 3rd party API?

    Any tutorial or idea of a plugin which could sync xml file separately and to be hosted in the very same wp instance? I would really like to keep this “code free” aka content creator friendly.

    Found this one but that requires paid version and adds complexity. starting to think that vanilla JS datatables with Ajax call + html is as good. Too bad these solutions are taking control off from content creators and they are still dependant on coders.

    • This reply was modified 2 years, 11 months ago by vipasane.
    Plugin Author wpDataTables

    (@wpdatatables)

    Hello.
    In regards to errors in API from the data source,
    i am sorry but we are not able to advise anything about that.

    The same goes for your question, you wrote :
     “Can I fake URL by providing a get parameter which ends xml since I really can’t make any changes to a 3rd party API?
    Our support does not cover workarounds on issues with API data sources.
    We can only advise you on issues coming from our plugin.

    In regards to a tutorial or idea of a plugin which could sync xml file separately and to be hosted in the very same wp instance,
    I’m afraid we are not able to advise you on that,
    we do not have experience with something like this.

    In regards to the tutorial you found from the WPGetAPI,
    we are not able to comment about their product.
    We see that in that tutorial they used our Lite/free version, as you can use the “Serialised PHP Array” in our Lite Version.
    If you meant to say that you need their premium product in order to achieve that use-case, we are sorry but we are not able to comment on that,
    since it is not our product.
    You can ask their support if they have any workaround that does not need their premium version.

    If you link the table to a JSON file, this file has to have structure as we pointed out on this documentation. I will copy the important part here :

    Currently, wpDataTables accepts this, and only this format of JSON (see example on the docs page):

    a one-level array of same-structured objects where each object will be parsed as a row, and each field inside of the object as a cell.

    If your software does not return this format, you would need to prepare, for example, some PHP adapter to return one of the formats that wpDataTables would accept.

    1. If your JSON file has multiple levels, then you will have to try our NESTED JSON method.
    2. If you wish to use API, and to pull data from it, then you will have to adapt it to PHP Array, and make a table linked to PHP Array.

    That is everything we can advise when it comes to connecting a data source from API with our plugin’s current capabilities.

    If you have an idea how we can improve this with a new option/ or improvement,
    please feel free to search on our suggestions page

     to see if someone may be already suggested this feature. If you can’t see it, feel free to add your suggestion there,  and as more people vote, the feature will move higher on the priority list.

    You can certainly follow our changeLog page if you’d like ( it is also available in the plugin dashboard), where we state any changes/new features/bug fixes during updates;

    and our newsletter, so you’re informed about new features, bug fixes, freebies, etc.


    Kind regards.


    • This reply was modified 2 years, 11 months ago by wpDataTables.
Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Dynamic XML source from API?’ is closed to new replies.