webCOMAND

importer::import_from_string()

Imports objects from a string that contains text in well-formed cJSON or CSV format.

Prototype

mixed import_from_string(string $string)

Parameters

  • string - Text in well-formed cJSON or CSV format.

Return

The number of imported objects, or FALSE if an error occurred.  Errors will be logged to the importer event log.

Example

$repo = comand::repo();
$cjson = '{"type": "COMAND", "version": "1.0", "contents": [{"Type":{"UUID": "45270d32-1dbd-1e11-7b76-35357616a88b"},"Title": "Test Folder"}]}';
$importer = new \io_comand_util\importer($repo);
$result = $importer->import_from_string($cjson);
if($result===FALSE) {
    echo($importer->event_log->as_html());
}

Related

import_from_file()