# Projets

## GET `/projects`

**Lister les projets de l’espace**

Demande une clé d’API avec la portée `portal:read`.

### Paramètres de requête

| Champ    | Type                                         | Obligatoire | Description                          |
| -------- | -------------------------------------------- | ----------- | ------------------------------------ |
| `status` | “active” \| “paused” \| “done” \| “archived” | Non         |                                      |
| `limit`  | integer                                      | Non         | Par défaut : `20`. min. 1, max. 100. |
| `cursor` | string                                       | Non         |                                      |

### Réponses

| Code  | Description              | Corps     |
| ----- | ------------------------ | --------- |
| `200` | Succès                   | `objet`   |
| `400` | Requête invalide         | `Problem` |
| `401` | Authentification requise | `Problem` |
| `403` | Accès refusé             | `Problem` |
| `429` | Trop de requêtes         | `Problem` |
| `500` | Erreur interne           | `Problem` |

### Champs de la réponse `200`

| Champ                | Type                                         | Description                                   |
| -------------------- | -------------------------------------------- | --------------------------------------------- |
| `data`               | objet\[]                                     |                                               |
| `data[].id`          | string                                       | Identifiant Portal.                           |
| `data[].object`      | string                                       |                                               |
| `data[].name`        | string                                       |                                               |
| `data[].status`      | “active” \| “paused” \| “done” \| “archived” |                                               |
| `data[].client_id`   | string                                       | Identifiant Portal.                           |
| `data[].description` | string ou null                               |                                               |
| `data[].website`     | string ou null                               |                                               |
| `data[].created_at`  | string                                       | Date et heure ISO 8601 (UTC).                 |
| `data[].updated_at`  | string                                       | Date et heure ISO 8601 (UTC).                 |
| `next_cursor`        | string ou null                               | À renvoyer en `cursor` pour la page suivante. |
| `has_more`           | boolean                                      |                                               |

### Exemple

```bash
curl -X GET "https://app.hgdc.ch/portal/api/v1/projects" \
  -H "Authorization: Bearer $HGDC_PORTAL_API_KEY"
```

Réponse `200` :

```json
{
  "data": [
    {
      "id": "exemple",
      "object": "exemple",
      "name": "exemple",
      "status": "active",
      "client_id": "exemple",
      "description": "exemple",
      "website": "exemple",
      "created_at": "exemple",
      "updated_at": "exemple"
    }
  ],
  "next_cursor": "exemple",
  "has_more": true
}
```

## GET `/projects/{id}`

**Lire un projet**

Demande une clé d’API avec la portée `portal:read`.

### Paramètres de chemin

| Champ | Type   | Obligatoire | Description |
| ----- | ------ | ----------- | ----------- |
| `id`  | string | Oui         |             |

### Réponses

| Code  | Description              | Corps     |
| ----- | ------------------------ | --------- |
| `200` | Succès                   | `objet`   |
| `400` | Requête invalide         | `Problem` |
| `401` | Authentification requise | `Problem` |
| `403` | Accès refusé             | `Problem` |
| `404` | Ressource introuvable    | `Problem` |
| `429` | Trop de requêtes         | `Problem` |
| `500` | Erreur interne           | `Problem` |

### Champs de la réponse `200`

| Champ         | Type                                         | Description                   |
| ------------- | -------------------------------------------- | ----------------------------- |
| `id`          | string                                       | Identifiant Portal.           |
| `object`      | string                                       |                               |
| `name`        | string                                       |                               |
| `status`      | “active” \| “paused” \| “done” \| “archived” |                               |
| `client_id`   | string                                       | Identifiant Portal.           |
| `description` | string ou null                               |                               |
| `website`     | string ou null                               |                               |
| `created_at`  | string                                       | Date et heure ISO 8601 (UTC). |
| `updated_at`  | string                                       | Date et heure ISO 8601 (UTC). |

### Exemple

```bash
curl -X GET "https://app.hgdc.ch/portal/api/v1/projects/<id>" \
  -H "Authorization: Bearer $HGDC_PORTAL_API_KEY"
```

Réponse `200` :

```json
{
  "id": "exemple",
  "object": "exemple",
  "name": "exemple",
  "status": "active",
  "client_id": "exemple",
  "description": "exemple",
  "website": "exemple",
  "created_at": "exemple",
  "updated_at": "exemple"
}
```
