Set a property of type d:content via REST API

cancel
Showing results for 
Search instead for 
Did you mean: 
daniil
Member II

Set a property of type d:content via REST API

Jump to solution

Hi all,


How would I create a new node with d:content property via REST API?

I created a custom type containing a property of type d:content:

<type name="thy:daniilFolder">
    <title>Daniil Folder</title>
    <parent>cm:folder</parent>
    <properties>
        <property name="thy:folderProp">
            <type>d:text</type>
        </property>
        <property name="thy:folderDoc">
            <type>d:content</type>
            <mandatory>false</mandatory>
            <index enabled="true">
                <atomic>false</atomic>
                <stored>false</stored>
                <tokenised>true</tokenised>
            </index>
        </property>
    </properties>
</type>

I'm trying to create a new node of this type using nodes/{nodeId}/children REST API like so:

{
"name":"Daniil Folder 2019",
"nodeType":"thy:daniilFolder",
"properties": {
"thy:folderProp": "Some prop",
"thy:folderDoc": "...base64-encoded representation of a PDF file..."
}
}


thy:folderProp gets set correctly, however thy:folderDoc is being set to an empty file:

"thy:folderDoc": {
"size": 0,
"locale": "en_US",
"id": 392,
"infoUrl": "contentUrl=|mimetype=|size=0|encoding=|locale=en_US_"
}

1 Solution

Accepted Solutions
afaust
Master

Re: Set a property of type d:content via REST API

Jump to solution

As far as I can see from both the API Explorer and the low-level code, the public V1 REST API does not support dealing with any custom d:content properties. Only cm:content is supported (actually hard-coded).

View solution in original post

3 Replies
afaust
Master

Re: Set a property of type d:content via REST API

Jump to solution

As far as I can see from both the API Explorer and the low-level code, the public V1 REST API does not support dealing with any custom d:content properties. Only cm:content is supported (actually hard-coded).

daniil
Member II

Re: Set a property of type d:content via REST API

Jump to solution

Thanks for the info, Axel!
Looks like I'll have to store base64 representation of a file and mimetype inside a d:any field.

afaust
Master

Re: Set a property of type d:content via REST API

Jump to solution

Or you could just use an API that is a bit more suited to the use case, e.g. CMIS via Browser binding, instead of completely messing up the data storage. Any Base64 data in a d:any will be stored as a blob in the database instead of content on disk, and will seriously impact the performance of the DB the more data is being stored in that way.