Run scenario - 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} / schedule

Try it

Run scenario

cURL

curl --request POST \
  --url https://api-trial.cognigy.ai/testing/simulations/{simulationReference}/schedule \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "projectReference": "<string>",
  "name": "<string>",
  "numberOfExecutions": 2,
  "runConfig": {
    "flowReferenceId": "<string>",
    "entrypoint": "<string>",
    "largeLanguageModelReferenceId": "<string>",
    "localeReferenceId": "<string>",
    "userId": "<string>",
    "data": {},
    "enableMocking": true
  },
  "endPointType": "<string>"
}
'```

### Python
```python
import requests

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

payload = {
    "projectReference": "<string>",
    "name": "<string>",
    "numberOfExecutions": 2,
    "runConfig": {
        "flowReferenceId": "<string>",
        "entrypoint": "<string>",
        "largeLanguageModelReferenceId": "<string>",
        "localeReferenceId": "<string>",
        "userId": "<string>",
        "data": {},
        "enableMocking": True
    },
    "endPointType": "<string>"
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

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

print(response.text)

JavaScript (Fetch)

const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: JSON.stringify({
    projectReference: '<string>',
    name: '<string>',
    numberOfExecutions: 2,
    runConfig: {
      flowReferenceId: '<string>',
      entrypoint: '<string>',
      largeLanguageModelReferenceId: '<string>',
      localeReferenceId: '<string>',
      userId: '<string>',
      data: {},
      enableMocking: true
    },
    endPointType: '<string>'
  })
};

fetch('https://api-trial.cognigy.ai/testing/simulations/{simulationReference}/schedule', 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}/schedule",
  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>',
    'name' => '<string>',
    'numberOfExecutions' => 2,
    'runConfig' => [
        'flowReferenceId' => '<string>',
        'entrypoint' => '<string>',
        'largeLanguageModelReferenceId' => '<string>',
        'localeReferenceId' => '<string>',
        'userId' => '<string>',
        'data' => [

],
        'enableMocking' => true
    ],
    'endPointType' => '<string>'
  ]),
  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;
}

Go

package main

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

func main() {

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

payload := strings.NewReader("{\n  \"projectReference\": \"<string>\",\n  \"name\": \"<string>\",\n  \"numberOfExecutions\": 2,\n  \"runConfig\": {\n    \"flowReferenceId\": \"<string>\",\n    \"entrypoint\": \"<string>\",\n    \"largeLanguageModelReferenceId\": \"<string>\",\n    \"localeReferenceId\": \"<string>\",\n    \"userId\": \"<string>\",\n    \"data\": {},\n    \"enableMocking\": true\n  },\n  \"endPointType\": \"<string>\"}")

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))
}

Responses

Success Response (201)

{
  "id": "<string>",
  "referenceId": "<string>",
  "simulationReference": "<string>",
  "runs": 123,
  "completedRuns": 123,
  "failedRuns": 123,
  "createdAt": 123,
  "startedAt": 123,
  "completedAt": 123
}

Error Response (Bad Request)

{
  "error": "<string>",
  "field": "<string>",
  "code": "<string>",
  "traceId": "<string>"
}

Authorizations