I know why you're here, Neo. I know what you've been doing... why you hardly sleep, why you live alone, and why night after night, you sit by your computer.
PmWiki /
EditingAPI
This page documents the API for modifying PmWiki pages via the wiki engine (i.e. via Sending a request to write to a pageThe following fields may occur in a request to write to a wiki page.
Summarizing the requirements to post an update to a page. Writing a page to the wiki via the wiki engine, i.e. via
The two fields Additional fields such as If the page is password protected, the browser must either have been previously authenticated (via a PHP session cookie) or otherwise send the appropriate credentials to allow edit access to the page. Normally the credentials are given by the 'authpw' and 'authid' fields:
Simultaneous edits are handled by the field ' When the form is submitted, if the last modification time of the page is greater than the basetime in the form, we know that the page changed somehow after the author requested the edit form. (The basetime also tells PmWiki which version of the page was "current" when the edit form was requested, so it can figure out how to merge the changes together.) If a page is changed after a form's basetime, then instead of saving the page PmWiki sends back a new edit form with any merged changes and a note to the author to review the page for conflicts and submit again. I think this "note" should be accompanied with something that's well
specified, so as to make it easier for an external script to handle
this situation. /Christian
If a client sends a post request that doesn't include a ' A successful request to save a page generally results in a 302 HTTP response, telling the browser to view the (newly saved) page. If a request to save a page fails, generally PmWiki returns a new edit form along with messages indicating why the page could not be saved. I think some formal method is needed to report that a save has been
blocked. The reason for the block might be a requirement for an author
name, or that blocklist don't like it. There should be an API to detect
this in any case. /Christian
Christian's questions:
Sending a request to upload a file to a pageThe following fields may occur in a request to upload a file attachment to a wiki page.
Real-world examplesUsing curlUsing curl to create a wiki page one would: curl -d "?n=Main.WikiSandbox&text=TestingWiki&action=edit&post=1&author=AuthorName" http://localhost/pmwiki.php/Main/WikiSandbox Note: the value for 'text' is assumed to already be urlencoded e.g. %20 for space. Using curl to upload a file called testing.txt to the SandBox page one would: curl -F n=Main.WikiSandbox -F action=postupload -F uploadfile=@/c/testing.txt -F upname=alt-name.txt http://localhost/pmwiki.php/Main/WikiSandbox Note: The AT (@) character before the file is required. Notification of problemsIn response to a post by Christian, Patrick wrote on 2006-03-09
Sure, I can probably add that somewhere -- likely a comment in the <head>
section.
The other thing to look for is that a successful post always results in a
redirect (i.e., status 302 or 301 or something), while an unsuccessful
post results in a 200.
Christian's comment:
Timo's comment:
Accessing a password protected pageFrom Patrick in post on the PmWiki user's list on 2007-06-28. > If you're using curl as a command-line tool, try the -d option: > > curl -d authpw=banana http://my.wiki.org/ProtectedGroup.DataPage > > This generates a POST request for the page, exactly as if someone > had filled in the authorization form. ContributorsCategories: PmWiki Developer
This page may have a more recent version on pmwiki.org: PmWiki:EditingAPI, and a talk page: PmWiki:EditingAPI-Talk. |