WikibaseImport
WikibaseImport copied to clipboard
Access from the API
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 sounds like a good idea :)
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?