3 min read

Project catalog API

Inspect and manage dictionary definitions for an explicit project workspace. The project ID must match the project bound to your API key.

CLI equivalent: simhealth dictionary get reads the catalog; simhealth dictionary validate FILE and simhealth dictionary publish FILE write it.

Important

The catalog endpoints use the project encoded in your Bearer API key. A {project_id} that does not match the project bound to the key returns HTTP 403 Forbidden.

Catalog endpoints

MethodPathDescription
GET/v1/projects/{project_id}/catalogReturn the complete manifest and compiled entries.
GET/v1/projects/{project_id}/catalog/{kind}List entries for sets, records, distributions, or sequences.
GET/v1/projects/{project_id}/catalog/{kind}/{id}Retrieve source definition and compiled metadata.
PUT/v1/projects/{project_id}/catalog/{kind}/{id}Replace a single entry and atomically validate the dictionary.
POST/v1/projects/{project_id}/catalog/batchAtomically compile and publish multiple dictionary entries.
DELETE/v1/projects/{project_id}/catalog/{kind}/{id}Delete an entry if the remaining pack still compiles cleanly.

The four catalog kinds

A dictionary pack contains four distinct kinds:

  • records: Root entities sampleable through GET /v1/projects/{project_id}/random/{record} and reusable nested fragments.
  • sets: Discrete categorical values, one member per line. A trailing positive number is weight metadata and is not part of the sampled label.
  • sequences: Sequential ID generators. Template placeholders are {n} and zero-padded {n:WIDTH} (e.g. {n:06}).
  • distributions: Continuous and discrete probability definitions, including P(name) ~ Count for list lengths.
Note

Fragment(name) is source-level syntax for a nested record. Publish it as kind records. There is no separate fragments kind. POST .../catalog/batch with kind fragments returns HTTP 400.

DSL example

text
# kind: sets  id: itemCount
Set(itemCount)
0
1
2

# kind: distributions  id: itemCount
P(itemCount) ~ Count over Set(itemCount)
0	20
1	50
2	30

# kind: records  id: lineItem
Fragment(lineItem)
sku	1	Set(sku)
quantity	1	uniformInt(1, 10)

# kind: records  id: order
Record(order)
id	1	Seq(orderId)
itemCount	1	P(itemCount)
items	0..N	Fragment(lineItem) ~ P(itemCount)

Atomic batch publish

Use POST /v1/projects/{project_id}/catalog/batch to update multiple definitions simultaneously in an atomic transaction:

curl -X POST "https://api.preprod.simhealth.interoperabilitypro.com/v1/projects/default/catalog/batch" \
  -H "Authorization: Bearer $SIMHEALTH_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "entries": [
      {
        "kind": "sets",
        "id": "status",
        "source": "Set(status)\nactive\npending\nclosed\n"
      }
    ]
  }'
import requests

payload = {
    "entries": [
        {
            "kind": "sets",
            "id": "status",
            "source": "Set(status)\nactive\npending\nclosed\n",
        }
    ]
}
res = requests.post(
    "https://api.preprod.simhealth.interoperabilitypro.com/v1/projects/default/catalog/batch",
    headers={"Authorization": f"Bearer {API_KEY}"},
    json=payload,
)
print(res.json())
simhealth dictionary publish ./dictionary.json

Response schemas

200 OK (Batch publish response)

json
{
  "version": "v0018",
  "publishedEntries": 1,
  "compiledRecords": 4,
  "status": "active"
}

400 Bad Request (Compilation error)

json
{
  "error": "compilation_failed",
  "message": "Unresolved reference: 'Set(nonexistent)' in record 'order'",
  "line": 3
}
Was this page helpful?