Dataverse Rust is a client library and command-line interface (CLI) for interacting with the Dataverse API. This project is in active development and not yet feature complete.
Current capabilities include:
- Create: Create a new collection within the Dataverse.
- Delete: Remove an existing collection.
- Publish: Publish a collection to make it publicly available.
- Contents: Retrieve the contents of a collection.
- Version: Retrieve the current version of the Dataverse instance.
- Get: Fetch details of a specific dataset.
- Create: Create a new dataset within a collection.
- Edit: Modify an existing dataset.
- Delete: Delete an unpublished dataset.
- Upload: Upload a file to a dataset.
- Publish: Publish a dataset to make it publicly available.
- Link: Link datasets to other collections.
- Replace: Replace existing files in a dataset.
Command line
cargo install --git https://github.com/JR-1991/rust-dataverse.git
Cargo.toml
Please note, this crate is not yet published on crates.io. You can add it to your Cargo.toml
file by pointing to the
GitHub repository.
[dependencies]
dataverse = { git = "https://github.com/JR-1991/rust-dataverse" }
Before you can use the command line tool, you need to set the DVCLI_URL
and DVCLI_TOKEN
environment variables. You
can do this by adding the following lines to your .bashrc
or .bash_profile
file:
export DVCLI_URL="https://your.dataverse.url"
export DVCLI_TOKEN="your_token_here"
The command line tool in organized in subcommands. To see a list of available subcommands, run:
dvcli --help
To see help for a specific subcommand, run:
dvcli <subcommand> --help
Example
In this examples we will demonstrate how to retrieve the version of the Dataverse instance.
dvcli info version
The output will be similar to:
Calling: http://localhost:8080/api/info/version
└── 🎉 Success! - Received the following response:
{
"version": "6.2"
}
We have provided an example in the examples
directory. These examples demonstrate how to use the client to perform
various operations.
examples/create-upload-publish
- Demonstrates how to create a collection, dataset, upload a file, and publish the collection and dataset.
- Implement remaining API endpoints
- Write unit and integration tests
- Asynchronous support using
tokio
- Documentation
- Publish on crates.io
- Continuous integration
- Validate before upload using
/api/dataverses/$ID/validateDatasetJson