Using Plone API t to create new instance of a content type i create

I'm working in Plone 6 Classic.

I'm working with a programmer to use Plone API to create new content on the plone site. The content I want to create is a new instance of a custom product i am creating.

  1. I looked at the Plone API, i understand how to use it to create Plone-defined content types (e.g. Page, File)
    (Content Types — plone.restapi v8.24.2.dev0)

  2. My question is how to do this for a custom content type. Can I define endpoint (I think that is the correct term) in my content type such that i can use the Plone API (create a new API element) to create a new instance of the content type (including title, content, etc.)??

Based on what I've seen, I believe (2) can't be done without adding to the API.

Seems the basic question is my assumption above correct: will how have to add to the API?

Note: I know from past experience i can create new instance of content type from Word document by using a parser and custom code to create CT. however, API seems much smoother.

Wayne Glover via Plone Community wrote at 2023-6-14 00:11 +0000:

...
2) My question is how to do this for a custom content type. Can I define endpoint (I think that is the correct term) in my content type such that i can use the Plone API (create a new API element) to create a new instance of the content type (including title, content, etc.)??

Plone delegates the construction of the content object to the respective
type (more precisely TypeInformation).

When you look at the API code (--> plone.api.content.create),
you see that the construction is performed via
container.invokeFactory(type, content_id, **kwargs).
This looks up the type (information) object and calls its
constructInstance to get the content object constructed.
Thus, defining your custom type, you can precisely control
how to create your content objects.

dexterity content types typically use plone.dexterity.fti.DexterityFTI
as type (information). The corresponding constructInstance
is implemented in
Products.CMFCore.TypesTool.TypeInformation.constructInstance.
This delegates to
Products.CMFCore.TypesTool.FactoryTypeInformation._constructInstance.
There, you will find details how to provide your own content
object construction.

I think you want to create content with Plone REST API Content Manipulation – REST API – Usage — Plone Documentation v6.0 rather than creating content with plone.api Content – Backend – <code class="docutils literal notranslate"><span class="pre">plone.api</span></code> — Plone Documentation v6.0

If your custom content type is a dexterity content type you can simply use the RESTAPI without creating your entry points.

See the following example and the RESTAPI documentation

requests.post(
    'http://nohost/plone/folder',
    headers={'Accept': 'application/json', 'Content-Type': 'application/json'},
    json={
        '@type': 'YourType',
        'title': 'YourTitle', 
        ... 
    },
    auth=('admin', 'secret')
)