Ir al contenido

Add rules to an organization preset

POST/api/public/v1/policy-presets/{key}/rules beta

Rules from a source, as on create; a sentence already in the preset with the same dimension is skipped and returned in skipped. 409 PRESET_CHANGED for a stale revision; 409 PRESET_READ_ONLY for a built-in.

Ventana de terminal
curl --fail-with-body -X POST 'https://app.openlatch.ai/api/public/v1/policy-presets/<preset_key>/rules' \
-H "Authorization: Bearer $OPENLATCH_API_KEY" \
-H 'Content-Type: application/json' \
-d '{"revision":<revision>,"source":{"sentences":[{"sentence":"Ask before a deploy to production.","dimension":"safety"}]}}'
Rol en la organizaciónEste punto de conexión
ownerPermitido
adminPermitido
editorPermitido
viewerNo permitido

Una clave tiene el rol que su propietario ocupa en la organización. Consulte Autenticación.

Ámbito de la clave de API: presets:write

ParámetroTipoDescripción
keystringObligatorio.
ParámetroTipoDescripción
Idempotency-Keystring or nullOptional. Makes the request safe to retry: the same key and the same request, within 24 hours, returns the stored response with Idempotent-Replayed: true and runs once.
CampoTipoDescripción
revisionintegerObligatorio.
sourceobjectObligatorio. Exactly one of the three: intent policy ids, a preset selection, or typed sentences.
source.intent_policy_idsarray of string (uuid) or null
source.presetobject or null
source.preset.intentsarray of objectObligatorio.
source.preset.keystringObligatorio.
source.sentencesarray of object or null
CampoTipoDescripción
dataobjectObligatorio. A create or an add: the preset, and the sentences not added because already in it.
data.created_byobject or null
data.created_by.namestringObligatorio.
data.default_selectedbooleanObligatorio. False for a framework preset, otherwise true.
data.descriptionstringObligatorio.
data.frameworkobject or nullObligatorio. Set on a framework preset; null on every other.
data.framework.noticeobject or nullObligatorio.
data.framework.sourceobjectObligatorio.
data.keystringObligatorio.
data.kindstring — one of builtin, organizationObligatorio.
data.revisioninteger or null
data.rulesarray of objectObligatorio.
data.rules[].capabilityobject or null
data.rules[].citationobject or nullObligatorio. What the rule cites, for a framework preset's rule; null for every other.
data.rules[].dimensionstring — one of quality, economics, security, safety, complianceObligatorio.
data.rules[].intent_keystringObligatorio.
data.rules[].sentencestringObligatorio.
data.skippedarray of string
data.titlestringObligatorio.
{
"data": {
"created_by": {
"name": "release-bot"
},
"default_selected": false,
"description": "string",
"framework": {
"notice": "string",
"source": {
"framework_url": "https://app.openlatch.ai/",
"github_url": "https://app.openlatch.ai/",
"license_name": "release-bot",
"license_url": "https://app.openlatch.ai/",
"name": "release-bot",
"source_commit": "string",
"source_date": "string"
}
},
"key": "string",
"kind": "builtin",
"revision": 3,
"rules": [
{
"capability": "enforce",
"citation": {
"entries": [
{}
],
"items": [
{}
]
},
"dimension": "quality",
"intent_key": "string",
"sentence": "string"
}
],
"skipped": [
"string"
],
"title": "string"
}
}