This project presents a Flask-based API for validating RO-Crates.
POST
v1/ro_crates/{crate_id}/validation
(Request validation of RO-Crate validation in Object Store)
name | type | data type | description |
---|---|---|---|
crate_id | required | string | RO-Crate identifer string |
name | type | data type | description |
---|---|---|---|
root_path | optional | string | Root path which contains the RO-Crate |
webhook_url | optional | string | Webhook to send validation result to |
minio_config | required | dictionary | MinIO Configuration Details |
minio_config
name type data type description endpoint required string MinIO endpoint accesskey required string MinIO access key or username secret required string MinIO secret or password ssl required boolean Use SSL encryption for MinIO access? bucket required string MinIO bucket containing RO-Crate
http code | content-type | response |
---|---|---|
202 |
application/json |
{"message": "Validation in progress"} |
400 |
application/json |
{"message": "No RO-Crate with prefix: <crate_id>"} |
500 |
application/json |
{"message": "Internal server errors"} |
curl -X 'POST' \
'http://localhost:5001/v1/ro_crates/<crate_id>/validation' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-d '{
"minio_config": {
"accesskey": "<key>",
"bucket": "ro-crates",
"endpoint": "minio:9000",
"secret": "<secret>",
"ssl": false
},
"profile_name": "<profile>",
"webhook_url": "<webhook>"
}'
GET
v1/ro_crates/{crate_id}/validation
(Obtain RO-Crate validation result from Object Store)
name | type | data type | description |
---|---|---|---|
crate_id | required | string | RO-Crate identifer string |
name | type | data type | description |
---|---|---|---|
root_path | optional | string | Root path which contains the RO-Crate |
minio_config | required | dictionary | MinIO Configuration Details |
minio_config
name type data type description endpoint required string MinIO endpoint accesskey required string MinIO access key or username secret required string MinIO secret or password ssl required boolean Use SSL encryption for MinIO access? bucket required string MinIO bucket containing RO-Crate
http code | content-type | response |
---|---|---|
200 |
application/json |
Successful Validation |
422 |
application/json |
Error: Details of Validation Error |
404 |
application/json |
Not found |
curl -X 'GET' \
'http://localhost:5001/v1/ro_crates/<crate_id>/validation' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-d '{
"minio_config": {
"accesskey": "<key>",
"bucket": "ro-crates",
"endpoint": "minio:9000",
"secret": "<secret>",
"ssl": false
}
}'
POST
v1/ro_crates/validate_metadata
(validates submitted RO-Crate Metadata)
name | type | data type | description |
---|---|---|---|
crate_json | required | string | RO-Crate metadata, stored as a single string |
profile_name | optional | string | RO-Crate profile to validate against |
http code | content-type | response |
---|---|---|
200 |
application/json |
Successful Validation |
422 |
application/json |
Error: Details of Validation Error |
curl -X 'POST' \
'http://localhost:5001/v1/ro_crates/validate_metadata' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-d '{
"crate_json": "{'\''test1'\'':'\''test2'\''}"
}'
- Docker with Docker Compose
-
Clone the repository:
git clone https://github.com/eScienceLab/Cratey-Validator.git cd crate-validation-service
-
Create the
.env
file for shared environment information. An example environment file is included (example.env
), which can be copied for this purpose. But make sure to change any security settings (username and passwords). -
Build and start the services using Docker Compose:
docker compose up --build
-
Set up the MinIO bucket
-
Open the MinIO web interface at
http://localhost:9000
. -
Log in with your MinIO credentials.
-
Create a new bucket named
ro-crates
. -
Enable versioning for the
ro-crates
bucket β this is important for tracking unique object versions. -
Upload your RO-Crate files to the
ro-crates
bucket. -
To verify that versioning is enabled:
- Select the uploaded RO-Crate object in the
ro-crates
bucket. - Navigate to the Actions panel on the right.
- The Display Object Versions option should be clickable.
- Select the uploaded RO-Crate object in the
-
For standard usage the Docker Compose script uses prebuilt containers. For testing locally developed containers use the alternate Docker Compose file:
docker compose --file docker-compose-develop.yml up --build
app/
βββ ro_crates/
β βββ routes/
β β βββ __init__.py # Registers blueprints
β β βββ post_routes.py # POST API routes
β βββ __init__.py
βββ services/
β βββ logging_service.py # Centralised logging
β βββ validation_service.py # Queue RO-Crates for validation
βββ tasks/
β βββ validation_tasks.py # Validate RO-Crates
βββ utils/
β βββ config.py # Configuration
β βββ minio_utils.py # Methods for interacting with MinIO
β βββ webhook_utils.py # Methods for sending webhooks