Déclencher une automatisation
Déclenchez immédiatement une automatisation planifiée, au lieu d’attendre sa prochaine heure planifiée. Utile pour exécuter des automatisations depuis des pipelines CI/CD, comme une GitHub Action qui s’exécute à chaque fusion sur votre branche par défaut. Seules les automatisations planifiées (avec un calendrier personnalisé) peuvent être déclenchées. L’exécution récupère les modifications effectuées depuis la dernière exécution terminée, à l’identique d’une exécution planifiée habituelle.
curl --request POST \
--url https://api.mintlify.com/v1/workflow/{projectId}/{workflowSchemaId}/trigger \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.mintlify.com/v1/workflow/{projectId}/{workflowSchemaId}/trigger"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.mintlify.com/v1/workflow/{projectId}/{workflowSchemaId}/trigger', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.mintlify.com/v1/workflow/{projectId}/{workflowSchemaId}/trigger",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.mintlify.com/v1/workflow/{projectId}/{workflowSchemaId}/trigger"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.mintlify.com/v1/workflow/{projectId}/{workflowSchemaId}/trigger")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.mintlify.com/v1/workflow/{projectId}/{workflowSchemaId}/trigger")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"schemaId": "<string>",
"instanceId": "<string>",
"jobId": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}400.
Cas d’utilisation
- Pipelines CI/CD : Exécutez l’automatisation Update from code changes à chaque fusion dans
main, afin que la documentation soit mise à jour au rythme de vos versions plutôt que selon un calendrier fixe. - Événements de version : Exécutez l’automatisation Draft changelog lorsque vous créez un tag de version, afin que le changelog soit rédigé au moment même où la version est publiée.
- Outillage personnalisé : Déclenchez des automatisations depuis vos outils internes, des commandes Slack ou des tâches planifiées que vous exécutez déjà.
Trouver l’identifiant de l’automatisation
Exemple
main :
on:
push:
branches: [main]
jobs:
trigger:
runs-on: ubuntu-latest
steps:
- run: |
curl -fsS -X POST \
"https://api.mintlify.com/v1/workflow/$PROJECT_ID/$WORKFLOW_ID/trigger" \
-H "Authorization: Bearer ${{ secrets.MINTLIFY_API_KEY }}"
env:
PROJECT_ID: ${{ vars.MINTLIFY_PROJECT_ID }}
WORKFLOW_ID: ${{ vars.MINTLIFY_WORKFLOW_ID }}
Limites de débit
Autorisations
Paramètres de chemin
Identifiant de l'automatisation à déclencher. Vous pouvez le copier depuis le panneau de paramètres de l'automatisation sur la page Automations de votre dashboard.
Réponse
Exécution de l'automatisation mise en file d'attente avec succès.
Identifiant de l'automatisation déclenchée.
Identifiant de l'exécution d'automatisation mise en file d'attente. Apparaît dans l'historique des exécutions sur la page Automation Runs.
Identifiant de la tâche d'arrière-plan qui traite l'exécution.
Cette page vous a-t-elle été utile ?
curl --request POST \
--url https://api.mintlify.com/v1/workflow/{projectId}/{workflowSchemaId}/trigger \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.mintlify.com/v1/workflow/{projectId}/{workflowSchemaId}/trigger"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.mintlify.com/v1/workflow/{projectId}/{workflowSchemaId}/trigger', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.mintlify.com/v1/workflow/{projectId}/{workflowSchemaId}/trigger",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.mintlify.com/v1/workflow/{projectId}/{workflowSchemaId}/trigger"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.mintlify.com/v1/workflow/{projectId}/{workflowSchemaId}/trigger")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.mintlify.com/v1/workflow/{projectId}/{workflowSchemaId}/trigger")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"schemaId": "<string>",
"instanceId": "<string>",
"jobId": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}