CLI
Arguments
Section titled “Arguments”python -m ramose -s <spec.hf> [options]| Argument | Description |
|---|---|
-s, --spec | Spec file(s) in hash format. Required. Accepts multiple files. |
-c, --call | API call URL, e.g. /v1/metadata/doi:10.1162/qss_a_00292. |
-m, --method | HTTP method for the call. Default: get. |
-f, --format | Response format: application/json (default) or text/csv. |
-d, --doc | Generate HTML documentation. Ignores -m, -c, -f. |
--openapi | Export OpenAPI 3.0 YAML specification. |
--api-base | Select which API base to export when multiple specs are loaded. |
-o, --output | Write response to file instead of stdout. |
-w, --webserver | Start Flask server at host:port. |
-css, --css | Custom CSS file path for documentation styling. |
Local mode
Section titled “Local mode”Query an endpoint and print the result:
python -m ramose -s meta_v1.hf -c '/v1/metadata/doi:10.1162/qss_a_00292'# Response HTTP code: 200# Body:[{"id": "doi:10.1162/qss_a_00292 omid:br/062104388184", "title": "OpenCitations Meta", ...}]# Content-type: application/jsonRequest CSV instead:
python -m ramose -s meta_v1.hf -f text/csv -c '/v1/metadata/doi:10.1162/qss_a_00292'Save to file:
python -m ramose -s meta_v1.hf -c '/v1/metadata/doi:10.1162/qss_a_00292' -o result.jsonGenerate HTML documentation:
python -m ramose -s meta_v1.hf -d -o docs.htmlExport OpenAPI spec:
python -m ramose -s meta_v1.hf --openapi -o openapi.yamlWeb server
Section titled “Web server”Start a Flask development server:
python -m ramose -s meta_v1.hf -w 127.0.0.1:8080This serves:
- Dashboard at the root (
/) - API documentation at the API base path (e.g.,
/v1) - API endpoints at their configured paths
- OpenAPI spec at
<api_base>/openapi.yaml(e.g.,/v1/openapi.yaml)
Query via curl:
curl -H "Accept: text/csv" "http://localhost:8080/v1/metadata/doi:10.1162/qss_a_00292"Load multiple APIs at once:
python -m ramose -s meta_v1.hf index_v2.hf -w 127.0.0.1:8080Apply custom CSS to the documentation:
python -m ramose -s meta_v1.hf -w 127.0.0.1:8080 -css style.css