<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Create custom aspect and that assign property using Rest API in Alfresco Forum</title>
    <link>https://connect.hyland.com/t5/alfresco-forum/create-custom-aspect-and-that-assign-property-using-rest-api/m-p/98354#M28681</link>
    <description>&lt;P&gt;Hi, I am a new user of Alfresco. I need to understand if it is possible to create a custom aspect and assign propertis as specified here:&amp;nbsp;&lt;A title="Create Customer Aspect" href="https://docs.alfresco.com/6.1/tasks/admintools-custom-type-create.html" target="_self" rel="nofollow noopener noreferrer"&gt;Create Customer Aspect&lt;/A&gt;&amp;nbsp;but using rest API or CURL command?&amp;nbsp;&lt;/P&gt;&lt;P&gt;I will be using the aspect to create rules on folders. That also has to be done using the rest API or Command-line as we have to turn off the shared service. Thanks&lt;/P&gt;</description>
    <pubDate>Wed, 28 Oct 2020 17:47:11 GMT</pubDate>
    <dc:creator>ssaimon</dc:creator>
    <dc:date>2020-10-28T17:47:11Z</dc:date>
    <item>
      <title>Create custom aspect and that assign property using Rest API</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/create-custom-aspect-and-that-assign-property-using-rest-api/m-p/98354#M28681</link>
      <description>&lt;P&gt;Hi, I am a new user of Alfresco. I need to understand if it is possible to create a custom aspect and assign propertis as specified here:&amp;nbsp;&lt;A title="Create Customer Aspect" href="https://docs.alfresco.com/6.1/tasks/admintools-custom-type-create.html" target="_self" rel="nofollow noopener noreferrer"&gt;Create Customer Aspect&lt;/A&gt;&amp;nbsp;but using rest API or CURL command?&amp;nbsp;&lt;/P&gt;&lt;P&gt;I will be using the aspect to create rules on folders. That also has to be done using the rest API or Command-line as we have to turn off the shared service. Thanks&lt;/P&gt;</description>
      <pubDate>Wed, 28 Oct 2020 17:47:11 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/create-custom-aspect-and-that-assign-property-using-rest-api/m-p/98354#M28681</guid>
      <dc:creator>ssaimon</dc:creator>
      <dc:date>2020-10-28T17:47:11Z</dc:date>
    </item>
    <item>
      <title>Re: Create custom aspect and that assign property using Rest API</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/create-custom-aspect-and-that-assign-property-using-rest-api/m-p/98355#M28682</link>
      <description>&lt;P&gt;As far as i know, there are no API endpoints which lets you use model manager.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Reference to all V1 Apis can be found here:&amp;nbsp;&lt;A href="https://api-explorer.alfresco.com/api-explorer/#/" target="_blank" rel="nofollow noopener noreferrer"&gt;https://api-explorer.alfresco.com/api-explorer/#/&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Even there are no repository apis that can help using the model manager.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If your goal is to create aspects and models for the purpose of handling rules/behaviors, i would recommend &lt;A href="https://docs.alfresco.com/5.2/tasks/deploy-bootstrap.html" target="_blank" rel="noopener nofollow noreferrer"&gt;bootstrapping&lt;/A&gt; it.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If your requirement is that you create aspects and properties very frequently you can also use dynamic model deployment approach :&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://docs.alfresco.com/5.2/tasks/deploy-dynamic.html" target="_blank" rel="nofollow noopener noreferrer"&gt;https://docs.alfresco.com/5.2/tasks/deploy-dynamic.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://docs.alfresco.com/5.2/concepts/content-model-deploy.html" target="_blank" rel="nofollow noopener noreferrer"&gt;https://docs.alfresco.com/5.2/concepts/content-model-deploy.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;And manage them via admin console:&amp;nbsp;&lt;A href="https://docs.alfresco.com/5.2/tasks/adminconsole-modelconsole.html" target="_blank" rel="nofollow noopener noreferrer"&gt;https://docs.alfresco.com/5.2/tasks/adminconsole-modelconsole.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Note that, you can make only incremental changes to the model.&lt;/P&gt;
&lt;P&gt;For you specific use case, you can upload the model XML file to&amp;nbsp;&lt;SPAN&gt;&lt;STRONG&gt;&lt;A href="https://docs.alfresco.com/5.2/tasks/deploy-dynamic.html" target="_blank" rel="noopener nofollow noreferrer"&gt;/Data Dictionary/Models&lt;/A&gt;&amp;nbsp;&lt;/STRONG&gt;folder&amp;nbsp;using &lt;STRONG&gt;&lt;A title="V1 Upload Rest API" href="https://docs.alfresco.com/5.2/concepts/dev-api-by-language-alf-rest-upload-file.html" target="_blank" rel="noopener nofollow noreferrer"&gt;V1 Upload Rest API&lt;/A&gt;&lt;/STRONG&gt;&amp;nbsp;or &lt;A href="https://docs.alfresco.com/5.0/references/RESTful-UploadUploadPost.html" target="_blank" rel="noopener nofollow noreferrer"&gt;&lt;STRONG&gt;Respository FileUpload API&lt;/STRONG&gt;&lt;/A&gt; and then&amp;nbsp;&lt;A href="https://docs.alfresco.com/5.2/tasks/deploy-dynamic.html" target="_blank" rel="noopener nofollow noreferrer"&gt;enable it via Is Active flag (cm:modelActive)&lt;/A&gt; of&amp;nbsp;the content model via share ui or &lt;A href="https://docs.alfresco.com/5.2/tasks/adminconsole-modelconsole.html" target="_blank" rel="noopener nofollow noreferrer"&gt;use admin console to activate/deploy the model&lt;/A&gt;.&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;&lt;SPAN&gt;Here are some list of api calls which can help you achieve what you are looking for:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;1- Get the node id of&amp;nbsp;&lt;STRONG&gt;&lt;A href="https://docs.alfresco.com/5.2/tasks/deploy-dynamic.html" target="_blank" rel="noopener nofollow noreferrer"&gt;/Data Dictionary/Models&lt;/A&gt; &lt;/STRONG&gt;folder using below API call:&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;A href="https://docs.alfresco.com/5.2/concepts/dev-api-by-language-alf-rest-list-children-root-folder.html" target="_blank" rel="noopener nofollow noreferrer"&gt;GET Model Folder Id&lt;/A&gt;&amp;nbsp;: 

curl -X GET "http://localhost:8080/alfresco/api/-default-/public/alfresco/versions/1/nodes/-root-/children?relativePath=Data%20Dictionary&amp;amp;skipCount=0&amp;amp;maxItems=100&amp;amp;alf_ticket=TICKET_f5cff7c76f7a87139f24dc0c6540dd1b57479552"&lt;/PRE&gt;
&lt;P&gt;From the response grab the "id" which is the nodeRef id of Models folder.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;e.g.:&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;{
                "entry": {
                    "createdAt": "2020-10-28T19:33:22.851+0000",
                    "isFolder": true,
                    "isFile": false,
                    "createdByUser": {
                        "id": "System",
                        "displayName": "System"
                    },
                    "modifiedAt": "2020-10-28T20:53:26.872+0000",
                    "modifiedByUser": {
                        "id": "admin",
                        "displayName": "Administrator"
                    },
                    "name": "Models",
&lt;STRONG&gt;                    "id": "a9a9f477-5c57-11dc-ad6c-5136d620963c",
&lt;/STRONG&gt;                    "nodeType": "cm:folder",
                    "parentId": "4de64712-954c-44b6-b439-890c1550bcc1"
                }
            }&lt;/PRE&gt;
&lt;P&gt;2- Use the upload api to upload the model file into Data Dictionary/Models folder:&lt;/P&gt;
&lt;PRE&gt;&lt;A href="https://docs.alfresco.com/5.2/concepts/dev-api-by-language-alf-rest-upload-file.html" target="_self" rel="nofollow noopener noreferrer"&gt;Upload model xml to Data Dictionary/Models&lt;/A&gt;:

curl -X POST -F filedata=@pub-model.xml http://localhost:8080/alfresco/api/-default-/public/alfresco/versions/1/nodes/&lt;STRONG&gt;a9a9f477-5c57-11dc-ad6c-5136d620963c/children&lt;/STRONG&gt;?alf_ticket=TICKET_f5cff7c76f7a87139f24dc0c6540dd1b57479552&lt;/PRE&gt;
&lt;P&gt;3- Activate the model, grab the node id of the model xml from the upload response (see highligted in the url below):&lt;/P&gt;
&lt;PRE&gt;&lt;A href="https://docs.alfresco.com/5.2/concepts/dev-api-by-language-alf-rest-update-node-metadata.html" target="_blank" rel="noopener nofollow noreferrer"&gt;Update cm:modelActive property&lt;/A&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;curl -X PUT -H 'Content-Type: application/json' -H 'Accept: application/json' -d '{"properties": { "&lt;STRONG&gt;cm:modelActive":true&lt;/STRONG&gt;}}' 'http://localhost:8080/alfresco/api/-default-/public/alfresco/versions/1/nodes/&lt;STRONG&gt;1a8345f6-1b66-48b1-a581-1319f3d6bfbd&lt;/STRONG&gt;?alf_ticket=TICKET_f5cff7c76f7a87139f24dc0c6540dd1b57479552'
&lt;/PRE&gt;

&lt;P&gt;You can also try uploading the model xml with cm:modelActive property using below api call if it works for you:&lt;/P&gt;
&lt;PRE&gt;curl -X POST -F filedata=@pub-model.xml &lt;STRONG&gt;-F "cm:modelActive=true"&lt;/STRONG&gt; http://localhost:8080/alfresco/api/-default-/public/alfresco/versions/1/nodes/a9a9f477-5c57-11dc-ad6c-5136d620963c/children?alf_ticket=TICKET_f5cff7c76f7a87139f24dc0c6540dd1b57479552&lt;/PRE&gt;</description>
      <pubDate>Wed, 28 Oct 2020 21:24:35 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/create-custom-aspect-and-that-assign-property-using-rest-api/m-p/98355#M28682</guid>
      <dc:creator>abhinavmishra14</dc:creator>
      <dc:date>2020-10-28T21:24:35Z</dc:date>
    </item>
  </channel>
</rss>

