New Foswiki release 2.1.6 is available with important security fixes.
Sourceforge foswiki email lists being discontinued. Subscribe to the new Foswiki announce and discuss lists at MailingLists
This question about Using an extension, Documentation, Developing extensions (plugins skins etc.), Topic Markup Language and applications, Not sure...: Asked

API: python pass url of page and get last update timestamp

Hi Devs,

I'm trying to explore FOSwiki API where if I pass url of FosWiki page to my Python/Java code, it should return me Datetimestamp when the page was last time updates.

I tried searching code in Git, most of code is in Perl and not sure if there's a way to get expected timestamp.

Any help will be appreciated.



There is not to my knowledge a pre-defined api for getting a topic date stamp, however you can create one by defining a simple SkinTemplate and adding a template url parameter to you the url sent from your Python/Java code. The template merely contains a simple search that returns the date & time of the most recent edit of the base topic:
%SEARCH{".*" type="regex" nonoise="on" topic="%BASETOPIC%" format="$date"}%

If it would surfice to retrieve the "epoch" format time stamp (number of seconds since 1st Jan 1970) of the last change (which is how Foswiki stores this info), you could use the simplier syntax of QuerySearch like this:

I've created an example view template at DateViewTemplate to demonstrate both formats. Here's the example url to invoke that template for this topic: (click to view result).

If your code is being executed on the same machine, you could possibly use command line to call view script. I have used this in bash scripts. In this case, the command would look something like this:
cd /usr/local/foswiki/bin; ./view topic=Web.Topic template=Sandbox.DateViewTemplate

I hope this answers your question or suggests some things to try.

-- Main.LynnwoodBrown - 26 Jun 2018 - 16:36

Thanks Lynnwood.

Let me try your recommendation and will let you know the results.

QuestionForm edit

Subject Using an extension, Documentation, Developing extensions (plugins skins etc.), Topic Markup Language and applications, Not sure...
Version Foswiki 2.1.2
Status Asked
Related Topics
Topic revision: r3 - 27 Jun 2018, AbhishekTripathi - This page was cached on 20 Sep 2018 - 19:46.

The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy