Create a scheduler for a simulation - Cognigy Documentation

Documentation Index

Fetch the complete documentation index at: /llms.txt

Use this file to discover all available pages before exploring further.

POST

/simulations/{simulationReference}/schedules

Try it

Create a scheduler for a simulation

cURL

curl --request POST \
  --url https://api-trial.cognigy.ai/testing/simulations/{simulationReference}/schedules \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "projectReference": "<string>",
  "runConfig": {
    "flowReferenceId": "<string>",
    "entrypoint": "<string>",
    "largeLanguageModelReferenceId": "<string>",
    "localeReferenceId": "<string>",
    "userId": "<string>",
    "finalPing": 123,
    "data": {},
    "enableMocking": true
  },
  "time": "2023-11-07T05:31:56Z",
  "runName": "<string>",
  "enableSchedule": true,
  "numberOfRuns": 123,
  "nextScheduledRun": "2023-11-07T05:31:56Z",
  "emailNotifications": [
    "<string>"
  ],
  "scenarioName": "<string>",
  "endDate": "2023-11-07T05:31:56Z"
}
'
import requests

url = "https://api-trial.cognigy.ai/testing/simulations/{simulationReference}/schedules"

payload = {
    "projectReference": "<string>",
    "runConfig": {
        "flowReferenceId": "<string>",
        "entrypoint": "<string>",
        "largeLanguageModelReferenceId": "<string>",
        "localeReferenceId": "<string>",
        "userId": "<string>",
        "finalPing": 123,
        "data": {},
        "enableMocking": True
    },
    "time": "2023-11-07T05:31:56Z",
    "runName": "<string>",
    "enableSchedule": True,
    "numberOfRuns": 123,
    "nextScheduledRun": "2023-11-07T05:31:56Z",
    "emailNotifications": ["<string>"],
    "scenarioName": "<string>",
    "endDate": "2023-11-07T05:31:56Z"
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: JSON.stringify({
    projectReference: '<string>',
    runConfig: {
      flowReferenceId: '<string>',
      entrypoint: '<string>',
      largeLanguageModelReferenceId: '<string>',
      localeReferenceId: '<string>',
      userId: '<string>',
      finalPing: 123,
      data: {},
      enableMocking: true
    },
    time: '2023-11-07T05:31:56Z',
    runName: '<string>',
    enableSchedule: true,
    numberOfRuns: 123,
    nextScheduledRun: '2023-11-07T05:31:56Z',
    emailNotifications: ['<string>'],
    scenarioName: '<string>',
    endDate: '2023-11-07T05:31:56Z'
  })
};

