Difference between revisions of "User:Rcdeboer/COPTR data feed"

From COPTR
Jump to navigation Jump to search
(Created page with "= Accessing the COPTR data = Question: *I'd like to take the data in COPTR and create a funky 3D spinny view that helps people navigate the data and find what they are lookin...")
 
Line 12: Line 12:
  
 
== The COPTR API ==
 
== The COPTR API ==
As COPTR is based on MediaWiki, you can access the COPTR content via the MediaWiki API. The [https://www.mediawiki.org/wiki/API:Main_page Official MediaWiki API Documentation] is a pretty good starting point, and [http://coptr.digipres.org/api.php the endpoint itself is ''fairly'' self-documenting]. However, to help get you started, here are a couple of examples.
+
As COPTR is based on MediaWiki, you can access the COPTR content via the MediaWiki API. The [https://www.mediawiki.org/wiki/API:Main_page Official MediaWiki API Documentation] is a pretty good starting point, and [http://coptr.digipres.org/api.php the endpoint itself is ''fairly'' self-documenting]. You can also use the [[Special:ApiSandbox|API sandbox]] to experiment with the API. However, to help get you started, here are a couple of examples.
  
 
=== Machine-Readable Recent Changes ===
 
=== Machine-Readable Recent Changes ===

Revision as of 07:29, 26 May 2021

Accessing the COPTR data

Question:

  • I'd like to take the data in COPTR and create a funky 3D spinny view that helps people navigate the data and find what they are looking for. Can I do this, and can I host it somewhere else?

Answer:

  • Yes, that would be excellent! The COPTR content is made available under a CC-BY-SA license but we ask that if possible you point your users back to this site if they have corrections or new tools to add.

Ways to access the COPTR data

We offer two main channels for accessing the data - the MediaWiki API, and XML dumps of the MediaWiki content.

The COPTR API

As COPTR is based on MediaWiki, you can access the COPTR content via the MediaWiki API. The Official MediaWiki API Documentation is a pretty good starting point, and the endpoint itself is fairly self-documenting. You can also use the API sandbox to experiment with the API. However, to help get you started, here are a couple of examples.

Machine-Readable Recent Changes

If you want access to information on what has changed recently, just like the RecentChanges page, but in a machine-readable form, you can construct a URL like this:

http://coptr.digipres.org/api.php?action=query&list=recentchanges&format=json&rclimit=500&rctype=new&rcprop=title%7Cids%7Csizes%7Cflags%7Cuser%7Ctimestamp

Breaking down those query parameters, we have:

Parameter Value Meaning
action query Perform a query action, rather than e.g. adding or editing a page.
list recentchanges Perform a query on the 'recent changes' list (one of many lists available).
format json Return the results in JSON format.
rclimit 500 Return up to 500 results at once (500 is the maximum per request, but there are other parameters for paging).
rctype new Return only 'new page' events.
rcprop title|ids|sizes|flags|user|timestamp For each event, return these fields (see the API docs for more detail).

So, for example, if you would rather receive XML, you can just modify the format parameter.

Category Members

There is also a Category Members list you can query. For example:

The COPTR Database Backup Dumps

We also make daily XML dumps available, for backup and re-use purposes. You can find them in the backup-dumps folder,