Skip to content

CLI

Terminal window
python -m ramose -s <spec.hf> [options]
ArgumentDescription
-s, --specSpec file(s) in hash format. Required. Accepts multiple files.
-c, --callAPI call URL, e.g. /v1/metadata/doi:10.1162/qss_a_00292.
-m, --methodHTTP method for the call. Default: get.
-f, --formatResponse format: application/json (default) or text/csv.
-d, --docGenerate HTML documentation. Ignores -m, -c, -f.
--openapiExport OpenAPI 3.0 YAML specification.
--api-baseSelect which API base to export when multiple specs are loaded.
-o, --outputWrite response to file instead of stdout.
-w, --webserverStart Flask server at host:port.
-css, --cssCustom CSS file path for documentation styling.

Query an endpoint and print the result:

Terminal window
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/json

Request CSV instead:

Terminal window
python -m ramose -s meta_v1.hf -f text/csv -c '/v1/metadata/doi:10.1162/qss_a_00292'

Save to file:

Terminal window
python -m ramose -s meta_v1.hf -c '/v1/metadata/doi:10.1162/qss_a_00292' -o result.json

Generate HTML documentation:

Terminal window
python -m ramose -s meta_v1.hf -d -o docs.html

Export OpenAPI spec:

Terminal window
python -m ramose -s meta_v1.hf --openapi -o openapi.yaml

Start a Flask development server:

Terminal window
python -m ramose -s meta_v1.hf -w 127.0.0.1:8080

This 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:

Terminal window
curl -H "Accept: text/csv" "http://localhost:8080/v1/metadata/doi:10.1162/qss_a_00292"

Load multiple APIs at once:

Terminal window
python -m ramose -s meta_v1.hf index_v2.hf -w 127.0.0.1:8080

Apply custom CSS to the documentation:

Terminal window
python -m ramose -s meta_v1.hf -w 127.0.0.1:8080 -css style.css