fetch('https://api-trial.cognigy.ai/testing/simulations/{simulationReference}/schedules', 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-trial.cognigy.ai/testing/simulations/{simulationReference}/schedules",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => json_encode([
    'projectReference' => '<string>',
    'runConfig' => [
        'flowReferenceId' => '<string>',
        'entrypoint' => '<string>',
        'largeLanguageModelReferenceId' => '<string>',
        'localeReferenceId' => '<string>',
        'userId' => '<string>',
        'finalPing' => 123,
        'data' => [],
        'enableMocking' => true
    ],
    'time' => '2023-11-07T05:31:56Z',
    'runName' => '<string>',
    'enableSchedule' => true,
    'numberOfRuns' => 123,
    'nextScheduledRun' => '2023-11-07T05:31:56Z',
    'emailNotifications' => ['<string>'],
    'scenarioName' => '<string>',
    'endDate' => '2023-11-07T05:31:56Z'
  ]),
  CURLOPT_HTTPHEADER => [
    "Authorization: Bearer <token>",
    "Content-Type: application/json"
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
?>
package main

import (
    "fmt"
    "strings"
    "net/http"
    "io"
)

func main() {

url := "https://api-trial.cognigy.ai/testing/simulations/{simulationReference}/schedules"

payload := strings.NewReader("{\n  \"projectReference\": \"<string>\",\n  \"runConfig\": {\n    \"flowReferenceId\": \"<string>\",\n    \"entrypoint\": \"<string>\",\n    \"largeLanguageModelReferenceId\": \"<string>\",\n    \"localeReferenceId\": \"<string>\",\n    \"userId\": \"<string>\",\n    \"finalPing\": 123,\n    \"data\": {},\n    \"enableMocking\": true\n  },\n  \"time\": \"2023-11-07T05:31:56Z\",\n  \"runName\": \"<string>\",\n  \"enableSchedule\": true,\n  \"numberOfRuns\": 123,\n  \"nextScheduledRun\": \"2023-11-07T05:31:56Z\",\n  \"emailNotifications\": [\n    \"<string>\"\n  ],\n  \"scenarioName\": \"<string>\",\n  \"endDate\": \"2023-11-07T05:31:56Z\"}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("Authorization", "Bearer <token>")
    req.Header.Add("Content-Type", "application/json")

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-trial.cognigy.ai/testing/simulations/{simulationReference}/schedules")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"projectReference\": \"<string>\",\n  \"runConfig\": {\n    \"flowReferenceId\": \"<string>\",\n    \"entrypoint\": \"<string>\",\n    \"largeLanguageModelReferenceId\": \"<string>\",\n    \"localeReferenceId\": \"<string>\",\n    \"userId\": \"<string>\",\n    \"finalPing\": 123,\n    \"data\": {},\n    \"enableMocking\": true\n  },\n  \"time\": \"2023-11-07T05:31:56Z\",\n  \"runName\": \"<string>\",\n  \"enableSchedule\": true,\n  \"numberOfRuns\": 123,\n  \"nextScheduledRun\": \"2023-11-07T05:31:56Z\",\n  \"emailNotifications\": [\n    \"<string>\"\n  ],\n  \"scenarioName\": \"<string>\",\n  \"endDate\": \"2023-11-07T05:31:56Z\"}")
  .asString();
require 'uri'
require 'net/http'

url = URI("https://api-trial.cognigy.ai/testing/simulations/{simulationReference}/schedules")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"projectReference\": \"<string>\",\n  \"runConfig\": {\n    \"flowReferenceId\": \"<string>\",\n    \"entrypoint\": \"<string>\",\n    \"largeLanguageModelReferenceId\": \"<string>\",\n    \"localeReferenceId\": \"<string>\",\n    \"userId\": \"<string>\",\n    \"finalPing\": 123,\n    \"data\": {},\n    \"enableMocking\": true\n  },\n  \"time\": \"2023-11-07T05:31:56Z\",\n  \"runName\": \"<string>\",\n  \"enableSchedule\": true,\n  \"numberOfRuns\": 123,\n  \"nextScheduledRun\": \"2023-11-07T05:31:56Z\",\n  \"emailNotifications\": [\n    \"<string>\"\n  ],\n  \"scenarioName\": \"<string>\",\n  \"endDate\": \"2023-11-07T05:31:56Z\"}"

response = http.request(request)
puts response.read_body

201

400

401

403

500

{
  "scheduler": {
    "id": "<string>",
    "simulationReference": "<string>",
    "projectReference": "<string>",
    "organisationReference": "<string>",
    "runConfig": {
      "flowReferenceId": "<string>",
      "localeReferenceId": "<string>",
      "entrypoint": "<string>",
      "largeLanguageModelReferenceId": "<string>",
      "userId": "<string>",
      "finalPing": 123,
      "data": {},
      "enableMocking": true
    },
    "enableSchedule": true,
    "time": "2023-11-07T05:31:56Z",
    "numberOfRuns": 123,
    "nextScheduledRun": "2023-11-07T05:31:56Z",
    "emailNotifications": [
      "<string>"
    ],
    "scenarioName": "<string>",
    "runName": "<string>",
    "endDate": "2023-11-07T05:31:56Z",
    "createdAt": 123,
    "lastChanged": 123,
    "createdBy": "<string>",
    "lastChangedBy": "<string>",
    "cronScheduler": "<string>",
    "timezone": "Europe/Berlin"
  }
}
{
  "error": "<string>",
  "field": "<string>",
  "code": "<string>",
  "traceId": "<string>"
}
{
  "error": "<string>",
  "code": "<string>",
  "traceId": "<string>"
}
{
  "error": "<string>",
  "code": "<string>",
  "traceId": "<string>"
}
{
  "error": "<string>",
  "code": "<string>",
  "traceId": "<string>"
}