ProfessionalWiki / PersistentPageIdentifiers

MediaWiki extension that adds persistent identifiers to wiki pages
https://professional.wiki/en/extension/persistent-page-identifiers
GNU General Public License v2.0
1 stars 0 forks source link

Add persistent ids REST API #44

Closed malberts closed 6 days ago

malberts commented 6 days ago

Closes #34 Replaces #36

Instead of hacking the core QueryInfo API, just add a simple REST API.

Example: GET http://localhost:8484/rest.php/persistent-page-identifiers/v0/pages?ids=1|2|3|404

{
  "1": null,
  "2": "0193318b-43c6-701a-92b1-206b7f951c68"
}

(1 has no id, 2 has an id, 3 was deleted, 404 does not exist)

JeroenDeDauw commented 6 days ago

Some Claude suggestions:

{
  "identifiers": {
    "1": null,
    "2": "0193318b-43c6-701a-92b1-206b7f951c68"
  },
  "meta": {
    "count": 3,
    "limit": 100
  }
}

I don't see much value in the meta part of the later suggestion, though wrapping the ID list in identifiers

malberts commented 6 days ago

v1

Done.

Use commas instead of pipes for array parameters (more REST-like)

Pipe is the MediaWiki way. Unfortunately, it's also hardcoded. Using it allows the API to understand the param is an array and it can validate the individual values as integers. Otherwise we need to change the param to a single string and then do the splitting and validation ourselves.

meta

That'll be more useful if there's batching involved. Otherwise the user can just do a count.

wrapping the ID list in identifiers

Done.