WikibaseImport icon indicating copy to clipboard operation
WikibaseImport copied to clipboard

Access from the API

Open agarciagan opened this issue 9 years ago • 2 comments

I am working on a project where we need to allow users to import entities from wikidata into their own Wikibase installation. I have developed a simple extension to publish this service as an API and executing the importing action calling to WikibaseImport, and returning the result.

Would it be possible to integrate this service on the WikibaseImport extension?

Example API call: action=importentity&token=%2B%5C&item=Q587&format=json

Example results:

New local entity { "new": "true", "ok": "true", "remoteId": "Q587", "localId": "Q134" }

Entity already imported { "new": "false", "ok": "true", "remoteId": "Q5", "localId": "Q22" }

Error: { "error": "true", "message": "The serialization 'gfQ587' is not recognized by the configured id builders" }

agarciagan avatar Jun 14 '16 15:06 agarciagan

@agarciagan sounds like a good idea :)

filbertkm avatar Jun 17 '16 19:06 filbertkm

Hi, In order to alIow to import an entity from the API, I have overwritten the execute method of importEntities.php to do an echo of a json object with the status of the operation, the remoteId, the locaId, error message, and a flag to show if the entity is new or it was already at the local wikibase. If an entity has been previously imported, it is not imported again. Then I have created a simple extension that accepts and action (import-entity) and a wikidata entity id. This extension directly call the WikibaseImport extension using a php exec command. The extension captures the echoed json object and returns it. Do you think this approach could be integrated?

agarciagan avatar Jun 20 '16 14:06 agarciagan