Code Monkey home page Code Monkey logo

plugin-omekaapiimport's Introduction

Omeka API Import

Use Omeka 2.1's API to do an Omeka site-to-site import

Background

Omeka 2.1 introduced an API onto records, including Items, Collections, Elements, and more. Plugins can also add their records to the API. The API is located at youromekasite.org/api, and can be turned on under Admin->Settings->Api.

This plugin uses the API to import data from one Omeka site with an active API into another Omeka site.

Usage

Install the plugin in the usual way. Click the Omeka Api Import tab in the admin screen. Enter the API URL of the site from which you want to import data.

Optionally, enter the API key you have for the external Omeka site. This will have to be provided by an administrator of that site. If your key provides sufficient permissions, this will allow Users and non-public Items and Collections to be imported

Element Sets will be imported. If the external site has edited the comments for Elements, you can check the box to override the comments that exist in your site. This is only recommended if you are importing into an empty Omeka site.

As of version 1.2, includes a configuration option for whether to include User data in the import. Place this line in your Omeka installation's application/config/config.ini file

plugins.OmekaApiImport.importUsers = false;

Examples

For converting data from the API to CSV, look at OmekaApiToCsv and Omekadd

plugin-omekaapiimport's People

Contributors

patrickmj avatar zerocrates avatar daniel-km avatar caosborne89 avatar kalbers avatar

Stargazers

Kevin James O'Dea avatar Eric C. Weig avatar Michał Seweryniak avatar Julien Sicot avatar

Watchers

Jim Safley avatar Sean Takats avatar  avatar  avatar Sharon Leon avatar Sheila Brennan avatar James Cloos avatar Michał Seweryniak avatar  avatar Robin Fay  avatar Angela Dressen avatar  avatar Zach Francis avatar

plugin-omekaapiimport's Issues

Allow import by collection

Some users have reported a need to not import an entire site, but only items from one collection.

The Item adapter could probably be easily made to do this. There would be lots of side-effects to watch for, like whether exhibit imports break if items aren't there, whether user data imports okay, and more.

Don't continually try to import when no API key

Currently, the cycle of trying to import data (e.g., user data) continues every item iteration, even when it's already be established that there's no access.

That check should be done once, and not repeated with API calls for every item.

Updating items throws mysql error

Zend_Db_Statement_Mysqli_Exception: Mysqli statement execute error : Column 'html' cannot be null in /var/www/html/omeka2/application/libraries/Zend/Db/Statement/Mysqli.php:214
Stack trace:
#0 /var/www/html/omeka2/application/libraries/Zend/Db/Statement.php(303): Zend_Db_Statement_Mysqli->_execute(Array)
#1 /var/www/html/omeka2/application/libraries/Zend/Db/Adapter/Abstract.php(480): Zend_Db_Statement->execute(Array)
#2 /var/www/html/omeka2/application/libraries/Omeka/Db.php(79): Zend_Db_Adapter_Abstract->query('INSERT INTO `om...', Array)
#3 /var/www/html/omeka2/application/libraries/Omeka/Db.php(255): Omeka_Db->__call('query', Array)
#4 /var/www/html/omeka2/application/libraries/Omeka/Record/AbstractRecord.php(541): Omeka_Db->insert('omeka_element_t...', Array)
#5 /var/www/html/omeka2/application/models/Builder/Item.php(113): Omeka_Record_AbstractRecord->save()
#6 /var/www/html/omeka2/application/models/Builder/Item.php(245): Builder_Item->_replaceElementTexts()
#7 /var/www/html/omeka2/application/libraries/Omeka/Record/Builder/AbstractBuilder.php(66): Builder_Item->_beforeBuild(Object(Item))
#8 /var/www/html/omeka2/application/libraries/globals.php(589): Omeka_Record_Builder_AbstractBuilder->build()
#9 /var/www/html/omeka2/plugins/OmekaApiImport/libraries/ApiImport/ResponseAdapter/Omeka/ItemAdapter.php(16): update_item(Object(Item), Array, Array)
#10 /var/www/html/omeka2/plugins/OmekaApiImport/libraries/ApiImport/ImportJob/Omeka.php(94): ApiImport_ResponseAdapter_Omeka_ItemAdapter->import()
#11 /var/www/html/omeka2/plugins/OmekaApiImport/libraries/ApiImport/ImportJob/Omeka.php(32): ApiImport_ImportJob_Omeka->importRecords('items', Object(ApiImport_ResponseAdapter_Omeka_ItemAdapter))
#12 /var/www/html/omeka2/application/libraries/Omeka/Job/Process/Wrapper.php(29): ApiImport_ImportJob_Omeka->perform()
#13 /var/www/html/omeka2/application/scripts/background.php(61): Omeka_Job_Process_Wrapper->run(Array)
#14 {main}

Test updates

There have been some bugfixes and changes that call for a new round of testing this before release.

The major fix is to deal with problems when the origin Omeka site has Dublin Core Extended, with elements reordered. So, for example, moving one of the extended elements up to the position held by one of the usual DC elements, like Title or Subject. That's without checking the box to overwrite elements. Trying to break the import with lots of that kind of reordering is the biggest mission. After that, it's just doing a bunch of imports from different sites to make sure that that bugfix didn't inadvertently break something else I haven't caught yet.

Use master branch of OmekaApiImport, and probably latest of Omeka (though that shouldn't make a difference).

Was able to run on dev server, but not production.

Set up exactly the same as I did on development server, but does not work in production.

I get the following errors:
[sklein]$ ./OmekaApiToCsv.php
./OmekaApiToCsv.php: line 1: ?php: No such file or directory
./OmekaApiToCsv.php: line 3: syntax error near unexpected token 'OMEKA_ENDPOINT',' ./OmekaApiToCsv.php: line 3:define('OMEKA_ENDPOINT', 'http://mywebsite.edu/legacy/api');'

any idea?

Notices on import

Notice: Undefined variable: recordType in /var/www/Omeka/plugins/OmekaApiImport/libraries/ApiImport/ResponseAdapter/AbstractRecordAdapter.php on line 36

Seems like one of those newly-visible things with 2.5

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.