Craft 3 plugin to import channel entries I try to finish a plugin which imports data into my craftcms project. I already created a console based method/service, which I trigger/run in my shell. Inside my method(s) I receive data (XML or JSON) I parse my data and try to create and fill an entry of a specific channel I already created.

I tried "saveElement()" which doesn't work.

I found some tuts and informations for craftcms v2 (for example: https://docs.craftcms.com/api/v2/craft-entriesservice.html#public-methods)

Now i am stuck and i can not find any informations on how to solve this with craftcms v3.

Here is my last version of code after hours of different trys :(

$section = Craft::$app-&gt;sections-&gt;getSectionByHandle('testentry');
$entryTypes = $section-&gt;getEntryTypes();
$entryType = $entryTypes[0];
// Save Entry
//$entry = new EntryModel();
$entry = new \craft\elements\Entry();
$entry-&gt;sectionId = $section-&gt;id;
$entry-&gt;typeId = $entryType-&gt;id;
//$entry-&gt;locale = Craft::$app-&gt;i18n-&gt;getPrimarySiteLocaleId();
//$entry-&gt;authorId = 1;  // TODO:  Set author
$entry-&gt;enabled = true;
$entry-&gt;postDate = $post['post_date'];
$entry-&gt;slug = $post['post_name'];
//      $entry-&gt;getContent()-&gt;title = $post['post_title'];
//      $entry-&gt;setContentFromPost(array(
//          'body' =&gt; $postContent,
//          'categoryCareer' =&gt; NULL,
//      ));

if (Craft::$app-&gt;elements-&gt;saveElement($entry)) {
    $result = true;
} 
else {
    echo 'Could not save the Job entry.'."\n";
    $result = false;
}
As per your comments, the title field is required and causing a validation error. This can be resolved simply by setting the title.

$entry-&gt;title = 'The Title';


You can output the validation errors to be notified of any issues with saving the entries as follows.

if ($result === false) {
    \Craft:dd($entry-&gt;getErrors());
}