Jump to content

API: Difference between revisions

From Meta, a Wikimedia project coordination wiki
Content deleted Content added
Jacobolus (talk | contribs)
Jacobolus (talk | contribs)
→‎Wikimania API discussion: clean up formatting, a few changes
Line 25: Line 25:
==Wikimania API discussion==
==Wikimania API discussion==
[[Image:Wikimedia hacking days 2006 API discussion whiteboard.jpeg|thumb|The whiteboard these notes were taken from]]
[[Image:Wikimedia hacking days 2006 API discussion whiteboard.jpeg|thumb|The whiteboard these notes were taken from]]
A simple-as-possible API was quickly designed at the Wikimania Hacking Days on 4 August 2006. This minimal API only supports the most essential functions, with the goal of allowing a quick implementation, with other functionality (moving pages, uploading images, etc.) to be specified once a basic API has been implemented.
===Basic needs===
* login
** in: username, passwd, [[API key]]
** out: success or auth failure or temp failure


===Essential functions===
Dates need to be in UTC
Dates need to be ISO 8601
Date = 0 means current revision


; login
* readrevision
: in: username, password, (API key)
** out: -return speacial:Export and preferably metadata about redirect
: out: success, authentication failure, or temporary failure
** in: - article title or revision ID or page ID


; read revision
* readhistory
: in: article title, revision ID, or page ID
** in: artile title or pageID, rangestart, +- limit <br> range can be, ISO date or timestamp, if negative rangestart, fetch last rangestartrevisions bounded by a maximum amount of revisions: currently: 5000 <br> always return up to 5000 revisions
: out: A format mostly identical to the current special:export, but also including some metadata about whether the page is a redirect, and the page to redirect to, so that the client does not need to parse the wikitext
** out: export xml metadata (see readrevision)



* writeArticle
; read history
** in: lastRevisionID or 0, pagetext, pagetitle, comment, minor
: in: article title or page ID, range start, +- limit
** out: success(versionID), edit conflict fail, permission failure, temp failure
:: range can be ISO date or revision ID. if negative rangestart, fetch last limit revisions bounded by some maximum of revisions: currently 5000
::always return up to 5000 revisions
: out: export xml metadata (see readrevision)

; write article
: in: lastRevisionID or 0, pagetext, pagetitle, comment, minor
: out: success(versionID), edit conflict fail, permission failure, temp failure

==== Notes ====
; Date format
: UTC only, [[w:ISO 8601|ISO 8601]]
: Date = 0 means the current revision

Revision as of 17:07, 4 August 2006

I was not able to find a list of suggested API functions for retrieving Information via SOAP/WHATEVER. If you find one that already exists, please delete this page. If you consider meta inappropriete for this kind of page, please delete it. Or move it to my user name subpage. If you feel offended by the pseudo-syntax or naming of these functions, alter them unless they are beyond repair. Thanks.

Data Retrieval

Articles

article_mw ( string lemma )

article_mw() returns a single article from a wiki in the original Mediawiki syntax

article_xml ( string lemma )

article_xml returns a single article from a wiki in xml output

article_section_mw ( string lemma, int section)

returns a single section from a single article from a wiki in the original mediawiki syntax. section is the same as section in the edit option

Search

  • list of articles that contain string query
  • size of an article (chars, bytes, words)
  • list of authors of an article (ugly to compute when it comes to articles with 1000+ revisions)

Wikimania API discussion

The whiteboard these notes were taken from

A simple-as-possible API was quickly designed at the Wikimania Hacking Days on 4 August 2006. This minimal API only supports the most essential functions, with the goal of allowing a quick implementation, with other functionality (moving pages, uploading images, etc.) to be specified once a basic API has been implemented.

Essential functions

login
in: username, password, (API key)
out: success, authentication failure, or temporary failure
read revision
in: article title, revision ID, or page ID
out: A format mostly identical to the current special:export, but also including some metadata about whether the page is a redirect, and the page to redirect to, so that the client does not need to parse the wikitext


read history
in: article title or page ID, range start, +- limit
range can be ISO date or revision ID. if negative rangestart, fetch last limit revisions bounded by some maximum of revisions: currently 5000
always return up to 5000 revisions
out: export xml metadata (see readrevision)
write article
in: lastRevisionID or 0, pagetext, pagetitle, comment, minor
out: success(versionID), edit conflict fail, permission failure, temp failure

Notes

Date format
UTC only, ISO 8601
Date = 0 means the current revision