Update an Agent Copilot Configuration - Cognigy Documentation

Update an Agent Copilot Configuration

PATCH /v2.0/aicopilotconfigs/{configId}

Try it

cURL

curl --request PATCH \
  --url https://api-trial.cognigy.ai/new/v2.0/aicopilotconfigs/{configId} \
  --header 'Content-Type: application/json' \
  --header 'X-API-Key: <api-key>' \
  --data '
{
  "name": "<string>",
  "description": "<string>",
  "config": {
    "grid": {
      "columns": 123,
      "rows": 123,
      "gap": 123
    },
    "tiles": {
      "tile-id": {
        "x": 123,
        "y": 123,
        "columns": 123,
        "rows": 123
      }
    }
  }
}
'` 

Python

import requests

url = "https://api-trial.cognigy.ai/new/v2.0/aicopilotconfigs/{configId}"

payload = {
    "name": "<string>",
    "description": "<string>",
    "config": {
        "grid": {
            "columns": 123,
            "rows": 123,
            "gap": 123
        },
        "tiles": { "tile-id": {
                "x": 123,
                "y": 123,
                "columns": 123,
                "rows": 123
            } }
    }
}
headers = {
    "X-API-Key": "<api-key>",
    "Content-Type": "application/json"
}

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

print(response.text)

JavaScript

const options = {
  method: 'PATCH',
  headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
  body: JSON.stringify({
    name: '<string>',
    description: '<string>',
    config: {
      grid: {columns: 123, rows: 123, gap: 123},
      tiles: {'tile-id': {x: 123, y: 123, columns: 123, rows: 123}}
    }
  })
};

fetch('https://api-trial.cognigy.ai/new/v2.0/aicopilotconfigs/{configId}', 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/new/v2.0/aicopilotconfigs/{configId}",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "PATCH",
  CURLOPT_POSTFIELDS => json_encode([
    'name' => '<string>',
    'description' => '<string>',
    'config' => [
        'grid' => [
                'columns' => 123,
                'rows' => 123,
                'gap' => 123
        ],
        'tiles' => [
                'tile-id' => [
                                'x' => 123,
                                'y' => 123,
                                'columns' => 123,
                                'rows' => 123
                ]
        ]
    ]
  ]),
  CURLOPT_HTTPHEADER => [
    "Content-Type: application/json",
    "X-API-Key: <api-key>"
  ],
]);
$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/new/v2.0/aicopilotconfigs/{configId}"

payload := strings.NewReader("{\n  \"name\": \"<string>\",\n  \"description\": \"<string>\",\n  \"config\": {\n    \"grid\": {\n      \"columns\": 123,\n      \"rows\": 123,\n      \"gap\": 123\n    },\n    \"tiles\": {\n      \"tile-id\": {\n        \"x\": 123,\n        \"y\": 123,\n        \"columns\": 123,\n        \"rows\": 123\n      }\n    }\n  }\n}")

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

req.Header.Add("X-API-Key", "<api-key>")
    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))
}

HTTP Responses

204 The Agent Copilot Configuration was successfully updated.