ContentOnTarget supports you to update a core. 

Request

The URL for updating a Core includes the coreName:

/api/2.2/[user]/[apiHash_User]/cores/[coreName]

Using this URL, a cpre is updated by sending a PUT request with a JSON body:

{
      
      "coreName": "newCoreName",
      "apiHash": "newAPiHash-1",
      "coreSchema": "TestSchema"
}

Important: you can also update the underlying schema. However, this deletes all documents within the core. You have to reindex them as the document structure has changed.

Possible Fields

The fields are identical to the POST request.

Request Answer

The request answer corresponds to the operation state. Therefore, a http status of 200 (OK) means the successful storage of the schema. Otherwise, a detailed error message is provided.

PHP Client Implementation

The PHP Client API provides full functionality to update schemas in ContentOnTarget.

<?php
include_once("ContentOnTarget-PHP-API-Client.php");
$config = $config = com\repalogic\ContentOnTarget\Client\Configuration::getConfig("https://api.shopontarget.com/", "user", "userApiHash", "core name does not matter here", "core api hash does not matter here");

$coreApi = new com\repalogic\ContentOnTarget\Client\CoreApi($config);
$core = $coreApi->getCore("myCore1");
$core->setApiHash("newApiHash");
$core->setCoreName("newCoreName1");
$result = $coreApi->updateCore($core);
var_dump($result);
?>