EveryCRT:Data API: Difference between revisions

Fix rendering: replace syntaxhighlight (extension not installed) with pre, drop missing TOC right template, inline the manifest viewer (REST API can't reach subpages) (via update-page on MediaWiki MCP Server)
Fix all api.php URLs: $wgScriptPath is '' on this wiki, so api.php is at the document root, not /w/ (via update-page on MediaWiki MCP Server)
 
Line 6: Line 6:


No authentication is required. All data is publicly readable.
No authentication is required. All data is publicly readable.
== URL layout ==
This wiki uses two URL paths:
* '''Articles''' live at <code>/wiki/PageName</code> (e.g. <code>https://wiki.everycrt.com/wiki/Sony_KV-20FV300</code>).
* '''Scripts''' live at the document root: <code>/api.php</code>, <code>/rest.php</code>, <code>/index.php</code>, <code>/load.php</code>. The Action API is at <code>https://wiki.everycrt.com/api.php</code> — not <code>/w/api.php</code> as on Wikipedia.


== Sync pattern ==
== Sync pattern ==
Line 22: Line 29:
'''Programmatic fetch (recommended):'''
'''Programmatic fetch (recommended):'''


<pre>GET https://wiki.everycrt.com/w/api.php?action=expandtemplates&text=%7B%7B%23invoke%3ADataAPIManifest%7Cjson%7D%7D&prop=wikitext&format=json&formatversion=2</pre>
<pre>GET https://wiki.everycrt.com/api.php?action=expandtemplates&text=%7B%7B%23invoke%3ADataAPIManifest%7Cjson%7D%7D&prop=wikitext&format=json&formatversion=2</pre>


The response wraps the manifest in <code>expandtemplates.wikitext</code> as a string; parse that string as JSON:
The response wraps the manifest in <code>expandtemplates.wikitext</code> as a string; parse that string as JSON:


<pre>
<pre>
const url = 'https://wiki.everycrt.com/w/api.php'
const url = 'https://wiki.everycrt.com/api.php'
   + '?action=expandtemplates'
   + '?action=expandtemplates'
   + '&text=%7B%7B%23invoke%3ADataAPIManifest%7Cjson%7D%7D'
   + '&text=%7B%7B%23invoke%3ADataAPIManifest%7Cjson%7D%7D'
Line 47: Line 54:
Use Semantic MediaWiki's <code>action=ask</code> endpoint to enumerate pages of a given entity type. The manifest's <code>list_url</code> for each entity type does exactly this — returning every page with its <code>Modification date</code>, which is what you want for indexing and for driving incremental sync:
Use Semantic MediaWiki's <code>action=ask</code> endpoint to enumerate pages of a given entity type. The manifest's <code>list_url</code> for each entity type does exactly this — returning every page with its <code>Modification date</code>, which is what you want for indexing and for driving incremental sync:


<pre>GET https://wiki.everycrt.com/w/api.php?action=ask&format=json&formatversion=2&query=[[Category:CRT models]]|?Modification date|limit=500</pre>
<pre>GET https://wiki.everycrt.com/api.php?action=ask&format=json&formatversion=2&query=[[Category:CRT models]]|?Modification date|limit=500</pre>


The query supports any SMW ask syntax — additional printouts, filters, ordering, etc.
The query supports any SMW ask syntax — additional printouts, filters, ordering, etc.
Line 56: Line 63:
'''Example — all Sony CRT models with screen size and release year:'''
'''Example — all Sony CRT models with screen size and release year:'''


<pre>GET https://wiki.everycrt.com/w/api.php?action=ask&format=json&query=[[Category:CRT models]][[Has brand::Sony]]|?Has screen size inches|?Has release year|limit=500</pre>
<pre>GET https://wiki.everycrt.com/api.php?action=ask&format=json&query=[[Category:CRT models]][[Has brand::Sony]]|?Has screen size inches|?Has release year|limit=500</pre>


For interactive query development, use [[Special:Ask]].
For interactive query development, use [[Special:Ask]].
Line 64: Line 71:
For a single page, the <code>action=browsebysubject</code> endpoint returns ''every'' SMW fact known about it — including subobjects (CRT inputs, outputs, voltage ranges, etc.):
For a single page, the <code>action=browsebysubject</code> endpoint returns ''every'' SMW fact known about it — including subobjects (CRT inputs, outputs, voltage ranges, etc.):


<pre>GET https://wiki.everycrt.com/w/api.php?action=browsebysubject&format=json&formatversion=2&subject=Sony_KV-20FV300</pre>
<pre>GET https://wiki.everycrt.com/api.php?action=browsebysubject&format=json&formatversion=2&subject=Sony_KV-20FV300</pre>


This is the right endpoint for "give me everything you know about this entity" — no need to enumerate properties up front. New properties added to the wiki are automatically included in the response.
This is the right endpoint for "give me everything you know about this entity" — no need to enumerate properties up front. New properties added to the wiki are automatically included in the response.
Line 76: Line 83:
For incremental sync, poll <code>action=query&list=recentchanges</code> filtered by a timestamp. The standard MediaWiki [[Special:RecentChanges]] view is the human-readable equivalent:
For incremental sync, poll <code>action=query&list=recentchanges</code> filtered by a timestamp. The standard MediaWiki [[Special:RecentChanges]] view is the human-readable equivalent:


<pre>GET https://wiki.everycrt.com/w/api.php?action=query&list=recentchanges&format=json&formatversion=2&rcprop=title|timestamp|ids|sizes|user&rclimit=500&rcend=2026-05-01T00:00:00Z</pre>
<pre>GET https://wiki.everycrt.com/api.php?action=query&list=recentchanges&format=json&formatversion=2&rcprop=title|timestamp|ids|sizes|user&rclimit=500&rcend=2026-05-01T00:00:00Z</pre>


A typical sync loop:
A typical sync loop:
Line 87: Line 94:
To filter to specific namespaces, add <code>&rcnamespace=0|3000</code> (main + Document, for example). Namespace IDs are listed via:
To filter to specific namespaces, add <code>&rcnamespace=0|3000</code> (main + Document, for example). Namespace IDs are listed via:


<pre>GET https://wiki.everycrt.com/w/api.php?action=query&meta=siteinfo&siprop=namespaces&format=json&formatversion=2</pre>
<pre>GET https://wiki.everycrt.com/api.php?action=query&meta=siteinfo&siprop=namespaces&format=json&formatversion=2</pre>


== RDF export ==
== RDF export ==
MediaWiki Appliance - Powered by TurnKey Linux