GET /v1/organizations
L’organisation est le sommet de la hiérarchie : chaque projet appartient à une organisation. Une clé API étant rattachée à une organisation, le parcours type suit cette hiérarchie : organisation → projets → stack / alertes / EOL.
Mon organisation
Section intitulée « Mon organisation »GET /api/v1/organizationsAuthorization: Bearer twa_votre_cle_iciRetourne l’organisation rattachée à la clé (toujours un tableau d’un seul élément).
Aucun paramètre
Section intitulée « Aucun paramètre »Réponse 200 OK
Section intitulée « Réponse 200 OK »[ { "id": "018e5678-abcd-7000-8000-000000000001", "name": "ACME Corp", "role": "OWNER", "is_personal": false, "created_at": "2024-05-02T09:00:00Z" }]| Champ | Type | Description |
|---|---|---|
id | string (UUID) | Identifiant de l’organisation — à utiliser dans /organizations/{id}/projects |
name | string | Nom de l’organisation |
role | string | Toujours OWNER (la clé opère au niveau organisation) |
is_personal | boolean | true pour une organisation personnelle |
created_at | string (ISO 8601) | Date de création |
Lister les projets d’une organisation
Section intitulée « Lister les projets d’une organisation »GET /api/v1/organizations/{org_id}/projectsAuthorization: Bearer twa_votre_cle_iciRetourne tous les projets de l’organisation (la clé donne un accès org-wide). org_id doit correspondre à l’organisation de la clé.
Paramètres de chemin
Section intitulée « Paramètres de chemin »| Paramètre | Type | Description |
|---|---|---|
org_id | UUID | Identifiant de l’organisation |
Réponse 200 OK
Section intitulée « Réponse 200 OK »[ { "id": "018e1234-abcd-7000-8000-000000000010", "name": "Infrastructure prod", "description": "Serveurs et dépendances en production", "org_id": "018e5678-abcd-7000-8000-000000000001", "is_default": true, "created_at": "2024-03-15T10:22:00Z" }]| Champ | Type | Description |
|---|---|---|
id | string (UUID) | Identifiant du projet — à utiliser dans tous les endpoints /organizations/{org_id}/projects/{id}/... |
name | string | Nom du projet |
description | string | null | Description (null si non renseignée) |
org_id | string (UUID) | null | Organisation à laquelle le projet appartient |
is_default | boolean | true pour le projet créé automatiquement à l’inscription |
created_at | string (ISO 8601) | Date de création |
| Code | Détail | Cause |
|---|---|---|
404 | Organisation introuvable | org_id ne correspond pas à l’organisation de la clé |
Exemples
Section intitulée « Exemples »Parcourir toute la hiérarchie organisations → projets
curl -s \ -H "Authorization: Bearer twa_votre_cle_ici" \ https://app.techwatchalert.com/api/v1/organizations \ | jq -r '.[].id' \ | while read ORG; do curl -s \ -H "Authorization: Bearer twa_votre_cle_ici" \ "https://app.techwatchalert.com/api/v1/organizations/${ORG}/projects" \ | jq -r '.[] | "\(.name)\t\(.id)"' donePython — tous les projets, groupés par organisation
import httpx
BASE_URL = "https://app.techwatchalert.com/api/v1"headers = {"Authorization": "Bearer twa_votre_cle_ici"}
orgs = httpx.get(f"{BASE_URL}/organizations", headers=headers).json()projects_by_org = { org["name"]: httpx.get( f"{BASE_URL}/organizations/{org['id']}/projects", headers=headers ).json() for org in orgs}
for org_name, projects in projects_by_org.items(): print(org_name, "→", [p["name"] for p in projects])