Run a scheduled task
curl --request POST \
--url https://api.langdock.com/automations/v1/{automationId}/run \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.langdock.com/automations/v1/{automationId}/run"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.langdock.com/automations/v1/{automationId}/run', 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.langdock.com/automations/v1/{automationId}/run",
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.langdock.com/automations/v1/{automationId}/run"
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.langdock.com/automations/v1/{automationId}/run")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.langdock.com/automations/v1/{automationId}/run")
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_bodyScheduled Tasks API
Scheduled Task ausführen
Stelle einen Lauf einer Scheduled Task in die Queue, die diesem Workspace-API-Key gehört
POST
/
automations
/
v1
/
{automationId}
/
run
Run a scheduled task
curl --request POST \
--url https://api.langdock.com/automations/v1/{automationId}/run \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.langdock.com/automations/v1/{automationId}/run"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.langdock.com/automations/v1/{automationId}/run', 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.langdock.com/automations/v1/{automationId}/run",
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.langdock.com/automations/v1/{automationId}/run"
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.langdock.com/automations/v1/{automationId}/run")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.langdock.com/automations/v1/{automationId}/run")
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_bodyStellt einen Lauf einer Scheduled Task in die Queue, die diesem Workspace-API-Key gehört. Der Aufruf kehrt zurück, sobald der Lauf eingereiht ist. Er wartet nicht auf die Konversation.
Dieser Endpoint hat keinen Body. Du kannst eine pausierte Aufgabe ausführen. Der Lauf setzt
conversationId in dieser Antwort ist immer null. Nutze runId, um den eingereihten Lauf zu erkennen.
Basis-URL
https://api.langdock.com/automations/v1/{automationId}/run
Dedicated DeploymentsErsetze
api.langdock.com durch <your-deployment-url>/api/public in allen Anfragen.Benötigte Scopes
Dieser Endpoint braucht den ScopeAUTOMATION_API (Scheduled Tasks API) auf einem Workspace-API-Key.
Parameter
| Parameter | In | Typ | Pflicht | Beschreibung |
|---|---|---|---|---|
automationId | Pfad | string | Ja | UUID der Scheduled Task. |
active nicht von allein wieder auf true.
Beispiel
const axios = require("axios");
async function runScheduledTask(automationId) {
const response = await axios.post(
`https://api.langdock.com/automations/v1/${automationId}/run`,
null,
{
headers: {
Authorization: "Bearer YOUR_API_KEY"
}
}
);
console.log(response.data.runId);
}
runScheduledTask("550e8400-e29b-41d4-a716-446655440000");
Antwortformat
Erfolgreiche Antwort (200 OK)
{
runId: string;
conversationId: null;
}
Fehlerbehandlung
| Statuscode | Beschreibung |
|---|---|
| 400 | Ungültige Task-ID |
| 401 | Ungültiger oder fehlender API-Key, oder der Key-User wurde nicht gefunden |
| 403 | AUTOMATION_API fehlt, persönlicher API-Key, Scheduled Tasks deaktiviert, kein Produktzugriff oder Code TRIAL_EXPIRED |
| 404 | Message AUTOMATION_NOT_FOUND |
| 405 | Methode nicht erlaubt |
| 429 | Rate Limit überschritten |
| 500 | Interner Serverfehler |
Langdock blockiert Anfragen aus Browser-Origins absichtlich, um deinen API-Key zu schützen und deine Anwendungen sicher zu halten. Mehr dazu findest du im Guide zu API Key Best Practices.
War diese Seite hilfreich?