Page MenuHomePhabricator

Minimal prototype for the Commons recon service
Closed, ResolvedPublic

Description

We should have a minimal recon service which conforms to the specs of the protocol: https://reconciliation-api.github.io/specs/latest/

  • Returns a service manifest when no query is supplied (per the protocol)
  • Responds to reconciliation queries. For instance, given the following batch:
{"q1":{"query":"File:My_wonderful_image.png"},"q2":{"query":"File:My_other_image.jpg"}}

The service should reply something like:

{"q1":{"result":[{"id":"M1234", "name": "My_wonderful_image.png"}]}, "q2":{"result":[]}}}

It should be possible to test the service with OpenRefine or the reconciliation testbench: https://reconciliation-api.github.io/testbench/

Event Timeline

Other things the service should do:

  • when the root path is requested (/), serve a description of the service as an HTML page
  • when the root API endpoint is requested (such as /api, or /en/api if we want to make it language-dependent), the JSON manifest is served

Here are some sample queries (formulated as curl commands) with the associated expected responses, following the reconciliation protocol specifications. In those examples I am assuming that the service runs at http://localhost:8000/ and that the reconciliation endpoint is http://localhost:8000/en/api.

Sending a query via GET

Query:

curl 'http://localhost:8000/en/api?queries=%7B%22q0%22%3A%7B%22query%22%3A%22Chick+Corea+%26+Stanley+Clarke.jpg%22%7D%7D

Response:

{"q0":{"result":[{"id":"M74698470", "name": "Chick Corea & Stanley Clarke.jpg"}]}}

Sending a reconciliation query via POST

Query:

curl 'http://localhost:8000/en/api' --data 'queries=%7B%22q0%22%3A%7B%22query%22%3A%22Chick+Corea+%26+Stanley+Clarke.jpg%22%7D%7D'

Response:

{"q0":{"result":[{"id":"M74698470", "name": "Chick Corea & Stanley Clarke.jpg"}]}}

Sending a query for a filename which does not exist

Query:

curl 'http://localhost:8000/en/api?queries=%7B%22q0%22%3A%7B%22query%22%3A%22this+filename+does+not+exist+on+commons+at+all.jpg%22%7D%7D

Response:

{"q0":{"result":[]}}

@Eugene233 once you have deployed the latest changes to Toolforge, I think this ticket can probably be closed! It would be worth checking with https://reconciliation-api.github.io/testbench/ that the service works as expected before closing this, I guess.