Rename or describe an organization preset
PATCH/api/public/v1/policy-presets/{key} beta
revision is the one the caller read; a stale one answers 409 PRESET_CHANGED. description: null clears it. 409 PRESET_READ_ONLY for a built-in preset; 422 EMPTY_PATCH with neither field.
curl --fail-with-body -X PATCH 'https://app.openlatch.ai/api/public/v1/policy-presets/<preset_key>' \ -H "Authorization: Bearer $OPENLATCH_API_KEY" \ -H 'Content-Type: application/json' \ -d '{"revision":<revision>,"description":"Updated by the API examples."}'import jsonimport osimport urllib.request
body = '{"revision":<revision>,"description":"Updated by the API examples."}'request = urllib.request.Request( 'https://app.openlatch.ai/api/public/v1/policy-presets/<preset_key>', method='PATCH', data=body.encode(), headers={ 'Authorization': 'Bearer ' + os.environ['OPENLATCH_API_KEY'], 'Content-Type': 'application/json', },)with urllib.request.urlopen(request) as response: text = response.read().decode() print(json.dumps(json.loads(text), indent=2) if text else response.status)#!/usr/bin/env bashset -euo pipefail
curl -sS --fail-with-body -X PATCH 'https://app.openlatch.ai/api/public/v1/policy-presets/<preset_key>' \ -H "Authorization: Bearer $OPENLATCH_API_KEY" \ -H 'Content-Type: application/json' \ -d '{"revision":<revision>,"description":"Updated by the API examples."}' | jq .$headers = @{ Authorization = "Bearer $env:OPENLATCH_API_KEY"}$body = '{"revision":<revision>,"description":"Updated by the API examples."}'Invoke-RestMethod -Method PATCH -Uri 'https://app.openlatch.ai/api/public/v1/policy-presets/<preset_key>' -Headers $headers -ContentType 'application/json; charset=utf-8' -Body $body | ConvertTo-Json -Depth 20Autorisation
Section intitulée « Autorisation »| Rôle dans l’organisation | Ce point de terminaison |
|---|---|
owner | Autorisé |
admin | Autorisé |
editor | Autorisé |
viewer | Non autorisé |
Une clé porte le rôle que son propriétaire détient dans l’organisation. Voir Authentification.
Portée de clé d’API : presets:write
Paramètres de chemin
Section intitulée « Paramètres de chemin »| Paramètre | Type | Description |
|---|---|---|
key | string | Obligatoire. |
Paramètres d’en-tête
Section intitulée « Paramètres d’en-tête »| Paramètre | Type | Description |
|---|---|---|
Idempotency-Key | string or null | Optional. 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. |
Corps de la requête
Section intitulée « Corps de la requête »| Champ | Type | Description |
|---|---|---|
description | string or null | |
name | string or null | |
revision | integer | Obligatoire. |
- 200 OK — l’appel a réussi.
- 400 Bad Request —
BAD_REQUEST - 401 Unauthorized —
UNAUTHORIZED - 402 Payment Required —
license_expired - 403 Forbidden —
FEATURE_DISABLED,FORBIDDEN,INSUFFICIENT_SCOPE - 404 Not Found —
NOT_FOUND - 409 Conflict —
IDEMPOTENCY_IN_PROGRESS,PRESET_CHANGED,PRESET_NAME_EXISTS,PRESET_READ_ONLY - 422 Unprocessable Content —
EMPTY_PATCH,IDEMPOTENCY_KEY_REUSED,INVALID_ID,VALIDATION_ERROR - 429 Too Many Requests —
TOO_MANY_REQUESTS - 500 Internal Server Error —
INTERNAL_SERVER_ERROR,tenant_isolation_violation - 503 Service Unavailable —
FEATURE_STATE_UNAVAILABLE,SERVICE_UNAVAILABLE
Champs de la réponse
Section intitulée « Champs de la réponse »| Champ | Type | Description |
|---|---|---|
data | object | Obligatoire. One preset: built-in (read-only for every role) or the organization's own. |
data.created_by | object or null | |
data.created_by.name | string | Obligatoire. |
data.default_selected | boolean | Obligatoire. False for a framework preset, otherwise true. |
data.description | string | Obligatoire. |
data.framework | object or null | Obligatoire. Set on a framework preset; null on every other. |
data.framework.notice | object or null | Obligatoire. |
data.framework.source | object | Obligatoire. |
data.key | string | Obligatoire. |
data.kind | string — one of builtin, organization | Obligatoire. |
data.revision | integer or null | |
data.rules | array of object | Obligatoire. |
data.rules[].capability | object or null | |
data.rules[].citation | object or null | Obligatoire. What the rule cites, for a framework preset's rule; null for every other. |
data.rules[].dimension | string — one of quality, economics, security, safety, compliance | Obligatoire. |
data.rules[].intent_key | string | Obligatoire. |
data.rules[].sentence | string | Obligatoire. |
data.title | string | Obligatoire. |
Exemple de réponse
Section intitulée « Exemple de réponse »{ "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" } ], "title": "string" }}