Aller au contenu

GET /v1/projects/{id}/stack

La stack est la liste des vendors et produits surveillés pour un projet. Chaque item définit également un seuil de sévérité minimum à partir duquel une alerte CVE est déclenchée.

GET /api/v1/projects/{project_id}/stack
Authorization: Bearer twa_votre_cle_ici
ParamètreTypeDescription
project_idUUIDIdentifiant du projet

Retourne un tableau (un projet peut avoir plusieurs stacks, généralement une seule).

[
{
"id": "018e5555-0000-7000-8000-000000000020",
"name": "Stack",
"project_id": "018e1234-abcd-7000-8000-000000000010",
"items": [
{
"id": "018e5555-0000-7000-8000-000000000021",
"item_type": "vendor",
"value": "apache",
"min_severity": "HIGH"
},
{
"id": "018e5555-0000-7000-8000-000000000022",
"item_type": "product",
"value": "nginx",
"min_severity": "CRITICAL"
},
{
"id": "018e5555-0000-7000-8000-000000000023",
"item_type": "product",
"value": "log4j",
"min_severity": "MEDIUM"
}
]
}
]
ChampTypeDescription
idstring (UUID)Identifiant de la stack
namestringNom de la stack (généralement "Stack")
project_idstring (UUID) | nullProjet associé
itemsarrayItems de surveillance
ChampTypeDescription
idstring (UUID)Identifiant de l’item
item_type"vendor" | "product"Type de surveillance
valuestringValeur surveillée (nom du vendor ou du produit, en minuscules)
min_severitystringSeuil minimum : CRITICAL, HIGH, MEDIUM, LOW, NONE
item_typeComportement
vendorToutes les CVE affectant n’importe quel produit de cet éditeur
productCVE affectant spécifiquement ce produit, tous éditeurs confondus
CodeDétailCause
404Projet introuvableproject_id inexistant
403Accès refusé à ce projetProjet existant mais non accessible

Lister tous les produits surveillés sur un projet

Fenêtre de terminal
curl -s \
-H "Authorization: Bearer twa_votre_cle_ici" \
"https://app.techwatchalert.com/api/v1/projects/018e1234-abcd-7000-8000-000000000010/stack" \
| jq '.[0].items[] | select(.item_type == "product") | .value'

Vérifier si un produit est surveillé

import httpx
BASE_URL = "https://app.techwatchalert.com/api/v1"
headers = {"Authorization": "Bearer twa_votre_cle_ici"}
project_id = "018e1234-abcd-7000-8000-000000000010"
stacks = httpx.get(f"{BASE_URL}/projects/{project_id}/stack", headers=headers).json()
watched = {
item["value"]
for stack in stacks
for item in stack["items"]
}
print("nginx surveillé :", "nginx" in watched)