Référence des endpoints
Projets
Routes GET /v9/projects, POST /v10/projects….
GET /v9/projects
Projets
Demande une clé d’API avec la portée host:read.
Réponses
| Code | Description | Corps |
|---|---|---|
200 | Succès | objet |
400 | Requête invalide | VercelError |
401 | Authentification requise | VercelError |
403 | Accès refusé | VercelError |
429 | Trop de requêtes | VercelError |
500 | Erreur interne | VercelError |
Champs de la réponse 200
| Champ | Type | Description |
|---|---|---|
projects | objet[] | |
projects[].id | string | |
projects[].name | string | |
projects[].framework | string ou null | |
pagination | objet | |
pagination.count | number | |
pagination.next | number ou null |
Exemple
curl -X GET "https://api.host.hgdc.ch/v9/projects" \ -H "Authorization: Bearer $VERCEL_TOKEN"Réponse 200 :
{ "projects": [ { "id": "exemple", "name": "exemple", "framework": "exemple" } ], "pagination": { "count": 1, "next": 1 }}POST /v10/projects
Créer un projet
Demande une clé d’API avec la portée host:write.
Corps de la requête
Type de contenu : application/json.
| Champ | Type | Obligatoire | Description |
|---|---|---|---|
name | string | Oui | |
framework | string ou null | Non |
Réponses
| Code | Description | Corps |
|---|---|---|
200 | Succès | objet |
400 | Requête invalide | VercelError |
401 | Authentification requise | VercelError |
403 | Accès refusé | VercelError |
409 | Conflit | VercelError |
429 | Trop de requêtes | VercelError |
500 | Erreur interne | VercelError |
Champs de la réponse 200
| Champ | Type | Description |
|---|---|---|
id | string | |
name | string | |
framework | string ou null |
Exemple
curl -X POST "https://api.host.hgdc.ch/v10/projects" \ -H "Authorization: Bearer $VERCEL_TOKEN" \ -H "Content-Type: application/json" \ -d '{"name":"exemple"}'Réponse 200 :
{ "id": "exemple", "name": "exemple", "framework": "exemple"}GET /v9/projects/{idOrName}
Un projet (avec lastAliasRequest)
Demande une clé d’API avec la portée host:read.
Réponses
| Code | Description | Corps |
|---|---|---|
200 | Succès | objet |
400 | Requête invalide | VercelError |
401 | Authentification requise | VercelError |
403 | Accès refusé | VercelError |
404 | Ressource introuvable | VercelError |
429 | Trop de requêtes | VercelError |
500 | Erreur interne | VercelError |
Champs de la réponse 200
| Champ | Type | Description |
|---|---|---|
id | string | |
name | string | |
framework | string ou null |
Exemple
curl -X GET "https://api.host.hgdc.ch/v9/projects/<idOrName>" \ -H "Authorization: Bearer $VERCEL_TOKEN"Réponse 200 :
{ "id": "exemple", "name": "exemple", "framework": "exemple"}POST /v10/projects/{idOrName}/promote/{id}
Mettre un déploiement prêt en production
Demande une clé d’API avec la portée host:deploy.
Réponses
| Code | Description | Corps |
|---|---|---|
201 | Succès | |
400 | Requête invalide | VercelError |
401 | Authentification requise | VercelError |
403 | Accès refusé | VercelError |
404 | Ressource introuvable | VercelError |
429 | Trop de requêtes | VercelError |
500 | Erreur interne | VercelError |
Exemple
curl -X POST "https://api.host.hgdc.ch/v10/projects/<idOrName>/promote/<id>" \ -H "Authorization: Bearer $VERCEL_TOKEN"POST /v9/projects/{idOrName}/rollback/{id}
Remettre en production une version précédente
Demande une clé d’API avec la portée host:deploy.
Réponses
| Code | Description | Corps |
|---|---|---|
201 | Succès | |
400 | Requête invalide | VercelError |
401 | Authentification requise | VercelError |
403 | Accès refusé | VercelError |
404 | Ressource introuvable | VercelError |
429 | Trop de requêtes | VercelError |
500 | Erreur interne | VercelError |
Exemple
curl -X POST "https://api.host.hgdc.ch/v9/projects/<idOrName>/rollback/<id>" \ -H "Authorization: Bearer $VERCEL_TOKEN"GET /v10/projects/{idOrName}/env
Variables d’environnement
Demande une clé d’API avec la portée host:env_read.
Paramètres de requête
| Champ | Type | Obligatoire | Description |
|---|---|---|---|
decrypt | “true” | “false” | Non | |
target | “production” | “preview” | “development” | Non |
Réponses
| Code | Description | Corps |
|---|---|---|
200 | Succès | objet |
400 | Requête invalide | VercelError |
401 | Authentification requise | VercelError |
403 | Accès refusé | VercelError |
404 | Ressource introuvable | VercelError |
429 | Trop de requêtes | VercelError |
500 | Erreur interne | VercelError |
Champs de la réponse 200
| Champ | Type | Description |
|---|---|---|
envs | objet[] | |
envs[].id | string | |
envs[].key | string | |
envs[].type | “encrypted” | “sensitive” | |
envs[].target | “production” | “preview” | “development”[] | |
envs[].value | string | Vide, sauf avec decrypt=true pour une variable non sensible. |
pagination | objet | |
pagination.count | number | |
pagination.next | number ou null |
Exemple
curl -X GET "https://api.host.hgdc.ch/v10/projects/<idOrName>/env" \ -H "Authorization: Bearer $VERCEL_TOKEN"Réponse 200 :
{ "envs": [ { "id": "exemple", "key": "exemple", "type": "encrypted", "target": [ "production" ], "value": "exemple" } ], "pagination": { "count": 1, "next": 1 }}POST /v10/projects/{idOrName}/env
Créer une variable (upsert=true : remplacer)
Demande une clé d’API avec la portée host:env_write.
Paramètres de requête
| Champ | Type | Obligatoire | Description |
|---|---|---|---|
upsert | “true” | “false” | Non |
Corps de la requête
Type de contenu : application/json.
| Champ | Type | Obligatoire | Description |
|---|---|---|---|
key | string | Oui | |
value | string | Oui | |
type | “plain” | “encrypted” | “sensitive” | Non | |
target | “production” | “preview” | “development”[] | Oui | |
comment | string | Non |
Réponses
| Code | Description | Corps |
|---|---|---|
201 | Succès | objet |
400 | Requête invalide | VercelError |
401 | Authentification requise | VercelError |
403 | Accès refusé | VercelError |
404 | Ressource introuvable | VercelError |
429 | Trop de requêtes | VercelError |
500 | Erreur interne | VercelError |
Champs de la réponse 201
| Champ | Type | Description |
|---|---|---|
created | objet | |
created.id | string | |
created.key | string | |
created.type | “encrypted” | “sensitive” | |
created.target | “production” | “preview” | “development”[] | |
created.value | string | Vide, sauf avec decrypt=true pour une variable non sensible. |
failed | any[] |
Exemple
curl -X POST "https://api.host.hgdc.ch/v10/projects/<idOrName>/env" \ -H "Authorization: Bearer $VERCEL_TOKEN" \ -H "Content-Type: application/json" \ -d '{"key":"exemple","value":"exemple","target":["production"]}'Réponse 201 :
{ "created": { "id": "exemple", "key": "exemple", "type": "encrypted", "target": [ "production" ], "value": "exemple" }, "failed": [ "exemple" ]}DELETE /v10/projects/{idOrName}/env/{id}
Supprimer une variable
Demande une clé d’API avec la portée host:env_write.
Réponses
| Code | Description | Corps |
|---|---|---|
200 | Succès | objet |
400 | Requête invalide | VercelError |
401 | Authentification requise | VercelError |
403 | Accès refusé | VercelError |
404 | Ressource introuvable | VercelError |
429 | Trop de requêtes | VercelError |
500 | Erreur interne | VercelError |
Champs de la réponse 200
| Champ | Type | Description |
|---|---|---|
id | string | |
key | string | |
type | “encrypted” | “sensitive” | |
target | “production” | “preview” | “development”[] | |
value | string | Vide, sauf avec decrypt=true pour une variable non sensible. |
Exemple
curl -X DELETE "https://api.host.hgdc.ch/v10/projects/<idOrName>/env/<id>" \ -H "Authorization: Bearer $VERCEL_TOKEN"Réponse 200 :
{ "id": "exemple", "key": "exemple", "type": "encrypted", "target": [ "production" ], "value": "exemple"}PATCH /v10/projects/{idOrName}/env/{id}
Modifier une variable
Demande une clé d’API avec la portée host:env_write.
Corps de la requête
Type de contenu : application/json.
| Champ | Type | Obligatoire | Description |
|---|---|---|---|
key | string | Non | |
value | string | Non | |
type | “plain” | “encrypted” | “sensitive” | Non | |
target | “production” | “preview” | “development”[] | Non | |
comment | string | Non |
Réponses
| Code | Description | Corps |
|---|---|---|
200 | Succès | objet |
400 | Requête invalide | VercelError |
401 | Authentification requise | VercelError |
403 | Accès refusé | VercelError |
404 | Ressource introuvable | VercelError |
429 | Trop de requêtes | VercelError |
500 | Erreur interne | VercelError |
Champs de la réponse 200
| Champ | Type | Description |
|---|---|---|
id | string | |
key | string | |
type | “encrypted” | “sensitive” | |
target | “production” | “preview” | “development”[] | |
value | string | Vide, sauf avec decrypt=true pour une variable non sensible. |
Exemple
curl -X PATCH "https://api.host.hgdc.ch/v10/projects/<idOrName>/env/<id>" \ -H "Authorization: Bearer $VERCEL_TOKEN" \ -H "Content-Type: application/json" \ -d '{"key":"exemple","value":"exemple","type":"plain"}'Réponse 200 :
{ "id": "exemple", "key": "exemple", "type": "encrypted", "target": [ "production" ], "value": "exemple"}GET /v9/projects/{idOrName}/domains
Domaines d’un projet
Demande une clé d’API avec la portée host:read.
Réponses
| Code | Description | Corps |
|---|---|---|
200 | Succès | objet |
400 | Requête invalide | VercelError |
401 | Authentification requise | VercelError |
403 | Accès refusé | VercelError |
404 | Ressource introuvable | VercelError |
429 | Trop de requêtes | VercelError |
500 | Erreur interne | VercelError |
Champs de la réponse 200
| Champ | Type | Description |
|---|---|---|
domains | objet[] | |
domains[].name | string | |
domains[].verified | boolean | |
domains[].redirect | string ou null | |
domains[].gitBranch | string ou null | |
pagination | objet | |
pagination.count | number | |
pagination.next | number ou null |
Exemple
curl -X GET "https://api.host.hgdc.ch/v9/projects/<idOrName>/domains" \ -H "Authorization: Bearer $VERCEL_TOKEN"Réponse 200 :
{ "domains": [ { "name": "exemple", "verified": true, "redirect": "exemple", "gitBranch": "exemple" } ], "pagination": { "count": 1, "next": 1 }}POST /v10/projects/{idOrName}/domains
Ajouter un domaine (preuve TXT à publier)
Demande une clé d’API avec la portée host:domains.
Corps de la requête
Type de contenu : application/json.
| Champ | Type | Obligatoire | Description |
|---|---|---|---|
name | string | Oui | |
redirect | string | Non | |
redirectStatusCode | number | Non | |
gitBranch | string | Non |
Réponses
| Code | Description | Corps |
|---|---|---|
200 | Succès | objet |
400 | Requête invalide | VercelError |
401 | Authentification requise | VercelError |
403 | Accès refusé | VercelError |
404 | Ressource introuvable | VercelError |
429 | Trop de requêtes | VercelError |
500 | Erreur interne | VercelError |
Champs de la réponse 200
| Champ | Type | Description |
|---|---|---|
name | string | |
verified | boolean | |
redirect | string ou null | |
gitBranch | string ou null |
Exemple
curl -X POST "https://api.host.hgdc.ch/v10/projects/<idOrName>/domains" \ -H "Authorization: Bearer $VERCEL_TOKEN" \ -H "Content-Type: application/json" \ -d '{"name":"exemple"}'Réponse 200 :
{ "name": "exemple", "verified": true, "redirect": "exemple", "gitBranch": "exemple"}GET /v9/projects/{idOrName}/domains/{domain}
Un domaine
Demande une clé d’API avec la portée host:read.
Réponses
| Code | Description | Corps |
|---|---|---|
200 | Succès | objet |
400 | Requête invalide | VercelError |
401 | Authentification requise | VercelError |
403 | Accès refusé | VercelError |
404 | Ressource introuvable | VercelError |
429 | Trop de requêtes | VercelError |
500 | Erreur interne | VercelError |
Champs de la réponse 200
| Champ | Type | Description |
|---|---|---|
name | string | |
verified | boolean | |
redirect | string ou null | |
gitBranch | string ou null |
Exemple
curl -X GET "https://api.host.hgdc.ch/v9/projects/<idOrName>/domains/<domain>" \ -H "Authorization: Bearer $VERCEL_TOKEN"Réponse 200 :
{ "name": "exemple", "verified": true, "redirect": "exemple", "gitBranch": "exemple"}DELETE /v9/projects/{idOrName}/domains/{domain}
Retirer un domaine
Demande une clé d’API avec la portée host:domains.
Réponses
| Code | Description | Corps |
|---|---|---|
200 | Succès | |
400 | Requête invalide | VercelError |
401 | Authentification requise | VercelError |
403 | Accès refusé | VercelError |
404 | Ressource introuvable | VercelError |
429 | Trop de requêtes | VercelError |
500 | Erreur interne | VercelError |
Exemple
curl -X DELETE "https://api.host.hgdc.ch/v9/projects/<idOrName>/domains/<domain>" \ -H "Authorization: Bearer $VERCEL_TOKEN"POST /v9/projects/{idOrName}/domains/{domain}/verify
Vérifier le DNS d’un domaine
Demande une clé d’API avec la portée host:domains.
Réponses
| Code | Description | Corps |
|---|---|---|
200 | Succès | objet |
400 | Requête invalide | VercelError |
401 | Authentification requise | VercelError |
403 | Accès refusé | VercelError |
404 | Ressource introuvable | VercelError |
429 | Trop de requêtes | VercelError |
500 | Erreur interne | VercelError |
Champs de la réponse 200
| Champ | Type | Description |
|---|---|---|
name | string | |
verified | boolean | |
redirect | string ou null | |
gitBranch | string ou null |
Exemple
curl -X POST "https://api.host.hgdc.ch/v9/projects/<idOrName>/domains/<domain>/verify" \ -H "Authorization: Bearer $VERCEL_TOKEN"Réponse 200 :
{ "name": "exemple", "verified": true, "redirect": "exemple", "gitBranch": "exemple"}Cette page t'a aidé ?
Merci, c'est noté.