End-User Guide

Retrieving Outputs (REST API)

List and download generated output artifacts via the REST API for use in CI/CD pipelines and scripts.

Retrieving Outputs (REST API)

Accessing Generated Artifacts via HTTP

In addition to querying the graph via GraphQL, rescile provides a dedicated REST endpoint to list and download all generated output artifacts. This is particularly useful for automation scripts or CI/CD pipelines that need to retrieve specific generated files without writing a GraphQL query.

The Index Endpoint

GET /api/outputs/index

Returns a flat JSON array of all available output artifacts. It scans the graph for all resources containing filename and mimetype properties and identifies their origin resource by following DESCRIBED_BY relationships backwards.

Query Parameters

Parameter Description
origin_type Filter by the type of the resource that generated the output (e.g., server, application).
origin_name Filter by the exact name (primary key) of the origin resource (e.g., server011).
type Filter by the type of the generated output resource (e.g., cloudinit, service_summary).

Example Request

curl "http://localhost:7600/api/outputs/index?origin_type=application"

Example Response

[
  {
    "type": "cloudinit",
    "name": "cloudinit-server011",
    "filename": "cloudinit-server011.yaml",
    "mimetype": "text/x-yaml",
    "hash": "sha256-...",
    "download_url": "/api/outputs/cloudinit/cloudinit-server011/cloudinit-server011.yaml",
    "origin": {
      "type": "server",
      "name": "server011"
    }
  }
]

Downloading an Artifact

Use the download_url from the index response to fetch the file directly:

curl "http://localhost:7600/api/outputs/cloudinit/cloudinit-server011/cloudinit-server011.yaml" \
  -o cloudinit-server011.yaml

Using Outputs in CI/CD

A common pattern is to call the index endpoint at the end of a pipeline run to retrieve all generated artifacts:

# Download all Terraform variable files generated in this run
curl "http://localhost:7600/api/outputs/index?type=terraform_variables" | \
  jq -r '.[].download_url' | \
  xargs -I{} curl -O "http://localhost:7600{}"

For a complete reference on defining output rules, see the Output Developer Guide.