-
Notifications
You must be signed in to change notification settings - Fork 21
CLI
Benjamin Kiah Stroud edited this page Dec 2, 2021
·
3 revisions
Bulkrax has a CLI for creating and updating Importers. The CLI uses the JSON API.
The bulkrax install generator (rails g bulkrax:install
) adds two files to the local application. Both files are required for the CLI.
- bin/importer
- config/bulkrax_api.yml
Authorization for the JSON API is via a token. The application should set the token as an environment variable called BULKRAX_API_TOKEN.
The CLI passes the token to the API in an option called --auth_token. This is required.
Use the following command to view help for the CLI.
> bin/importer --help
bin/importer --name "My Import"
--parser_klass Bulkrax::CsvParser
--commit "Create and Import"
--import_file_path /data/tmp/import.csv
--auth_token 12345
bin/importer --importer_id 1
--commit "Update and Re-Import (update metadata only)"
--import_file_path /data/tmp/import.csv
--auth_token 12345
- ID for the Importer to Update
- required: Update Only
- Name for the Importer
- required: Create Only
- AdminSet ID
- Supply a URI from the application rights statements
- valid_values: rights statements returned by
Hyrax.config.rights_statement_service_class.new.select_active_options
- Override any existing rights statements: 1 for yes | 0 for no
- valid_values:
- 0
- 1
- Path to the import file - required for CSV and BagIt only
- required: for Bulkrax::BagitParser and Bulkrax::CsvParser
- Filename used for metadata files - required for BagIt only
- required: for Bulkrax::BagitParser Create Only
- RDF or CSV - required for BagIt only
- required: for Bulkrax::BagitParser Create Only
- valid_values:
- Bulkrax::RdfEntry
- Bulkrax::CsvEntry
- The OAI setSpec - required for OAI only
- required: for Bulkrax::OaiParser Create Only
- The OAI setName - required for required for OAI only
- required: for Bulkrax::OaiParser Create Only
- Parser name eg. Bulkrax::CsvParser
- required: Create Only
- valid_values: parsers configured in config/initializers/bulkrax.rb
- Number of records to import; blank for all
- ISO 8601 Durations Daily; Monthly; Yearly; Once (on save)
- valid_values:
- P1D
- P1M
- P1Y
- PT0S
- See bulkrax/lib/bulkrax.rb for further information
- ID of the User creating the Importer
- Base URL for the Endpoint - required for OAI Only
- required: for Bulkrax::OaiParser Create Only
- Commit Message. Bulkrax uses commit messages to decide what action to take.
- required: true
- valid_values:
- Create
- Create and Import
- Update Importer
- Update and Re-Import (update metadata and replace files)
- Update and Harvest Updated Items
- Update and Re-Harvest All Items
- Update and Re-Import (update metadata only)
- Update and Import (importer has not yet been run)
- Authentication token. Required for JSON requests only.
- required: true
- Port to use in http request. Defaults to 80. May need to set to 3000 when running in the development environment