Skip to main content

How to auto-fill mandatory metadata with the Automation API

  • August 19, 2026
  • 0 replies
  • 1 view

josephinerohner
Community Manager
Forum|alt.badge.img+2

If you've ever had a data asset stuck in draft because of one empty mandatory field (and no way to tell which one without opening every record), here's how to fix that programmatically instead of clicking through the UI one asset at a time.

Why this happens

Every metadata template defines requirement levels (mandatory / recommended / optional). Soon, you won’t be able to publish an asset if a mandatory field on its active template is empty. Recommended fields never block publication, they just show as a caution sign within the asset settings page.

The 3 calls you need :

1/ GET the metadata template : returns the list of fields with their requirement level, so you know which ones are mandatory.

GET /api/automation/v1.2/metadata-templates/{template_id}

2/ GET  the asset's current metadata : returns the values currently set. Compare against the template to spot any mandatory field that's missing or empty.

GET /api/automation/v1.2/datasets/{asset_id}/metadata

3/ PATCH the asset's metadata : send the missing value(s). A 422 means the value doesn't match a controlled list; a 403 usually means the API key is missing or invalid.

PATCH /api/automation/v1.2/datasets/{asset_id}/metadata
Body: { "field_name": "value" }

Scaling it up

The same logic works across many assets: loop over a list of asset IDs, run the GET + compare step for each, and PATCH whatever's missing. This is where automation actually pays off — detecting 40 incomplete assets by script takes seconds; doing it by hand doesn't scale.

Common pitfalls

  • Mandatory and recommended metadata are defined globally (i.e., at the portal level for all assets) rather than asset by asset.
  • A controlled-value field will reject anything outside its allowed list (422).
  • Don't forget your API key needs to be sent on every request, or you'll get a 403.

Questions or edge cases you've run into with this? Happy to dig into specifics in the comments.