<p>No you can't. Craft will throw an exception when you insert an id that does not exist into the form. Is there a certain reason for your question? Maybe we could provide help on that. </p>

CC BY-SA 3.0
2018-03-22T22:07:48.463Z
i am trying to import content from api and insert to section[channel type], i am trying to insert id because it will be easy for me to find whether the content that i received from api already exist in my entires or not. if yes then i will just update the content rather than creating duplicate. It will work some how exactly like FeedMe plugin for craft 2.
sailendra mangranti
CC BY-SA 3.0
2018-03-22T22:12:01.243Z
The better approach would be to fetch to fetch the section by handle `$section = Craft::$app->getSections()->getSectionByHandle('yourHandle');` if it returns `null` you'll create a new section if not you'll work with that
Robin Schambach
CC BY-SA 3.0
2018-03-22T06:57:06.007Z
2018-03-22T06:57:06.007Z
Robin Schambach
<p>Is is possible to set the "section id" manually by using</p>

<p><code>Craft::$app-&gt;sections-&gt;saveSection($section);</code>?</p>

<p>Can we specify the id of a section in an <code>$section</code> array ?</p>

<craft3>
specifying section id manually while saving section
# specifying section id manually while saving section

(Asked by: username_0 on 2018-03-22)

Is is possible to set the "section id" manually by using

`Craft::$app->sections->saveSection($section);`?

Can we specify the id of a section in an `$section` array ?

**Tags:** craft3


---

## 1 answers

### Answer by username_1 on 2018-03-22. Score: 1 | Accepted answer

No you can't. Craft will throw an exception when you insert an id that does not exist into the form. Is there a certain reason for your question? Maybe we could provide help on that.

> **Comments:**
> **username_0**: i am trying to import content from api and insert to section[channel type], i am trying to insert id because it will be easy for me to find whether the content that i received from api already exist in my entires or not. if yes then i will just update the content rather than creating duplicate. It will work some how exactly like FeedMe plugin for craft 2.  
> **username_1**: The better approach would be to fetch to fetch the section by handle `$section = Craft::$app->getSections()->getSectionByHandle('yourHandle');` if it returns `null` you'll create a new section if not you'll work with that  

---

