<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://openjournal.wiki/index.php?action=history&amp;feed=atom&amp;title=OpenJournal%3AAPI</id>
	<title>OpenJournal:API - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://openjournal.wiki/index.php?action=history&amp;feed=atom&amp;title=OpenJournal%3AAPI"/>
	<link rel="alternate" type="text/html" href="https://openjournal.wiki/index.php?title=OpenJournal:API&amp;action=history"/>
	<updated>2026-09-11T00:24:01Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.9</generator>
	<entry>
		<id>https://openjournal.wiki/index.php?title=OpenJournal:API&amp;diff=19&amp;oldid=prev</id>
		<title>OpenJournalAdmin: API documentation</title>
		<link rel="alternate" type="text/html" href="https://openjournal.wiki/index.php?title=OpenJournal:API&amp;diff=19&amp;oldid=prev"/>
		<updated>2026-09-10T19:58:28Z</updated>

		<summary type="html">&lt;p&gt;API documentation&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;openjournal is MediaWiki, so it has MediaWiki&amp;#039;s APIs — nothing here is bespoke, and&lt;br /&gt;
anything true of the [https://www.mediawiki.org/wiki/API:Main_page MediaWiki API] is&lt;br /&gt;
true here.&lt;br /&gt;
&lt;br /&gt;
Cross-origin reads are allowed, so you can call these straight from a browser — but&lt;br /&gt;
MediaWiki only sends the CORS headers when you ask for them, so add&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;&amp;lt;code&amp;gt;&amp;amp;origin=*&amp;lt;/code&amp;gt;&amp;#039;&amp;#039;&amp;#039; to any &amp;lt;code&amp;gt;api.php&amp;lt;/code&amp;gt; request you make from&lt;br /&gt;
another site. &amp;lt;code&amp;gt;rest.php&amp;lt;/code&amp;gt; needs no such parameter.&lt;br /&gt;
&lt;br /&gt;
Articles are subpages of their author: &amp;#039;&amp;#039;&amp;#039;&amp;lt;code&amp;gt;User:Alice/Some title&amp;lt;/code&amp;gt;&amp;#039;&amp;#039;&amp;#039;. That&lt;br /&gt;
means &amp;quot;everything Alice wrote&amp;quot; is a title-prefix query.&lt;br /&gt;
&lt;br /&gt;
== The friendly routes ==&lt;br /&gt;
&lt;br /&gt;
For the common case -- get someone&amp;#039;s posts, get one post -- these read better than&lt;br /&gt;
the MediaWiki API underneath them, which is all they are: Apache rewrite rules onto&lt;br /&gt;
the exact same &amp;lt;code&amp;gt;api.php&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;action=render&amp;lt;/code&amp;gt; this page&lt;br /&gt;
documents further down, not a second API to keep in sync.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
GET /users/{username}/posts                     all of a user&amp;#039;s posts, alphabetical by title&lt;br /&gt;
GET /users/{username}/posts/{title}              one post: title, wikitext, last-edited time&lt;br /&gt;
GET /users/{username}/posts/{title}?format=html  the same post, rendered to HTML&lt;br /&gt;
GET /users/{username}                            redirects to their journal (browsable)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;{title}&amp;lt;/code&amp;gt; is the part after the slash, with spaces as underscores, e.g.&lt;br /&gt;
&amp;lt;code&amp;gt;/users/Alice/posts/Laying_a_hedge&amp;lt;/code&amp;gt; for&lt;br /&gt;
&amp;lt;code&amp;gt;User:Alice/Laying a hedge&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
A post that doesn&amp;#039;t exist behaves differently depending on the format: with&lt;br /&gt;
&amp;lt;code&amp;gt;?format=html&amp;lt;/code&amp;gt; you get a real &amp;lt;code&amp;gt;404&amp;lt;/code&amp;gt;. Without it -- the default,&lt;br /&gt;
plain JSON -- you always get &amp;lt;code&amp;gt;200&amp;lt;/code&amp;gt;, with &amp;lt;code&amp;gt;&amp;quot;missing&amp;quot;:true&amp;lt;/code&amp;gt; in the&lt;br /&gt;
body instead. That form is calling &amp;lt;code&amp;gt;api.php&amp;lt;/code&amp;gt; underneath, and there is no&lt;br /&gt;
way to make MediaWiki&amp;#039;s own API answer with a different HTTP status without writing&lt;br /&gt;
code, which&lt;br /&gt;
this project avoids. Check &amp;lt;code&amp;gt;missing&amp;lt;/code&amp;gt; if that matters to you.&lt;br /&gt;
&lt;br /&gt;
== All articles by one user (the underlying MediaWiki call) ==&lt;br /&gt;
&lt;br /&gt;
Same data the &amp;lt;code&amp;gt;/users/{username}/posts&amp;lt;/code&amp;gt; route above returns, and where&lt;br /&gt;
its extra parameters -- excerpts, URLs -- come from, if you want to add your own.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
GET /api.php?action=query&amp;amp;list=allpages&amp;amp;apnamespace=2&amp;amp;apprefix=Alice/&amp;amp;format=json&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== One article, as HTML ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
GET /rest.php/v1/page/User%3AAlice%2FSome_title/html&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== One article, as source ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
GET /rest.php/v1/page/User%3AAlice%2FSome_title&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Every article on the site, newest first ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
GET /api.php?action=query&amp;amp;generator=recentchanges&amp;amp;grcnamespace=2&amp;amp;grclimit=30&amp;amp;format=json&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Excerpts and lead images, for a card or a feed ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
GET /api.php?action=query&amp;amp;prop=extracts|pageimages&amp;amp;exchars=300&amp;amp;explaintext=1&amp;amp;titles=User:Alice/Some_title&amp;amp;format=json&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== An Atom feed of everything ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
GET /index.php?title=Special:RecentChanges&amp;amp;feed=atom&amp;amp;namespace=2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
One author&amp;#039;s feed is the same URL narrowed with &amp;lt;code&amp;gt;&amp;amp;tagfilter=&amp;lt;/code&amp;gt; or, more&lt;br /&gt;
simply, poll &amp;lt;code&amp;gt;list=allpages&amp;lt;/code&amp;gt; above.&lt;br /&gt;
&lt;br /&gt;
== Writing from your own code ==&lt;br /&gt;
&lt;br /&gt;
Editing over the API uses the same login you use in the browser, which is Wikimedia&lt;br /&gt;
OAuth — so a script writes by acting as you through an&lt;br /&gt;
[https://meta.wikimedia.org/wiki/Special:OAuthConsumerRegistration owner-only OAuth&lt;br /&gt;
consumer], not by sending a password. Bot passwords are switched off here for the&lt;br /&gt;
same reason.&lt;br /&gt;
&lt;br /&gt;
See [[OpenJournal:API/Recipes]] for worked examples, or the full parameter reference&lt;br /&gt;
at [[Special:ApiHelp/query]] — it is generated from this wiki&amp;#039;s own installed modules,&lt;br /&gt;
so it is never out of date.&lt;/div&gt;</summary>
		<author><name>OpenJournalAdmin</name></author>
	</entry>
</feed>