Aller au contenu

GET /v1/organizations/{org_id}/projects/{id}/workflows

Les workflows d’automatisation d’un projet (déclencheur → conditions → actions) et l’historique de leurs exécutions.

GET /api/v1/organizations/{org_id}/projects/{project_id}/workflows
Authorization: Bearer twa_votre_cle_ici
Paramètre Type Description
org_id UUID Identifiant de l’organisation
project_id UUID Identifiant du projet
[
{
"id": "018e8888-0000-7000-8000-000000000040",
"name": "Workflow par défaut",
"is_enabled": true,
"is_default": true,
"created_at": "2024-03-15T10:22:00Z",
"updated_at": "2024-06-01T08:00:00Z"
}
]
Champ Type Description
id string (UUID) Identifiant du workflow
name string Nom
is_enabled boolean Workflow actif
is_default boolean Workflow par défaut du projet
created_at string (ISO 8601) Date de création
updated_at string (ISO 8601) Dernière modification

La liste ne contient pas le graphe.

GET /api/v1/organizations/{org_id}/projects/{project_id}/workflows/{workflow_id} n’existe pas. Pour lire un workflow avec son graphe :

  • l’outil MCP get_workflow ;
  • l’API de session (cookie ou jeton de compte, pas une clé twa_) : GET /projects/{project_id}/workflows/{workflow_id}. Un workflow d’organisation se lit par GET /organizations/{org_id}/workflows/{workflow_id}.
POST /api/v1/organizations/{org_id}/projects/{project_id}/workflows
Authorization: Bearer twa_votre_cle_ici
Idempotency-Key: 018e9999-0000-7000-8000-000000000099
Content-Type: application/json

Scope workflows-write, à accorder explicitement sur la clé. Sans cet en-tête : 422. La même clé et le même corps renvoient le workflow déjà créé (200) ; un autre corps avec la même clé : 409.

Corps : name (requis), description, et soit graph (nodes et edges), soit trigger, actions et create_case (défaut true). Les deux formes ensemble : 422.

Réponse 201 : la fiche complète (id, name, description, is_enabled, is_default, family, version, graph, created_at, updated_at). Un nom déjà pris sur le projet : 409.

PATCH /api/v1/organizations/{org_id}/projects/{project_id}/workflows/{workflow_id}
Authorization: Bearer twa_votre_cle_ici
Content-Type: application/json

Scope workflows-write. version est obligatoire : si elle ne correspond plus à la fiche, 409 (version_perimee, la réponse donne la version actuelle). Champs : name, description, version, et soit graph, soit trigger, actions, create_case.

PATCH /api/v1/organizations/{org_id}/projects/{project_id}/workflows/{workflow_id}/enabled
Authorization: Bearer twa_votre_cle_ici
Content-Type: application/json
{ "enabled": false }

Scope workflows-write. Réponse : la fiche, version incrémentée.

DELETE /api/v1/organizations/{org_id}/projects/{project_id}/workflows/{workflow_id}
Authorization: Bearer twa_votre_cle_ici

Scope workflows-write. Réponse 204. 409 si c’est le workflow par défaut du projet, ou le dernier du projet.

GET /api/v1/organizations/{org_id}/projects/{project_id}/workflows/{workflow_id}/runs
Authorization: Bearer twa_votre_cle_ici
Paramètre Type Description
limit integer Nombre d’exécutions, max 200 (défaut 50)
[
{
"id": "018e8888-0000-7000-8000-000000000041",
"workflow_id": "018e8888-0000-7000-8000-000000000040",
"trigger_event": "cve.new_match",
"cve_id": "CVE-2024-3094",
"status": "success",
"started_at": "2024-07-01T06:05:00Z",
"finished_at": "2024-07-01T06:05:02Z"
}
]
Champ Type Description
id string (UUID) Identifiant de l’exécution
workflow_id string (UUID) Workflow exécuté
trigger_event string Événement déclencheur (ex. cve.new_match)
cve_id string | null CVE concernée
status string success, partial, failed, throttled, dry_run
started_at string (ISO 8601) Début
finished_at string (ISO 8601) | null Fin (null si en cours)
Code Détail Cause
404 Projet introuvable Projet inexistant, d’une autre organisation, ou hors de la restriction de projets de la clé
404 Workflow introuvable workflow_id inexistant sur ce projet

Dernières exécutions en échec

Fenêtre de terminal
ORG_ID="018e5678-abcd-7000-8000-000000000001"
PROJECT_ID="018e1234-abcd-7000-8000-000000000010"
WORKFLOW_ID="018e8888-0000-7000-8000-000000000040"
curl -s \
-H "Authorization: Bearer twa_votre_cle_ici" \
"https://app.techwatchalert.com/api/v1/organizations/${ORG_ID}/projects/${PROJECT_ID}/workflows/${WORKFLOW_ID}/runs?limit=100" \
| jq '.[] | select(.status == "failed" or .status == "partial") | {cve_id, status, started_at}'