Aller au contenu

Apply an earlier version of a policy

POST/api/public/v1/policies/{public_id}/versions/{version}/apply

Ratifies a new version whose intent policies are copies of version version's: every sentence with its rules, cases, fallback, answers and answered exceptions. The earlier versions and their history stay; the AIP's zones and their modes are kept, and their bundles carry the new version. One audit entry names both versions. 202 with a job already succeeded (GET /aip/jobs/{job_id}), whose result is {version, applied_version, previous_version}. An open edit draft keeps its rows and answers 409 EDIT_DRAFT_STALE at ratify. 409 NOT_RATIFIED also answers a version ratified before the engine swap (details[] reason pre_swap_version). An agent (OAuth) caller must send sentences, the version's ratified sentences: 428 SENTENCES_REQUIRED without them, 409 SENTENCES_MISMATCH unless they match.

Fenêtre de terminal
curl --fail-with-body -X POST 'https://app.openlatch.ai/api/public/v1/policies/<policy_public_id>/versions/<version>/apply' \
-H "Authorization: Bearer $OPENLATCH_API_KEY" \
-H 'Content-Type: application/json' \
-d '{"sentences":<sentences>}'
Rôle dans l’organisationCe point de terminaison
ownerAutorisé
adminAutorisé
editorAutorisé
viewerNon autorisé

Une clé porte le rôle que son propriétaire détient dans l’organisation. Voir Authentification.

Portée de clé d’API : policies:write

ParamètreTypeDescription
public_idstringObligatoire.
versionintegerObligatoire.
ParamètreTypeDescription
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.
ChampTypeDescription
sentencesarray of string or nullThe exact sentences this call puts in force, as shown to the user. Required of an agent (OAuth) caller: 428 SENTENCES_REQUIRED without them, 409 SENTENCES_MISMATCH unless they match the sentences put in force (the same sentences, order ignored, each as many times as it appears, after Unicode NFC and whitespace normalisation).
ChampTypeDescription
dataobjectObligatoire. `202 for a job-starting operation: poll GET /aip/jobs/{job_id}`.
data.job_idstringObligatoire.
{
"data": {
"job_id": "3f6c1a2e-8b4d-4c1f-9a7e-0d5b2c8e4f10"
}
}