Example: Workflow, Content Type and Content via REST

Last Updated: Jun 20, 2019
documentation for the dotCMS Content Management System

Intention

Describe how to create and interact with a Workflow on DotCMS by using Rest on a Caas philosophy

DotCMS 5.x has introduced a lot of improvements to workflow, now almost every action on dotCMS is a workflow, it means you can handle permissions and customize actions such as “Save/Publish” in order to add custom or different behaviors, etc.

Let’s start creating a new Workflow, with Steps and Actions:

Create a Workflow Scheme using REST

Adding a Workflow Scheme

All you need to create an empty scheme is just the name and the description.

curl -u admin@dotcms.com:admin -X POST https://demo.dotcms.com/api/v1/workflow/schemes -H "Content-Type:application/json" -d '{ 
    "schemeName":"Test Scheme", 
    "schemeDescription":"This is a test scheme"
    }'

Output:

{
   "errors":[

   ],
   "entity":{
      "id":"3b5b81ed-8461-4af7-8960-57db7ca00b46",
      "creationDate":1538412762392,
      "name":"Test Scheme",
      "description":"This is a test scheme",
      "archived":false,
      "mandatory":false,
      "defaultScheme":false,
      "modDate":1538412762392,
      "entryActionId":null,
      "system":false
   },
   "messages":[

   ],
   "i18nMessagesMap":{

   },
   "permissions":[

   ]
}

As you can see our Test Scheme has been already created.

Adding Steps

Now we are going to add three steps: Unpublish, Publish, Archive

Adding the “Unpublish”, we are not going to use the escalationAction nor time, so we pass them empty.

curl -u admin@dotcms.com:admin -X POST https://demo.dotcms.com/api/v1/workflow/steps -H "Content-Type:application/json" -d '{ 
    "schemeId":"3b5b81ed-8461-4af7-8960-57db7ca00b46", 
    "stepName":"Unpublish", 
    "escalationAction":"",
    "escalationTime":"" 
    }'

OUTPUT

{
   "errors":[

   ],
   "entity":{
      "id":"a9ec35d5-d0bd-4c8f-916b-4daa17858974",
      "creationDate":1548963298453,
      "name":"Unpublish",
      "schemeId":"3b5b81ed-8461-4af7-8960-57db7ca00b46",
      "myOrder":0,
      "resolved":false,
      "enableEscalation":false,
      "escalationAction":null,
      "escalationTime":0
   },
   "messages":[

   ],
   "i18nMessagesMap":{

   },
   "permissions":[

   ]
}

Adding the “Publish”, we are not going to use the escalationAction nor time, so we pass them empty.

curl -u admin@dotcms.com:admin -X POST https://demo.dotcms.com/api/v1/workflow/steps -H "Content-Type:application/json" -d '{ 
    "schemeId":"3b5b81ed-8461-4af7-8960-57db7ca00b46", 
    "stepName":"Publish", 
    "escalationAction":"",
    "escalationTime":"" 
    }'

OUTPUT

{
   "errors":[

   ],
   "entity":{
      "id":"9d7a7e4c-9384-4cba-8710-ea875ef35b90",
      "creationDate":1548963444065,
      "name":"Publish",
      "schemeId":"3b5b81ed-8461-4af7-8960-57db7ca00b46",
      "myOrder":1,
      "resolved":false,
      "enableEscalation":false,
      "escalationAction":null,
      "escalationTime":0
   },
   "messages":[

   ],
   "i18nMessagesMap":{

   },
   "permissions":[

   ]
}

Adding the “Archive”, we are not going to use the escalationAction nor time, so we pass them empty.

curl -u admin@dotcms.com:admin -X POST https://demo.dotcms.com/api/v1/workflow/steps -H "Content-Type:application/json" -d '{ 
    "schemeId":"3b5b81ed-8461-4af7-8960-57db7ca00b46", 
    "stepName":"Archive", 
    "escalationAction":"",
    "escalationTime":"" 
    }'

OUTPUT

{
   "errors":[

   ],
   "entity":{
      "id":"93e66213-6252-4873-8365-b031df54ce62",
      "creationDate":1548963610852,
      "name":"Archive",
      "schemeId":"3b5b81ed-8461-4af7-8960-57db7ca00b46",
      "myOrder":2,
      "resolved":false,
      "enableEscalation":false,
      "escalationAction":null,
      "escalationTime":0
   },
   "messages":[

   ],
   "i18nMessagesMap":{

   },
   "permissions":[

   ]
}

As you can see we have now three steps already created, in addition you can pass the property “stepResolved”:true, if you want to mark the step as a Resolved.

Adding Actions

Actions on dotCMS 5.x are not strictly associated to the steps, instead of steps, they are related to the scheme, so that they are being shareable between steps, for instance if an action is associated to several steps, and you make a change over it, the change will be reflected over all steps since all of them are reference the same action instead of keeping a copy of the action.

That said, let’s start creating the actions.

Adding Save Content Step

Now let’s add an action to Save Content, the action will be associated to the recently schema created (instead of step) and the next step will be unpublish. Pay attention to the showOn field, it is a now feature on workflow and it provides the ability to control on the UI when a workflow will be showed.

LISTING, EDITING: Listing means content search, site browser, etc. Editing means content editing, so if you want an action only on the content edit you can just set EDITING, or set both to have it on all places.

curl -u admin@dotcms.com:admin -X POST https://demo.dotcms.com/api/v1/workflow/actions -H "Content-Type:application/json" -d '{
      "actionName": "Save Content",
      "schemeId": "3b5b81ed-8461-4af7-8960-57db7ca00b46",
      "actionCondition": "",
      "actionNextStep": "a9ec35d5-d0bd-4c8f-916b-4daa17858974",
      "actionNextAssign": "654b0931-1027-41f7-ad4d-173115ed8ec1",
      "actionRoleHierarchyForAssign": false,
      "actionAssignable": false,
      "actionCommentable": true,
      "whoCanUse":[],
      "showOn": [
        "UNPUBLISHED",
        "NEW",
        "LOCKED",
        "PUBLISHED",
        "EDITING"
      ]
}' 

OUTPUT

{
   "errors":[

   ],
   "entity":{
      "id":"af85f17f-3908-4e80-9dee-862be0e018da",
      "name":"Save Content",
      "schemeId":"3b5b81ed-8461-4af7-8960-57db7ca00b46",
      "condition":"",
      "nextStep":"a9ec35d5-d0bd-4c8f-916b-4daa17858974",
      "nextAssign":"654b0931-1027-41f7-ad4d-173115ed8ec1",
      "icon":"workflowIcon",
      "roleHierarchyForAssign":false,
      "assignable":false,
      "commentable":true,
      "order":0,
      "owner":null,
      "nextStepCurrentStep":false,
      "showOn":[
         "PUBLISHED",
         "LOCKED",
         "UNPUBLISHED",
         "NEW",
         "EDITING"
      ]
   },
   "messages":[

   ],
   "i18nMessagesMap":{

   },
   "permissions":[

   ]
}

As we mentioned the action is currently associated to the scheme but it is not reflected yet on the UI on the workflow portlet, the next step will be associated the created action to all steps we want, so let’s start associating to the Unpublish and Publish steps.

Relating to Unpublish Step

curl -u admin@dotcms.com:admin -X POST https://demo.dotcms.com/api/v1/workflow/steps/a9ec35d5-d0bd-4c8f-916b-4daa17858974/actions -H "Content-Type:application/json" -d '{ 
    "actionId": "af85f17f-3908-4e80-9dee-862be0e018da" 
}' 

OUTPUT

{"errors":[],"entity":"Ok","messages":[],"i18nMessagesMap":{},"permissions":[]}

Relating to Publish Step

curl -u admin@dotcms.com:admin -X POST https://demo.dotcms.com/api/v1/workflow/steps/9d7a7e4c-9384-4cba-8710-ea875ef35b90/actions -H "Content-Type:application/json" -d '{ 
    "actionId": 
    "af85f17f-3908-4e80-9dee-862be0e018da" 
}' 

OUTPUT

{"errors":[],"entity":"Ok","messages":[],"i18nMessagesMap":{},"permissions":[]}

Now you can see how it looks on the UI/Portlet

Now, let’s continue with a few more actions:

Add Publish Action:

Keep in mind this action will be showed only on the content search, but not in the content editor, however you are free to add more settings, also in order to publish the content has to be created, so “NEW” is not part of it. Finally the action will move to the Publish Step.

curl -u admin@dotcms.com:admin -X POST https://demo.dotcms.com/api/v1/workflow/actions -H "Content-Type:application/json" -d '{
      "actionName": "Publish Content",
      "schemeId": "3b5b81ed-8461-4af7-8960-57db7ca00b46",
      "actionCondition": "",
      "actionNextStep": "9d7a7e4c-9384-4cba-8710-ea875ef35b90",
      "actionNextAssign": "654b0931-1027-41f7-ad4d-173115ed8ec1",
      "actionRoleHierarchyForAssign": false,
      "actionAssignable": false,
      "actionCommentable": true,
      "whoCanUse":[],
      "showOn": [
        "UNPUBLISHED",
        "LOCKED",
        "PUBLISHED",
        "LISTING"
      ]
}' 

OUTPUT

{
   "errors":[

   ],
   "entity":{
      "id":"6cc521df-4130-4efc-b4ec-0a8e7b239bf5",
      "name":"Publish Content",
      "schemeId":"3b5b81ed-8461-4af7-8960-57db7ca00b46",
      "condition":"",
      "nextStep":"9d7a7e4c-9384-4cba-8710-ea875ef35b90",
      "nextAssign":"654b0931-1027-41f7-ad4d-173115ed8ec1",
      "icon":"workflowIcon",
      "roleHierarchyForAssign":false,
      "assignable":false,
      "commentable":true,
      "order":0,
      "owner":null,
      "nextStepCurrentStep":false,
      "showOn":[
         "PUBLISHED",
         "LOCKED",
         "UNPUBLISHED",
         "LISTING"
      ]
   },
   "messages":[

   ],
   "i18nMessagesMap":{

   },
   "permissions":[

   ]
}

Add UnPublish Action:

Similar to the Publish, unpublish will be only enable on the content search (LISTING) and also a content has to be PUBLISH in order to be unpublished, the next step will be UnPublish

curl -u admin@dotcms.com:admin -X POST https://demo.dotcms.com/api/v1/workflow/actions -H "Content-Type:application/json" -d '{
      "actionName": "Unpublish Content",
      "schemeId": "3b5b81ed-8461-4af7-8960-57db7ca00b46",
      "actionCondition": "",
      "actionNextStep": "a9ec35d5-d0bd-4c8f-916b-4daa17858974",
      "actionNextAssign": "654b0931-1027-41f7-ad4d-173115ed8ec1",
      "actionRoleHierarchyForAssign": false,
      "actionAssignable": false,
      "actionCommentable": true,
      "whoCanUse":[],
      "showOn": [
        "LOCKED",
        "PUBLISHED",
        "LISTING"
      ]
}' 

OUTPUT

{
   "errors":[

   ],
   "entity":{
      "id":""75f216ff-148e-4e18-b46d-ed65d5bd0053”,
      "name":"Unpublish Content",
      "schemeId":"3b5b81ed-8461-4af7-8960-57db7ca00b46",
      "condition":"",
      "nextStep":"a9ec35d5-d0bd-4c8f-916b-4daa17858974",
      "nextAssign":"654b0931-1027-41f7-ad4d-173115ed8ec1",
      "icon":"workflowIcon",
      "roleHierarchyForAssign":false,
      "assignable":false,
      "commentable":true,
      "order":0,
      "owner":null,
      "nextStepCurrentStep":false,
      "showOn":[
         "PUBLISHED",
         "LOCKED",
         "LISTING"
      ]
   },
   "messages":[

   ],
   "i18nMessagesMap":{

   },
   "permissions":[

   ]
}

Add Archive Action:

Archive will be only rendered if the content is unpublished and it is only available on content search.

curl -u admin@dotcms.com:admin -X POST https://demo.dotcms.com/api/v1/workflow/actions -H "Content-Type:application/json" -d '{
      "actionName": "Archive Content",
      "schemeId": "3b5b81ed-8461-4af7-8960-57db7ca00b46",
      "actionCondition": "",
      "actionNextStep": "93e66213-6252-4873-8365-b031df54ce62",
      "actionNextAssign": "654b0931-1027-41f7-ad4d-173115ed8ec1",
      "actionRoleHierarchyForAssign": false,
      "actionAssignable": false,
      "actionCommentable": true,
      "whoCanUse":[],
      "showOn": [
        "UNLOCKED",
        "UNPUBLISHED",
        "LISTING"
      ]
}' 

OUTPUT

{
   "errors":[

   ],
   "entity":{
      "id":"7d2fbb89-4581-4b08-bf72-74bb316e782f",
      "name":"Archive Content",
      "schemeId":"3b5b81ed-8461-4af7-8960-57db7ca00b46",
      "condition":"",
      "nextStep":"93e66213-6252-4873-8365-b031df54ce62",
      "nextAssign":"654b0931-1027-41f7-ad4d-173115ed8ec1",
      "icon":"workflowIcon",
      "roleHierarchyForAssign":false,
      "assignable":false,
      "commentable":true,
      "order":0,
      "owner":null,
      "nextStepCurrentStep":false,
      "showOn":[
         "UNLOCKED",
         "UNPUBLISHED",
         "LISTING"
      ]
   },
   "messages":[

   ],
   "i18nMessagesMap":{

   },
   "permissions":[

   ]
}

Add Unarchive Action:

Archive will be only rendered if the content is unpublished and it is only available on content search.

curl -u admin@dotcms.com:admin -X POST https://demo.dotcms.com/api/v1/workflow/actions -H "Content-Type:application/json" -d '{
      "actionName": "Unarchive Content",
      "schemeId": "3b5b81ed-8461-4af7-8960-57db7ca00b46",
      "actionCondition": "",
      "actionNextStep": "a9ec35d5-d0bd-4c8f-916b-4daa17858974",
      "actionNextAssign": "654b0931-1027-41f7-ad4d-173115ed8ec1",
      "actionRoleHierarchyForAssign": false,
      "actionAssignable": false,
      "actionCommentable": true,
      "whoCanUse":[],
      "showOn": [
         "LOCKED",
        "UNLOCKED",
        "ARCHIVED",
        "LISTING"
      ]
}' 

OUTPUT

{
   "errors":[

   ],
   "entity":{
      "id":"98ba3aff-8375-4161-a1ec-32ca60a11ddf",
      "name":"Unarchive Content",
      "schemeId":"3b5b81ed-8461-4af7-8960-57db7ca00b46",
      "condition":"",
      "nextStep":"a9ec35d5-d0bd-4c8f-916b-4daa17858974",
      "nextAssign":"654b0931-1027-41f7-ad4d-173115ed8ec1",
      "icon":"workflowIcon",
      "roleHierarchyForAssign":false,
      "assignable":false,
      "commentable":true,
      "order":0,
      "owner":null,
      "nextStepCurrentStep":false,
      "showOn":[
         "ARCHIVED",
         "UNLOCKED",
         "LOCKED",
         "LISTING"
      ]
   },
   "messages":[

   ],
   "i18nMessagesMap":{

   },
   "permissions":[

   ]
}

Add Delete Action:

Archive will be only rendered if the content is unpublished and it is only available on content search.

curl -u admin@dotcms.com:admin -X POST https://demo.dotcms.com/api/v1/workflow/actions -H "Content-Type:application/json" -d '{
      "actionName": "Delete Content",
      "schemeId": "3b5b81ed-8461-4af7-8960-57db7ca00b46",
      "actionCondition": "",
      "actionNextStep": "a9ec35d5-d0bd-4c8f-916b-4daa17858974",
      "actionNextAssign": "654b0931-1027-41f7-ad4d-173115ed8ec1",
      "actionRoleHierarchyForAssign": false,
      "actionAssignable": false,
      "actionCommentable": true,
      "whoCanUse":[],
      "showOn": [
         "LISTING", 
         "EDITING",
         "LOCKED",
        "UNLOCKED",
        "ARCHIVED"
      ]
}' 

OUTPUT

{
   "errors":[

   ],
   "entity":{
      "id":"d642ff4f-818d-4a29-a791-120ba758d817",
      "name":"Delete Content",
      "schemeId":"3b5b81ed-8461-4af7-8960-57db7ca00b46",
      "condition":"",
      "nextStep":"a9ec35d5-d0bd-4c8f-916b-4daa17858974",
      "nextAssign":"654b0931-1027-41f7-ad4d-173115ed8ec1",
      "icon":"workflowIcon",
      "roleHierarchyForAssign":false,
      "assignable":false,
      "commentable":true,
      "order":0,
      "owner":null,
      "nextStepCurrentStep":false,
      "showOn":[
         "ARCHIVED",
         "UNLOCKED",
         "LOCKED",
         "LISTING",
         "EDITING"
      ]
   },
   "messages":[

   ],
   "i18nMessagesMap":{

   },
   "permissions":[

   ]
}

Making the relationship with steps

Associating Publish action to the unpublish/publish step

curl -u admin@dotcms.com:admin -X POST https://demo.dotcms.com/api/v1/workflow/steps/a9ec35d5-d0bd-4c8f-916b-4daa17858974/actions -H "Content-Type:application/json" -d '{ "actionId": "f1e2a5bf-fc84-4061-9e79-18e053b45675" }' 
```
curl -u admin@dotcms.com:admin -X POST https://demo.dotcms.com/api/v1/workflow/steps/9d7a7e4c-9384-4cba-8710-ea875ef35b90/actions -H "Content-Type:application/json" -d '{ "actionId": "f1e2a5bf-fc84-4061-9e79-18e053b45675" }' 

Associating Unpublish action to the publish step

curl -u admin@dotcms.com:admin -X POST https://demo.dotcms.com/api/v1/workflow/steps/9d7a7e4c-9384-4cba-8710-ea875ef35b90/actions -H "Content-Type:application/json" -d '{ "actionId": "75f216ff-148e-4e18-b46d-ed65d5bd0053" }' 

Associating Archive action to the unpublish step

curl -u admin@dotcms.com:admin -X POST https://demo.dotcms.com/api/v1/workflow/steps/db145b25-f868-4dc7-a88e-d68d9f6f6040/actions -H "Content-Type:application/json" -d '{ "actionId": "75bd6aad-e57e-45e1-8058-ce8513914f9e" }' 

Associating Unarchive action to the Archive step

curl -u admin@dotcms.com:admin -X POST https://demo.dotcms.com/api/v1/workflow/steps/93e66213-6252-4873-8365-b031df54ce62/actions -H "Content-Type:application/json" -d '{ "actionId": "98ba3aff-8375-4161-a1ec-32ca60a11ddf" }'  

Associating Delete action to the Archive step

curl -u admin@dotcms.com:admin -X POST https://demo.dotcms.com/api/v1/workflow/steps/93e66213-6252-4873-8365-b031df54ce62/actions -H "Content-Type:application/json" -d '{ "actionId": "d642ff4f-818d-4a29-a791-120ba758d817" }' 

Now we have our basic workflow done, but we need to customize the action, if you go to the UI you will see Action are set just with the “notify assignee” actionlet, so let’s start with it.

Adding the Actionlets to the Actions

The actionlets are tied to the Action, so let’s start fetching all of them:

curl -u admin@dotcms.com:admin https://demo.dotcms.com/api/v1/workflow/schemes/3b5b81ed-8461-4af7-8960-57db7ca00b46/actions -H "Content-Type:application/json" 

This endpoint is gonna return all the actions associated to the scheme, keep in mind that might exists action that you can not see in the UI (Workflow Portlet) but still being available.

{
    "errors": [],
    "entity": [
        {
            "id": "ad517cde-2a2f-4dc7-b7d4-c820b8529645",
            "name": "Archive Content",
            "schemeId": "3b5b81ed-8461-4af7-8960-57db7ca00b46",
            "condition": "",
            "nextStep": "93e66213-6252-4873-8365-b031df54ce62",
            "nextAssign": "654b0931-1027-41f7-ad4d-173115ed8ec1",
            "icon": "workflowIcon",
            "roleHierarchyForAssign": false,
            "assignable": false,
            "commentable": true,
            "order": 0,
            "owner": null,
            "nextStepCurrentStep": false,
            "showOn": [
                "UNLOCKED",
                "UNPUBLISHED",
                "LISTING"
            ]
        },
        {
            "id": "d642ff4f-818d-4a29-a791-120ba758d817",
            "name": "Delete Content",
            "schemeId": "3b5b81ed-8461-4af7-8960-57db7ca00b46",
            "condition": "",
            "nextStep": "a9ec35d5-d0bd-4c8f-916b-4daa17858974",
            "nextAssign": "654b0931-1027-41f7-ad4d-173115ed8ec1",
            "icon": "workflowIcon",
            "roleHierarchyForAssign": false,
            "assignable": false,
            "commentable": true,
            "order": 0,
            "owner": null,
            "nextStepCurrentStep": false,
            "showOn": [
                "ARCHIVED",
                "UNLOCKED",
                "LOCKED",
                "LISTING",
                "EDITING"
            ]
        },
        {
            "id": "f1e2a5bf-fc84-4061-9e79-18e053b45675",
            "name": "Publish Content",
            "schemeId": "3b5b81ed-8461-4af7-8960-57db7ca00b46",
            "condition": "",
            "nextStep": "9d7a7e4c-9384-4cba-8710-ea875ef35b90",
            "nextAssign": "654b0931-1027-41f7-ad4d-173115ed8ec1",
            "icon": "workflowIcon",
            "roleHierarchyForAssign": false,
            "assignable": false,
            "commentable": true,
            "order": 0,
            "owner": null,
            "nextStepCurrentStep": false,
            "showOn": [
                "PUBLISHED",
                "LOCKED",
                "UNPUBLISHED",
                "LISTING"
            ]
        },
        {
            "id": "af85f17f-3908-4e80-9dee-862be0e018da",
            "name": "Save Content",
            "schemeId": "3b5b81ed-8461-4af7-8960-57db7ca00b46",
            "condition": "",
            "nextStep": "a9ec35d5-d0bd-4c8f-916b-4daa17858974",
            "nextAssign": "654b0931-1027-41f7-ad4d-173115ed8ec1",
            "icon": "workflowIcon",
            "roleHierarchyForAssign": false,
            "assignable": false,
            "commentable": true,
            "order": 0,
            "owner": null,
            "nextStepCurrentStep": false,
            "showOn": [
                "PUBLISHED",
                "LOCKED",
                "UNPUBLISHED",
                "NEW",
                "EDITING"
            ]
        },
        {
            "id": "98ba3aff-8375-4161-a1ec-32ca60a11ddf",
            "name": "Unarchive Content",
            "schemeId": "3b5b81ed-8461-4af7-8960-57db7ca00b46",
            "condition": "",
            "nextStep": "a9ec35d5-d0bd-4c8f-916b-4daa17858974",
            "nextAssign": "654b0931-1027-41f7-ad4d-173115ed8ec1",
            "icon": "workflowIcon",
            "roleHierarchyForAssign": false,
            "assignable": false,
            "commentable": true,
            "order": 0,
            "owner": null,
            "nextStepCurrentStep": false,
            "showOn": [
                "ARCHIVED",
                "UNLOCKED",
                "LOCKED",
                "LISTING"
            ]
        },
        {
            "id": "75f216ff-148e-4e18-b46d-ed65d5bd0053",
            "name": "Unpublish Content",
            "schemeId": "3b5b81ed-8461-4af7-8960-57db7ca00b46",
            "condition": "",
            "nextStep": "a9ec35d5-d0bd-4c8f-916b-4daa17858974",
            "nextAssign": "654b0931-1027-41f7-ad4d-173115ed8ec1",
            "icon": "workflowIcon",
            "roleHierarchyForAssign": false,
            "assignable": false,
            "commentable": true,
            "order": 0,
            "owner": null,
            "nextStepCurrentStep": false,
            "showOn": [
                "PUBLISHED",
                "LOCKED",
                "LISTING"
            ]
        }
    ],
    "messages": [],
    "i18nMessagesMap": {},
    "permissions": []
}

That done, let’s start customizing the “Save Content Action”:

The first thing we have to do is using the action id recovery on last request (af85f17f-3908-4e80-9dee-862be0e018da), check if the action has any actionlet already set, so

curl -u admin@dotcms.com:admin https://demo.dotcms.com/api/v1/workflow/actions/af85f17f-3908-4e80-9dee-862be0e018da/actionlets -H "Content-Type:application/json" 

OUTPUT

{
    "errors": [],
    "entity": [
        {
            "id": "e0139991-a3db-4de5-9dd0-3c625d0effd5",
            "actionId": "af85f17f-3908-4e80-9dee-862be0e018da",
            "name": "Notify Assignee",
            "order": 0,
            "clazz": "com.dotmarketing.portlets.workflows.actionlet.NotifyAssigneeActionlet",
            "actionlet": {
                "name": "Notify Assignee",
                "parameters": [
                    {
                        "displayName": "Email Subject",
                        "key": "emailSubject",
                        "defaultValue": "",
                        "required": false
                    },
                    {
                        "displayName": "Email Message",
                        "key": "emailBody",
                        "defaultValue": null,
                        "required": false
                    },
                    {
                        "displayName": "Is Html?",
                        "key": "isHtml",
                        "defaultValue": "true",
                        "required": false
                    }
                ],
                "nextStep": null,
                "howTo": "This actionlet will send an email to the assignee (or assignees if the next assign is a role).  It uses a default email subject and message, but can be overridden.  Both the subject and message are parsed Velocity, and have access to a $workflow object that gives them $workflow.task, $workflow.nextAssign, $workflow.action, $workflow.step, etc.. ",
                "localizedName": "Notify Assignee",
                "localizedHowto": "com.dotmarketing.portlets.workflows.actionlet.NotifyAssigneeActionlet.howTo"
            }
        }
    ],
    "messages": [],
    "i18nMessagesMap": {},
    "permissions": []
}

As you mentioned, there is a default actionlet added to the action we have created, so let’s clean up before continue with our actionlets, remove the actionlet e0139991-a3db-4de5-9dd0-3c625d0effd5:

curl -u admin@dotcms.com:admin -X DELETE https://demo.dotcms.com/api/v1/workflow/actionlets/e0139991-a3db-4de5-9dd0-3c625d0effd5 -H "Content-Type:application/json"

After that you can double check the actionlet associated to the Save Content action (af85f17f-3908-4e80-9dee-862be0e018da) again and will see there is not any actionlet associated.

Now repeat the procedure for the rest of the actions; as soon as you done with the deleting of all previous actionlets on our actions, let start customizing the Save Content action (af85f17f-3908-4e80-9dee-862be0e018da). The Save will only have a Save Content actionlet, so in order to know the information to associated to the Save Content Action, first let’s ask to the API all of Actionlets enable for us.

 curl -u admin@dotcms.com:admin https://demo.dotcms.com/api/v1/workflow/actionlets/

OUTPUT

{
    "errors": [],
    "entity": [
        {
            "name": "'Four Eyes' Approval",
            "parameters": [
                {
                    "displayName": "User IDs, Emails, or Role Keys",
                    "key": "approvers",
                    "defaultValue": null,
                    "required": true
                },
                {
                    "displayName": "Number of Approvers",
                    "key": "minimumApprovers",
                    "defaultValue": "2",
                    "required": true
                },
                {
                    "displayName": "Email Subject",
                    "key": "emailSubject",
                    "defaultValue": "Multiple Approval Required",
                    "required": true
                },
                {
                    "displayName": "Email Message",
                    "key": "emailBody",
                    "defaultValue": null,
                    "required": false
                }
            ],
            "howTo": "This actionlet implements the 'Four Eyes' principle for verifying new content. It takes a comma-separated list of users and Roles (in the form of User IDs, Email addresses, or Role keys) who are authorized to review the content, and a minimum number of approvers. When a user executes the Workflow action, if the number of users who have approved the content is greater than or equal than the specified value, the following sub-actions will be executed; otherwise, an email will be sent to all users who haven't approved the content yet, and none of the following sub-actions will be executed.",
            "localizedName": "'Four Eyes' Approval",
            "localizedHowto": "com.dotmarketing.portlets.workflows.actionlet.FourEyeApproverActionlet.howTo",
            "actionClass": "com.dotmarketing.portlets.workflows.actionlet.FourEyeApproverActionlet"
        },
        {
            "name": "Archive content",
            "parameters": null,
            "howTo": "This actionlet will archive the content.",
            "localizedName": "Archive Content",
            "localizedHowto": "com.dotmarketing.portlets.workflows.actionlet.ArchiveContentActionlet.howTo",
            "actionClass": "com.dotmarketing.portlets.workflows.actionlet.ArchiveContentActionlet"
        },
        {
            "name": "Comment on Workflow",
            "parameters": [
                {
                    "displayName": "Workflow Comment",
                    "key": "comment",
                    "defaultValue": null,
                    "required": true
                }
            ],
            "nextStep": null,
            "howTo": "Prompts the user to add a comment on the Workflow task.",
            "localizedName": "Comment on Workflow",
            "localizedHowto": "com.dotmarketing.portlets.workflows.actionlet.CommentOnWorkflowActionlet.howTo",
            "actionClass": "com.dotmarketing.portlets.workflows.actionlet.CommentOnWorkflowActionlet"
        },
        {
            "name": "Copy Contentlet",
            "parameters": [],
            "howTo": "This workflow actionlet copies the edited contentlet ",
            "localizedName": "Copy Contentlet",
            "localizedHowto": "com.dotmarketing.portlets.workflows.actionlet.CopyActionlet.howTo",
            "actionClass": "com.dotmarketing.portlets.workflows.actionlet.CopyActionlet"
        },
        {
            "name": "Delete content",
            "parameters": null,
            "howTo": "This action will delete the content. Warning: this can't be undone!",
            "localizedName": "Delete content",
            "localizedHowto": "com.dotmarketing.portlets.workflows.actionlet.DeleteContentActionlet.howTo",
            "actionClass": "com.dotmarketing.portlets.workflows.actionlet.DeleteContentActionlet"
        },
        {
            "name": "Link Checker",
            "parameters": [
                {
                    "displayName": "List of fields to check (a comma separated list)",
                    "key": "fieldList",
                    "defaultValue": "",
                    "required": true
                }
            ],
            "howTo": "This actionlet check the links into the specified fields and reject the content with broken links",
            "localizedName": "Link Checker",
            "localizedHowto": "com.dotmarketing.portlets.workflows.actionlet.CheckURLAccessibilityActionlet.howTo",
            "actionClass": "com.dotmarketing.portlets.workflows.actionlet.CheckURLAccessibilityActionlet"
        },
        {
            "name": "Lock content",
            "parameters": null,
            "nextStep": null,
            "howTo": "This actionlet will checkout and lock the content.",
            "localizedName": "Lock Content",
            "localizedHowto": "com.dotmarketing.portlets.workflows.actionlet.CheckoutContentActionlet.howTo",
            "actionClass": "com.dotmarketing.portlets.workflows.actionlet.CheckoutContentActionlet"
        },
        {
            "name": "Message",
            "parameters": [
                {
                    "displayName": "User IDs",
                    "key": "users",
                    "defaultValue": "Current User",
                    "required": true
                },
                {
                    "displayName": "Message",
                    "key": "message",
                    "defaultValue": "",
                    "required": true
                }
            ],
            "howTo": "This actionlet allows to send a message to the client as part of the action.",
            "localizedName": "Message",
            "localizedHowto": "com.dotmarketing.portlets.workflows.MessageActionlet.howTo",
            "actionClass": "com.dotmarketing.portlets.workflows.MessageActionlet"
        },
        {
            "name": "Notify Assignee",
            "parameters": [
                {
                    "displayName": "Email Subject",
                    "key": "emailSubject",
                    "defaultValue": "",
                    "required": false
                },
                {
                    "displayName": "Email Message",
                    "key": "emailBody",
                    "defaultValue": null,
                    "required": false
                },
                {
                    "displayName": "Is Html?",
                    "key": "isHtml",
                    "defaultValue": "true",
                    "required": false
                }
            ],
            "nextStep": null,
            "howTo": "This actionlet will send an email to the assignee (or assignees if the next assign is a role).  It uses a default email subject and message, but can be overridden.  Both the subject and message are parsed Velocity, and have access to a $workflow object that gives them $workflow.task, $workflow.nextAssign, $workflow.action, $workflow.step, etc.. ",
            "localizedName": "Notify Assignee",
            "localizedHowto": "com.dotmarketing.portlets.workflows.actionlet.NotifyAssigneeActionlet.howTo",
            "actionClass": "com.dotmarketing.portlets.workflows.actionlet.NotifyAssigneeActionlet"
        },
        {
            "name": "Notify Users",
            "parameters": [
                {
                    "displayName": "Users, Emails and Roles",
                    "key": "emails",
                    "defaultValue": null,
                    "required": true
                },
                {
                    "displayName": "Email Subject",
                    "key": "emailSubject",
                    "defaultValue": null,
                    "required": false
                },
                {
                    "displayName": "Email Message",
                    "key": "emailBody",
                    "defaultValue": null,
                    "required": false
                },
                {
                    "displayName": "Is Html?",
                    "key": "isHtml",
                    "defaultValue": null,
                    "required": false
                }
            ],
            "nextStep": null,
            "howTo": "This actionlet takes a comma separated list of userId, email addresses and/or role keys and this will send them a notification email.",
            "localizedName": "Notify User(s)",
            "localizedHowto": "com.dotmarketing.portlets.workflows.actionlet.NotifyUsersActionlet.howTo",
            "actionClass": "com.dotmarketing.portlets.workflows.actionlet.NotifyUsersActionlet"
        },
        {
            "name": "Publish content",
            "parameters": null,
            "nextStep": null,
            "howTo": "This actionlet will publish the content.",
            "localizedName": "Publish Content",
            "localizedHowto": "com.dotmarketing.portlets.workflows.actionlet.PublishContentActionlet.howTo",
            "actionClass": "com.dotmarketing.portlets.workflows.actionlet.PublishContentActionlet"
        },
        {
            "name": "Push Now",
            "parameters": [
                {
                    "displayName": "Name of the Enviroment",
                    "key": "environment",
                    "defaultValue": "",
                    "required": true
                },
                {
                    "displayName": "Force the Push? true or false",
                    "key": "force",
                    "defaultValue": "false",
                    "required": true
                }
            ],
            "howTo": "This actionlet will automatically publish the the content object to the specified enviroment(s). Multiple Environments can be separated by a comma",
            "localizedName": "Push Now",
            "localizedHowto": "com.dotmarketing.portlets.workflows.actionlet.PushNowActionlet.howTo",
            "actionClass": "com.dotmarketing.portlets.workflows.actionlet.PushNowActionlet"
        },
        {
            "name": "Push Publish",
            "parameters": null,
            "howTo": "This actionlet will add the content to the remote publish queue",
            "localizedName": "Push Publish",
            "localizedHowto": "com.dotmarketing.portlets.workflows.actionlet.PushPublishActionlet.howTo",
            "actionClass": "com.dotmarketing.portlets.workflows.actionlet.PushPublishActionlet"
        },
        {
            "name": "Reindex content",
            "parameters": [
                {
                    "displayName": "Optional Index Policy for the contentlet (Valid values: DEFER, WAIT_FOR, FORCE)",
                    "key": "indexPolicy",
                    "defaultValue": "",
                    "required": false
                }
            ],
            "nextStep": null,
            "howTo": "This actionlet will reindex the content.",
            "localizedName": "Reindex content",
            "localizedHowto": "com.dotmarketing.portlets.workflows.actionlet.ReindexContentActionlet.howTo",
            "actionClass": "com.dotmarketing.portlets.workflows.actionlet.ReindexContentActionlet"
        },
        {
            "name": "Require Multiple Approvers",
            "parameters": [
                {
                    "displayName": "User IDs or Emails",
                    "key": "approvers",
                    "defaultValue": null,
                    "required": true
                },
                {
                    "displayName": "Email Subject",
                    "key": "emailSubject",
                    "defaultValue": "Multiple Approval Required",
                    "required": false
                },
                {
                    "displayName": "Email Message",
                    "key": "emailBody",
                    "defaultValue": null,
                    "required": false
                }
            ],
            "howTo": "This actionlet takes a comma separated list of userIds or user email addresses of users that need to approve this workflow task before it can progress. If eveyone in the list has not approved, this actionlet will send a notification email out to users who have not approved and STOP all further subaction processing.",
            "localizedName": "Require Multiple Approvers",
            "localizedHowto": "com.dotmarketing.portlets.workflows.actionlet.MultipleApproverActionlet.howTo",
            "actionClass": "com.dotmarketing.portlets.workflows.actionlet.MultipleApproverActionlet"
        },
        {
            "name": "Reset Workflow",
            "parameters": null,
            "howTo": "This actionlet will reset workflow task state, but keeping the comments and history.  It will also STOP all further subaction processing",
            "localizedName": "Reset Workflow",
            "localizedHowto": "com.dotmarketing.portlets.workflows.actionlet.ResetTaskActionlet.howTo",
            "actionClass": "com.dotmarketing.portlets.workflows.actionlet.ResetTaskActionlet"
        },
        {
            "name": "Save Draft content",
            "parameters": null,
            "nextStep": null,
            "howTo": "This actionlet will do checkin as draft the content.",
            "localizedName": "Save Draft content",
            "localizedHowto": "com.dotmarketing.portlets.workflows.actionlet.SaveContentAsDraftActionlet.howTo",
            "actionClass": "com.dotmarketing.portlets.workflows.actionlet.SaveContentAsDraftActionlet"
        },
        {
            "name": "Save content",
            "parameters": null,
            "nextStep": null,
            "howTo": "This actionlet will checkin the content.",
            "localizedName": "Save content",
            "localizedHowto": "com.dotmarketing.portlets.workflows.actionlet.SaveContentActionlet.howTo",
            "actionClass": "com.dotmarketing.portlets.workflows.actionlet.SaveContentActionlet"
        },
        {
            "name": "Send an Email",
            "parameters": [
                {
                    "displayName": "From Email",
                    "key": "fromEmail",
                    "defaultValue": "",
                    "required": true
                },
                {
                    "displayName": "From Name",
                    "key": "fromName",
                    "defaultValue": "",
                    "required": true
                },
                {
                    "displayName": "To Email",
                    "key": "toEmail",
                    "defaultValue": "",
                    "required": true
                },
                {
                    "displayName": "To Name",
                    "key": "toName",
                    "defaultValue": "",
                    "required": true
                },
                {
                    "displayName": "Cc Email",
                    "key": "cc",
                    "defaultValue": "",
                    "required": false
                },
                {
                    "displayName": "Bcc Email",
                    "key": "bcc",
                    "defaultValue": "",
                    "required": false
                },
                {
                    "displayName": "Email Subject",
                    "key": "emailSubject",
                    "defaultValue": "",
                    "required": true
                },
                {
                    "displayName": "Email Body (html)",
                    "key": "emailBody",
                    "defaultValue": "",
                    "required": true
                },
                {
                    "displayName": "Condition - email will send unless<br>velocity prints 'false'",
                    "key": "condition",
                    "defaultValue": "",
                    "required": false
                },
                {
                    "displayName": "Path or field for attachment <br>(e.g./images/logo.png or 'fileAsset')",
                    "key": "attachment1",
                    "defaultValue": "",
                    "required": false
                },
                {
                    "displayName": "Path or field for attachment <br>(e.g./images/logo.png or 'fileAsset')",
                    "key": "attachment2",
                    "defaultValue": "",
                    "required": false
                },
                {
                    "displayName": "Path or field for attachment <br>(e.g./images/logo.png or 'fileAsset')",
                    "key": "attachment3",
                    "defaultValue": "",
                    "required": false
                },
                {
                    "displayName": "Path or field for attachment <br>(e.g./images/logo.png or 'fileAsset')",
                    "key": "attachment4",
                    "defaultValue": "",
                    "required": false
                },
                {
                    "displayName": "Path or field for attachment <br>(e.g./images/logo.png or 'fileAsset')",
                    "key": "attachment5",
                    "defaultValue": "",
                    "required": false
                }
            ],
            "howTo": "This actionlet will send an email that can be based on the submitted content. The value of every field here is parsed velocity.  So, to send a custom email to the email address stored in a field called userEmail, put $content.userEmail in the 'to email' field and the system will replace it with the variables from the content",
            "localizedName": "Send an Email",
            "localizedHowto": "com.dotmarketing.portlets.workflows.actionlet.EmailActionlet.howTo",
            "actionClass": "com.dotmarketing.portlets.workflows.actionlet.EmailActionlet"
        },
        {
            "name": "Set Value",
            "parameters": [
                {
                    "displayName": "velocityVar Name of the field to set",
                    "key": "field",
                    "defaultValue": "",
                    "required": true
                },
                {
                    "displayName": "The value you want to set it to - can be velocity",
                    "key": "value",
                    "defaultValue": "",
                    "required": true
                }
            ],
            "howTo": "This actionlet will set the value of a field.  The value param can be a string, or it can be velocity, where whatever is set as $value will be applied",
            "localizedName": "Set Value",
            "localizedHowto": "com.dotmarketing.portlets.workflows.actionlet.SetValueActionlet.howTo",
            "actionClass": "com.dotmarketing.portlets.workflows.actionlet.SetValueActionlet"
        },
        {
            "name": "Translate Content",
            "parameters": [
                {
                    "displayName": "Translate to",
                    "key": "translateTo",
                    "defaultValue": "all",
                    "required": true
                },
                {
                    "displayName": "Translate Field Types",
                    "key": "fieldTypes",
                    "defaultValue": "text,wysiwyg,textarea",
                    "required": true
                },
                {
                    "displayName": "Ignore Fields (velocity var name)",
                    "key": "ignoreFields",
                    "defaultValue": "",
                    "required": false
                },
                {
                    "displayName": "Service API Key",
                    "key": "apiKey",
                    "defaultValue": "",
                    "required": true
                }
            ],
            "howTo": "This Sub-action translates content from the default Language to the Language or Languages specified by the translateTo parameter.",
            "localizedName": "Translate Content",
            "localizedHowto": "com.dotmarketing.portlets.workflows.actionlet.TranslationActionlet.howTo",
            "actionClass": "com.dotmarketing.portlets.workflows.actionlet.TranslationActionlet"
        },
        {
            "name": "Twitter Status Update",
            "parameters": [
                {
                    "displayName": "Consumer Key",
                    "key": "consumerKey",
                    "defaultValue": null,
                    "required": true
                },
                {
                    "displayName": "Consumer Secret",
                    "key": "consumerSecret",
                    "defaultValue": null,
                    "required": true
                },
                {
                    "displayName": "Access Token",
                    "key": "accessToken",
                    "defaultValue": null,
                    "required": true
                },
                {
                    "displayName": "Access Token Secret",
                    "key": "accessTokenSecret",
                    "defaultValue": null,
                    "required": true
                },
                {
                    "displayName": "Field to Post",
                    "key": "fieldVar",
                    "defaultValue": null,
                    "required": false
                }
            ],
            "nextStep": null,
            "howTo": "This actionlet posts the value of a field or the workflow comments to twitter.  If the \"Field to Post\" is set to the velocity variable of field on the contentlet, the system will post the value in that field to twitter, otherwise, it will post the comments entered into the workflow comment box to twitter.  To get an access token for twittering, see: <a href='https://dev.twitter.com/apps' target='_blank'>https://dev.twitter.com/apps</a> and create a new dotCMS application",
            "localizedName": "Twitter Status Update",
            "localizedHowto": "com.dotmarketing.portlets.workflows.actionlet.TwitterActionlet.howTo",
            "actionClass": "com.dotmarketing.portlets.workflows.actionlet.TwitterActionlet"
        },
        {
            "name": "Unarchive content",
            "parameters": null,
            "nextStep": null,
            "howTo": "This actionlet will un archive the content and return it to a working state",
            "localizedName": "Unarchive Content",
            "localizedHowto": "com.dotmarketing.portlets.workflows.actionlet.UnarchiveContentActionlet.howTo",
            "actionClass": "com.dotmarketing.portlets.workflows.actionlet.UnarchiveContentActionlet"
        },
        {
            "name": "Unlock content",
            "parameters": null,
            "nextStep": null,
            "howTo": "This actionlet will checkin and unlock the content.",
            "localizedName": "Unlock Content",
            "localizedHowto": "com.dotmarketing.portlets.workflows.actionlet.CheckinContentActionlet.howTo",
            "actionClass": "com.dotmarketing.portlets.workflows.actionlet.CheckinContentActionlet"
        },
        {
            "name": "Unpublish content",
            "parameters": null,
            "nextStep": null,
            "howTo": "This actionlet will unpublish the content.",
            "localizedName": "Unpublish Content",
            "localizedHowto": "com.dotmarketing.portlets.workflows.actionlet.UnpublishContentActionlet.howTo",
            "actionClass": "com.dotmarketing.portlets.workflows.actionlet.UnpublishContentActionlet"
        }
    ],
    "messages": [],
    "i18nMessagesMap": {},
    "permissions": []
}

In the previous response, you will see all actionlets available on your instance, so let’s find the one called Save content:

{
            "name": "Save Draft content",
            "parameters": null,
            "nextStep": null,
            "howTo": "This actionlet will do checkin as draft the content.",
            "localizedName": "Save Draft content",
            "localizedHowto": "com.dotmarketing.portlets.workflows.actionlet.SaveContentAsDraftActionlet.howTo",
            "actionClass": "com.dotmarketing.portlets.workflows.actionlet.SaveContentAsDraftActionlet"
        }

Each entry give us details about the actionlet such as parameters and so on, by now just the actionClass property is relevant for us, so let’s add it to the Save Content Action.

curl -u admin@dotcms.com:admin -X POST https://demo.dotcms.com/api/v1/workflow/actions/af85f17f-3908-4e80-9dee-862be0e018da/actionlets -H "Content-Type:application/json" -d '{ "actionletClass": "com.dotmarketing.portlets.workflows.actionlet.SaveContentAsDraftActionlet" }'        

Now if you open on the Workflow Portlet the Save Content Action, you will see the Save Content actionlet already added.

The next action will be Publish Content, we will add two: Publish Content and Unlock Content actionlets.

Adding the Publish Content actionlet

curl -u admin@dotcms.com:admin -X POST https://demo.dotcms.com/api/v1/workflow/actions/f1e2a5bf-fc84-4061-9e79-18e053b45675/actionlets -H "Content-Type:application/json" -d '{ "actionletClass": "com.dotmarketing.portlets.workflows.actionlet.PublishContentActionlet" }'        

Adding the Unlock Content actionlet

curl -u admin@dotcms.com:admin -X POST https://demo.dotcms.com/api/v1/workflow/actions/f1e2a5bf-fc84-4061-9e79-18e053b45675/actionlets -H "Content-Type:application/json" -d '{ "actionletClass": "com.dotmarketing.portlets.workflows.actionlet.CheckinContentActionlet" }'        

Next will be Unpublish Action, we will add just the unpublish content actionlet:

curl -u admin@dotcms.com:admin -X POST https://demo.dotcms.com/api/v1/workflow/actions/75f216ff-148e-4e18-b46d-ed65d5bd0053/actionlets -H "Content-Type:application/json" -d '{ "actionletClass": "com.dotmarketing.portlets.workflows.actionlet.UnpublishContentActionlet" }'        

Now is the chance for the Archive Action, it will have two: Archive Content and Unlock Content actionlets

curl -u admin@dotcms.com:admin -X POST https://demo.dotcms.com/api/v1/workflow/actions/ad517cde-2a2f-4dc7-b7d4-c820b8529645/actionlets -H "Content-Type:application/json" -d '{ "actionletClass": "com.dotmarketing.portlets.workflows.actionlet.ArchiveContentActionlet" }'      
```
curl -u admin@dotcms.com:admin -X POST https://demo.dotcms.com/api/v1/workflow/actions/ad517cde-2a2f-4dc7-b7d4-c820b8529645/actionlets -H "Content-Type:application/json" -d '{ "actionletClass": "com.dotmarketing.portlets.workflows.actionlet.CheckinContentActionlet" }'        

Unarchive Content will be the next on our list, only Unarchive content actionlet will be needed.

curl -u admin@dotcms.com:admin -X POST https://demo.dotcms.com/api/v1/workflow/actions/98ba3aff-8375-4161-a1ec-32ca60a11ddf/actionlets -H "Content-Type:application/json" -d '{ "actionletClass": "com.dotmarketing.portlets.workflows.actionlet.UnarchiveContentActionlet" }'        

Finally, our last action to customize will be the Delete Content Action, and will contains only one actionlet the Delete Content actionlet, so let’s do it

curl -u admin@dotcms.com:admin -X POST https://demo.dotcms.com/api/v1/workflow/actions/d642ff4f-818d-4a29-a791-120ba758d817/actionlets -H "Content-Type:application/json" -d '{ "actionletClass": "com.dotmarketing.portlets.workflows.actionlet.DeleteContentActionlet" }'        

Now we have already done our test workflow, the next step will be create our own Content Type and associated a couple workflows to it, including the Test Workflow.

Create a ContentType using REST

curl -u admin@dotcms.com:admin -X POST https://demo.dotcms.com/api/v1/contenttype -H "Content-Type:application/json" -d '{ "clazz": "com.dotcms.contenttype.model.type.ImmutableSimpleContentType", "defaultType": false, "name": "My Test Content Type", "description": "THE DESCRIPTION", "host": "48190c8c-42c4-46af-8d1a-0cd5db894797", "owner": "dotcms.org.1", "variable": "TheContentType1", "fixed": false, "system": false, "workflow":["3b5b81ed-8461-4af7-8960-57db7ca00b46"] }'        

OUTPUT

{
   "errors":[

   ],
   "entity":[
      {
         "owner":"dotcms.org.1",
         "multilingualable":false,
         "modDate":1549264661000,
         "description":"THE DESCRIPTION",
         "versionable":true,
         "defaultType":false,
         "baseType":"CONTENT",
         "system":false,
         "folder":"SYSTEM_FOLDER",
         "name":"My Test Content Type",
         "variable":"TheContentType1",
         "host":"48190c8c-42c4-46af-8d1a-0cd5db894797",
         "fixed":false,
         "id":"671b2dbe-4bae-40ae-8f0a-da998248ebf1",
         "fields":[

         ],
         "clazz":"com.dotcms.contenttype.model.type.ImmutableSimpleContentType",
         "iDate":1549264661000,
         "workflows":[

         ]
      }
   ],
   "messages":[

   ],
   "i18nMessagesMap":{

   },
   "permissions":[

   ]
}

Now you have an empty content type, let’s add a couple fields:

curl -u admin@dotcms.com:admin -X POST https://demo.dotcms.com/api/v2/contenttype/TheContentType1/fields -H "Content-Type:application/json" -d '[
   {
      "clazz":"com.dotcms.contenttype.model.field.ImmutableTextField",
      "sortOrder":2,
      "name":"title",
      "dataType":"TEXT",
      "regexCheck":"",
      "defaultValue":"",
      "hint":"",
      "required":false,
      "searchable":false,
      "indexed":false,
      "listed":false,
      "unique":false,
      "contentTypeId":"28bb7ead-eb26-44e7-b43c-e6740fcae566"
   }
]'

OUTPUT

{
   "errors":[

   ],
   "entity":{
      "modDate":1549264785000,
      "indexed":false,
      "defaultValue":"",
      "dataType":"TEXT",
      "regexCheck":"",
      "contentTypeId":"671b2dbe-4bae-40ae-8f0a-da998248ebf1",
      "readOnly":false,
      "searchable":false,
      "required":false,
      "listed":false,
      "unique":false,
      "sortOrder":2,
      "hint":"",
      "name":"title",
      "variable":"title",
      "fieldVariables":[

      ],
      "fixed":false,
      "id":"d7b52952-87ed-4e91-8369-664af05cf259",
      "clazz":"com.dotcms.contenttype.model.field.ImmutableTextField",
      "iDate":1549264785000
   },
   "messages":[

   ],
   "i18nMessagesMap":{

   },
   "permissions":[

   ]
}

Adding the second field:

curl -u admin@dotcms.com:admin -X POST https://demo.dotcms.com/api/v2/contenttype/TheContentType1/fields -H "Content-Type:application/json" -d '[
   {
      "clazz":"com.dotcms.contenttype.model.field.ImmutableTextField",
      "sortOrder":3,
      "name":"value",
      "dataType":"TEXT",
      "regexCheck":"",
      "defaultValue":"",
      "hint":"",
      "required":false,
      "searchable":false,
      "indexed":false,
      "listed":false,
      "unique":false,
      "contentTypeId":"671b2dbe-4bae-40ae-8f0a-da998248ebf1"
   }
]'

OUTPUT

{
   "errors":[

   ],
   "entity":{
      "modDate":1549263615000,
      "indexed":false,
      "defaultValue":"",
      "dataType":"TEXT",
      "regexCheck":"",
      "contentTypeId":"28bb7ead-eb26-44e7-b43c-e6740fcae566",
      "readOnly":false,
      "searchable":false,
      "required":false,
      "listed":false,
      "unique":false,
      "sortOrder":3,
      "hint":"",
      "name":"value",
      "variable":"value",
      "fieldVariables":[

      ],
      "fixed":false,
      "id":"32a0baed-1f81-4ccb-915c-0fd5144a500e",
      "clazz":"com.dotcms.contenttype.model.field.ImmutableTextField",
      "iDate":1549263615000
   },
   "messages":[

   ],
   "i18nMessagesMap":{

   },
   "permissions":[

   ]
}

Fire new Content Type content using REST

Now lets add a content by calling the Save Content from the first step, we are adding 3 properties on the json; the content type and the two fields that we have created previously (title and value). The result will be the contentlet added.

curl -u admin@dotcms.com:admin -X PUT https://demo.dotcms.com/api/v1/workflow/actions/af85f17f-3908-4e80-9dee-862be0e018da/fire -H "Content-Type:application/json" -d '{ "contentletFormData": { "contentType":"TheContentType1", "title":"test1", "value":"value1"}}'

OUTPUT

{
   "errors":[

   ],
   "entity":{
      "map":{
         "owner":"dotcms.org.1",
         "identifier":"fa49145a-bc85-491a-9282-fe9e0471e37b",
         "nullProperties":[

         ],
         "modDate":1549267687339,
         "languageId":1,
         "title":"test1",
         "inode":"1a104580-f88e-4368-9ae5-1b14f4a65e8e",
         "folder":"SYSTEM_FOLDER",
         "disabledWYSIWYG":[

         ],
         "sortOrder":0,
         "modUser":"dotcms.org.1",
         "host":"SYSTEM_HOST",
         "stInode":"671b2dbe-4bae-40ae-8f0a-da998248ebf1",
         "value":"value1"
      },
      "lowIndexPriority":false,
      "name":"test1",
      "type":"contentlet",
      "host":"SYSTEM_HOST",
      "live":false,
      "new":false,
      "structureInode":"671b2dbe-4bae-40ae-8f0a-da998248ebf1",
      "inode":"1a104580-f88e-4368-9ae5-1b14f4a65e8e",
      "languageId":1,
      "title":"test1",
      "identifier":"fa49145a-bc85-491a-9282-fe9e0471e37b",
      "owner":"dotcms.org.1",
      "categoryId":"1a104580-f88e-4368-9ae5-1b14f4a65e8e",
      "indexPolicy":"DEFER",
      "actionId":null,
      "archived":false,
      "structure":{
         "iDate":1549264661000,
         "type":"structure",
         "owner":null,
         "inode":"671b2dbe-4bae-40ae-8f0a-da998248ebf1",
         "identifier":"671b2dbe-4bae-40ae-8f0a-da998248ebf1",
         "name":"My Test Content Type",
         "description":"THE DESCRIPTION",
         "defaultStructure":false,
         "reviewInterval":null,
         "reviewerRole":null,
         "pagedetail":null,
         "structureType":1,
         "fixed":false,
         "system":false,
         "velocityVarName":"TheContentType1",
         "urlMapPattern":null,
         "host":"48190c8c-42c4-46af-8d1a-0cd5db894797",
         "folder":"SYSTEM_FOLDER",
         "publishDateVar":null,
         "expireDateVar":null,
         "modDate":1549265779000,
         "fields":[
            {
               "iDate":1549264785000,
               "type":"field",
               "owner":null,
               "inode":"d7b52952-87ed-4e91-8369-664af05cf259",
               "identifier":"d7b52952-87ed-4e91-8369-664af05cf259",
               "structureInode":"671b2dbe-4bae-40ae-8f0a-da998248ebf1",
               "fieldName":"title",
               "fieldType":"text",
               "fieldRelationType":null,
               "fieldContentlet":"text1",
               "required":false,
               "velocityVarName":"title",
               "sortOrder":2,
               "values":null,
               "regexCheck":null,
               "hint":null,
               "defaultValue":null,
               "indexed":false,
               "listed":false,
               "fixed":false,
               "readOnly":false,
               "searchable":false,
               "unique":false,
               "modDate":1549264785000,
               "map":{
                  "fieldSortOrder":2,
                  "fieldHint":null,
                  "fieldName":"title",
                  "fieldFieldType":"text",
                  "fieldRegexCheck":null,
                  "fieldRelationType":null,
                  "fieldVelocityVarName":"title",
                  "defaultValue":null,
                  "fieldFixed":false,
                  "fieldIndexed":false,
                  "fieldSearchable":false,
                  "fieldValues":"",
                  "fieldListed":false,
                  "fieldContentlet":"text1",
                  "inode":"d7b52952-87ed-4e91-8369-664af05cf259",
                  "fieldStructureVarName":"TheContentType1",
                  "fieldRequired":false,
                  "fieldReadOnly":false,
                  "fieldUnique":false,
                  "fieldStructureInode":"671b2dbe-4bae-40ae-8f0a-da998248ebf1"
               },
               "dataType":"text",
               "live":false,
               "new":false,
               "title":"",
               "categoryId":"d7b52952-87ed-4e91-8369-664af05cf259",
               "archived":false,
               "versionId":"d7b52952-87ed-4e91-8369-664af05cf259",
               "versionType":"field",
               "modUser":"",
               "working":false,
               "permissionId":"d7b52952-87ed-4e91-8369-664af05cf259",
               "parentPermissionable":null,
               "permissionType":"com.dotmarketing.portlets.structure.model.Field",
               "idate":1549264785000,
               "locked":false
            },
            {
               "iDate":1549264952000,
               "type":"field",
               "owner":null,
               "inode":"4dcba7be-ab71-4ab3-a971-3694624d0cb5",
               "identifier":"4dcba7be-ab71-4ab3-a971-3694624d0cb5",
               "structureInode":"671b2dbe-4bae-40ae-8f0a-da998248ebf1",
               "fieldName":"value",
               "fieldType":"text",
               "fieldRelationType":null,
               "fieldContentlet":"text2",
               "required":false,
               "velocityVarName":"value",
               "sortOrder":3,
               "values":null,
               "regexCheck":null,
               "hint":null,
               "defaultValue":null,
               "indexed":false,
               "listed":false,
               "fixed":false,
               "readOnly":false,
               "searchable":false,
               "unique":false,
               "modDate":1549264952000,
               "map":{
                  "fieldSortOrder":3,
                  "fieldHint":null,
                  "fieldName":"value",
                  "fieldFieldType":"text",
                  "fieldRegexCheck":null,
                  "fieldRelationType":null,
                  "fieldVelocityVarName":"value",
                  "defaultValue":null,
                  "fieldFixed":false,
                  "fieldIndexed":false,
                  "fieldSearchable":false,
                  "fieldValues":"",
                  "fieldListed":false,
                  "fieldContentlet":"text2",
                  "inode":"4dcba7be-ab71-4ab3-a971-3694624d0cb5",
                  "fieldStructureVarName":"TheContentType1",
                  "fieldRequired":false,
                  "fieldReadOnly":false,
                  "fieldUnique":false,
                  "fieldStructureInode":"671b2dbe-4bae-40ae-8f0a-da998248ebf1"
               },
               "dataType":"text",
               "live":false,
               "new":false,
               "title":"",
               "categoryId":"4dcba7be-ab71-4ab3-a971-3694624d0cb5",
               "archived":false,
               "versionId":"4dcba7be-ab71-4ab3-a971-3694624d0cb5",
               "versionType":"field",
               "modUser":"",
               "working":false,
               "permissionId":"4dcba7be-ab71-4ab3-a971-3694624d0cb5",
               "parentPermissionable":null,
               "permissionType":"com.dotmarketing.portlets.structure.model.Field",
               "idate":1549264952000,
               "locked":false
            }
         ],
         "map":{
            "permissionId":"671b2dbe-4bae-40ae-8f0a-da998248ebf1",
            "modDate":1549265779000,
            "HTMLPageAsset":false,
            "widget":false,
            "pagedetail":null,
            "description":"THE DESCRIPTION",
            "title":"",
            "type":"structure",
            "content":true,
            "expireDateVar":null,
            "velocityVarName":"TheContentType1",
            "inode":"671b2dbe-4bae-40ae-8f0a-da998248ebf1",
            "archived":false,
            "host":false,
            "working":false,
            "locked":false,
            "live":false,
            "iDate":1549264661000,
            "owner":null,
            "versionType":"structure",
            "identifier":"671b2dbe-4bae-40ae-8f0a-da998248ebf1",
            "new":false,
            "permissionType":"com.dotmarketing.portlets.structure.model.Structure",
            "defaultStructure":false,
            "persona":false,
            "fileAsset":false,
            "urlMapPattern":null,
            "IDate":1549264661000,
            "versionId":"671b2dbe-4bae-40ae-8f0a-da998248ebf1",
            "folder":"SYSTEM_FOLDER",
            "system":false,
            "form":false,
            "publishDateVar":null,
            "parentPermissionable":true,
            "reviewInterval":null,
            "structureType":1,
            "modUser":"",
            "name":"My Test Content Type",
            "detailPage":null,
            "fixed":false,
            "categoryId":"671b2dbe-4bae-40ae-8f0a-da998248ebf1",
            "reviewerRole":null
         },
         "fileAsset":false,
         "persona":false,
         "form":false,
         "widget":false,
         "detailPage":null,
         "fieldsBySortOrder":[
            {
               "iDate":1549264785000,
               "type":"field",
               "owner":null,
               "inode":"d7b52952-87ed-4e91-8369-664af05cf259",
               "identifier":"d7b52952-87ed-4e91-8369-664af05cf259",
               "structureInode":"671b2dbe-4bae-40ae-8f0a-da998248ebf1",
               "fieldName":"title",
               "fieldType":"text",
               "fieldRelationType":null,
               "fieldContentlet":"text1",
               "required":false,
               "velocityVarName":"title",
               "sortOrder":2,
               "values":null,
               "regexCheck":null,
               "hint":null,
               "defaultValue":null,
               "indexed":false,
               "listed":false,
               "fixed":false,
               "readOnly":false,
               "searchable":false,
               "unique":false,
               "modDate":1549264785000,
               "map":{
                  "fieldSortOrder":2,
                  "fieldHint":null,
                  "fieldName":"title",
                  "fieldFieldType":"text",
                  "fieldRegexCheck":null,
                  "fieldRelationType":null,
                  "fieldVelocityVarName":"title",
                  "defaultValue":null,
                  "fieldFixed":false,
                  "fieldIndexed":false,
                  "fieldSearchable":false,
                  "fieldValues":"",
                  "fieldListed":false,
                  "fieldContentlet":"text1",
                  "inode":"d7b52952-87ed-4e91-8369-664af05cf259",
                  "fieldStructureVarName":"TheContentType1",
                  "fieldRequired":false,
                  "fieldReadOnly":false,
                  "fieldUnique":false,
                  "fieldStructureInode":"671b2dbe-4bae-40ae-8f0a-da998248ebf1"
               },
               "dataType":"text",
               "live":false,
               "new":false,
               "title":"",
               "categoryId":"d7b52952-87ed-4e91-8369-664af05cf259",
               "archived":false,
               "versionId":"d7b52952-87ed-4e91-8369-664af05cf259",
               "versionType":"field",
               "modUser":"",
               "working":false,
               "permissionId":"d7b52952-87ed-4e91-8369-664af05cf259",
               "parentPermissionable":null,
               "permissionType":"com.dotmarketing.portlets.structure.model.Field",
               "idate":1549264785000,
               "locked":false
            },
            {
               "iDate":1549264952000,
               "type":"field",
               "owner":null,
               "inode":"4dcba7be-ab71-4ab3-a971-3694624d0cb5",
               "identifier":"4dcba7be-ab71-4ab3-a971-3694624d0cb5",
               "structureInode":"671b2dbe-4bae-40ae-8f0a-da998248ebf1",
               "fieldName":"value",
               "fieldType":"text",
               "fieldRelationType":null,
               "fieldContentlet":"text2",
               "required":false,
               "velocityVarName":"value",
               "sortOrder":3,
               "values":null,
               "regexCheck":null,
               "hint":null,
               "defaultValue":null,
               "indexed":false,
               "listed":false,
               "fixed":false,
               "readOnly":false,
               "searchable":false,
               "unique":false,
               "modDate":1549264952000,
               "map":{
                  "fieldSortOrder":3,
                  "fieldHint":null,
                  "fieldName":"value",
                  "fieldFieldType":"text",
                  "fieldRegexCheck":null,
                  "fieldRelationType":null,
                  "fieldVelocityVarName":"value",
                  "defaultValue":null,
                  "fieldFixed":false,
                  "fieldIndexed":false,
                  "fieldSearchable":false,
                  "fieldValues":"",
                  "fieldListed":false,
                  "fieldContentlet":"text2",
                  "inode":"4dcba7be-ab71-4ab3-a971-3694624d0cb5",
                  "fieldStructureVarName":"TheContentType1",
                  "fieldRequired":false,
                  "fieldReadOnly":false,
                  "fieldUnique":false,
                  "fieldStructureInode":"671b2dbe-4bae-40ae-8f0a-da998248ebf1"
               },
               "dataType":"text",
               "live":false,
               "new":false,
               "title":"",
               "categoryId":"4dcba7be-ab71-4ab3-a971-3694624d0cb5",
               "archived":false,
               "versionId":"4dcba7be-ab71-4ab3-a971-3694624d0cb5",
               "versionType":"field",
               "modUser":"",
               "working":false,
               "permissionId":"4dcba7be-ab71-4ab3-a971-3694624d0cb5",
               "parentPermissionable":null,
               "permissionType":"com.dotmarketing.portlets.structure.model.Field",
               "idate":1549264952000,
               "locked":false
            }
         ],
         "htmlpageAsset":false,
         "content":true,
         "permissionId":"671b2dbe-4bae-40ae-8f0a-da998248ebf1",
         "permissionType":"com.dotmarketing.portlets.structure.model.Structure",
         "live":false,
         "new":false,
         "title":"",
         "categoryId":"671b2dbe-4bae-40ae-8f0a-da998248ebf1",
         "archived":false,
         "versionId":"671b2dbe-4bae-40ae-8f0a-da998248ebf1",
         "versionType":"structure",
         "modUser":"",
         "working":false,
         "idate":1549264661000,
         "locked":false
      },
      "folder":"SYSTEM_FOLDER",
      "indexPolicyDependencies":"DEFER",
      "contentTypeId":"671b2dbe-4bae-40ae-8f0a-da998248ebf1",
      "sortOrder":0,
      "disabledWysiwyg":[

      ],
      "versionId":"fa49145a-bc85-491a-9282-fe9e0471e37b",
      "versionType":"content",
      "lastReview":null,
      "nextReview":null,
      "reviewInterval":null,
      "modDate":1549267687339,
      "modUser":"dotcms.org.1",
      "working":true,
      "permissionId":"fa49145a-bc85-491a-9282-fe9e0471e37b",
      "titleImage":{
         "present":false
      },
      "parentPermissionable":{
         "iDate":1549264661000,
         "type":"structure",
         "owner":null,
         "inode":"671b2dbe-4bae-40ae-8f0a-da998248ebf1",
         "identifier":"671b2dbe-4bae-40ae-8f0a-da998248ebf1",
         "name":"My Test Content Type",
         "description":"THE DESCRIPTION",
         "defaultStructure":false,
         "reviewInterval":null,
         "reviewerRole":null,
         "pagedetail":null,
         "structureType":1,
         "fixed":false,
         "system":false,
         "velocityVarName":"TheContentType1",
         "urlMapPattern":null,
         "host":"48190c8c-42c4-46af-8d1a-0cd5db894797",
         "folder":"SYSTEM_FOLDER",
         "publishDateVar":null,
         "expireDateVar":null,
         "modDate":1549265779000,
         "fields":[
            {
               "iDate":1549264785000,
               "type":"field",
               "owner":null,
               "inode":"d7b52952-87ed-4e91-8369-664af05cf259",
               "identifier":"d7b52952-87ed-4e91-8369-664af05cf259",
               "structureInode":"671b2dbe-4bae-40ae-8f0a-da998248ebf1",
               "fieldName":"title",
               "fieldType":"text",
               "fieldRelationType":null,
               "fieldContentlet":"text1",
               "required":false,
               "velocityVarName":"title",
               "sortOrder":2,
               "values":null,
               "regexCheck":null,
               "hint":null,
               "defaultValue":null,
               "indexed":false,
               "listed":false,
               "fixed":false,
               "readOnly":false,
               "searchable":false,
               "unique":false,
               "modDate":1549264785000,
               "map":{
                  "fieldSortOrder":2,
                  "fieldHint":null,
                  "fieldName":"title",
                  "fieldFieldType":"text",
                  "fieldRegexCheck":null,
                  "fieldRelationType":null,
                  "fieldVelocityVarName":"title",
                  "defaultValue":null,
                  "fieldFixed":false,
                  "fieldIndexed":false,
                  "fieldSearchable":false,
                  "fieldValues":"",
                  "fieldListed":false,
                  "fieldContentlet":"text1",
                  "inode":"d7b52952-87ed-4e91-8369-664af05cf259",
                  "fieldStructureVarName":"TheContentType1",
                  "fieldRequired":false,
                  "fieldReadOnly":false,
                  "fieldUnique":false,
                  "fieldStructureInode":"671b2dbe-4bae-40ae-8f0a-da998248ebf1"
               },
               "dataType":"text",
               "live":false,
               "new":false,
               "title":"",
               "categoryId":"d7b52952-87ed-4e91-8369-664af05cf259",
               "archived":false,
               "versionId":"d7b52952-87ed-4e91-8369-664af05cf259",
               "versionType":"field",
               "modUser":"",
               "working":false,
               "permissionId":"d7b52952-87ed-4e91-8369-664af05cf259",
               "parentPermissionable":null,
               "permissionType":"com.dotmarketing.portlets.structure.model.Field",
               "idate":1549264785000,
               "locked":false
            },
            {
               "iDate":1549264952000,
               "type":"field",
               "owner":null,
               "inode":"4dcba7be-ab71-4ab3-a971-3694624d0cb5",
               "identifier":"4dcba7be-ab71-4ab3-a971-3694624d0cb5",
               "structureInode":"671b2dbe-4bae-40ae-8f0a-da998248ebf1",
               "fieldName":"value",
               "fieldType":"text",
               "fieldRelationType":null,
               "fieldContentlet":"text2",
               "required":false,
               "velocityVarName":"value",
               "sortOrder":3,
               "values":null,
               "regexCheck":null,
               "hint":null,
               "defaultValue":null,
               "indexed":false,
               "listed":false,
               "fixed":false,
               "readOnly":false,
               "searchable":false,
               "unique":false,
               "modDate":1549264952000,
               "map":{
                  "fieldSortOrder":3,
                  "fieldHint":null,
                  "fieldName":"value",
                  "fieldFieldType":"text",
                  "fieldRegexCheck":null,
                  "fieldRelationType":null,
                  "fieldVelocityVarName":"value",
                  "defaultValue":null,
                  "fieldFixed":false,
                  "fieldIndexed":false,
                  "fieldSearchable":false,
                  "fieldValues":"",
                  "fieldListed":false,
                  "fieldContentlet":"text2",
                  "inode":"4dcba7be-ab71-4ab3-a971-3694624d0cb5",
                  "fieldStructureVarName":"TheContentType1",
                  "fieldRequired":false,
                  "fieldReadOnly":false,
                  "fieldUnique":false,
                  "fieldStructureInode":"671b2dbe-4bae-40ae-8f0a-da998248ebf1"
               },
               "dataType":"text",
               "live":false,
               "new":false,
               "title":"",
               "categoryId":"4dcba7be-ab71-4ab3-a971-3694624d0cb5",
               "archived":false,
               "versionId":"4dcba7be-ab71-4ab3-a971-3694624d0cb5",
               "versionType":"field",
               "modUser":"",
               "working":false,
               "permissionId":"4dcba7be-ab71-4ab3-a971-3694624d0cb5",
               "parentPermissionable":null,
               "permissionType":"com.dotmarketing.portlets.structure.model.Field",
               "idate":1549264952000,
               "locked":false
            }
         ],
         "map":{
            "permissionId":"671b2dbe-4bae-40ae-8f0a-da998248ebf1",
            "modDate":1549265779000,
            "HTMLPageAsset":false,
            "widget":false,
            "pagedetail":null,
            "description":"THE DESCRIPTION",
            "title":"",
            "type":"structure",
            "content":true,
            "expireDateVar":null,
            "velocityVarName":"TheContentType1",
            "inode":"671b2dbe-4bae-40ae-8f0a-da998248ebf1",
            "archived":false,
            "host":false,
            "working":false,
            "locked":false,
            "live":false,
            "iDate":1549264661000,
            "owner":null,
            "versionType":"structure",
            "identifier":"671b2dbe-4bae-40ae-8f0a-da998248ebf1",
            "new":false,
            "permissionType":"com.dotmarketing.portlets.structure.model.Structure",
            "defaultStructure":false,
            "persona":false,
            "fileAsset":false,
            "urlMapPattern":null,
            "IDate":1549264661000,
            "versionId":"671b2dbe-4bae-40ae-8f0a-da998248ebf1",
            "folder":"SYSTEM_FOLDER",
            "system":false,
            "form":false,
            "publishDateVar":null,
            "parentPermissionable":true,
            "reviewInterval":null,
            "structureType":1,
            "modUser":"",
            "name":"My Test Content Type",
            "detailPage":null,
            "fixed":false,
            "categoryId":"671b2dbe-4bae-40ae-8f0a-da998248ebf1",
            "reviewerRole":null
         },
         "fileAsset":false,
         "persona":false,
         "form":false,
         "widget":false,
         "detailPage":null,
         "fieldsBySortOrder":[
            {
               "iDate":1549264785000,
               "type":"field",
               "owner":null,
               "inode":"d7b52952-87ed-4e91-8369-664af05cf259",
               "identifier":"d7b52952-87ed-4e91-8369-664af05cf259",
               "structureInode":"671b2dbe-4bae-40ae-8f0a-da998248ebf1",
               "fieldName":"title",
               "fieldType":"text",
               "fieldRelationType":null,
               "fieldContentlet":"text1",
               "required":false,
               "velocityVarName":"title",
               "sortOrder":2,
               "values":null,
               "regexCheck":null,
               "hint":null,
               "defaultValue":null,
               "indexed":false,
               "listed":false,
               "fixed":false,
               "readOnly":false,
               "searchable":false,
               "unique":false,
               "modDate":1549264785000,
               "map":{
                  "fieldSortOrder":2,
                  "fieldHint":null,
                  "fieldName":"title",
                  "fieldFieldType":"text",
                  "fieldRegexCheck":null,
                  "fieldRelationType":null,
                  "fieldVelocityVarName":"title",
                  "defaultValue":null,
                  "fieldFixed":false,
                  "fieldIndexed":false,
                  "fieldSearchable":false,
                  "fieldValues":"",
                  "fieldListed":false,
                  "fieldContentlet":"text1",
                  "inode":"d7b52952-87ed-4e91-8369-664af05cf259",
                  "fieldStructureVarName":"TheContentType1",
                  "fieldRequired":false,
                  "fieldReadOnly":false,
                  "fieldUnique":false,
                  "fieldStructureInode":"671b2dbe-4bae-40ae-8f0a-da998248ebf1"
               },
               "dataType":"text",
               "live":false,
               "new":false,
               "title":"",
               "categoryId":"d7b52952-87ed-4e91-8369-664af05cf259",
               "archived":false,
               "versionId":"d7b52952-87ed-4e91-8369-664af05cf259",
               "versionType":"field",
               "modUser":"",
               "working":false,
               "permissionId":"d7b52952-87ed-4e91-8369-664af05cf259",
               "parentPermissionable":null,
               "permissionType":"com.dotmarketing.portlets.structure.model.Field",
               "idate":1549264785000,
               "locked":false
            },
            {
               "iDate":1549264952000,
               "type":"field",
               "owner":null,
               "inode":"4dcba7be-ab71-4ab3-a971-3694624d0cb5",
               "identifier":"4dcba7be-ab71-4ab3-a971-3694624d0cb5",
               "structureInode":"671b2dbe-4bae-40ae-8f0a-da998248ebf1",
               "fieldName":"value",
               "fieldType":"text",
               "fieldRelationType":null,
               "fieldContentlet":"text2",
               "required":false,
               "velocityVarName":"value",
               "sortOrder":3,
               "values":null,
               "regexCheck":null,
               "hint":null,
               "defaultValue":null,
               "indexed":false,
               "listed":false,
               "fixed":false,
               "readOnly":false,
               "searchable":false,
               "unique":false,
               "modDate":1549264952000,
               "map":{
                  "fieldSortOrder":3,
                  "fieldHint":null,
                  "fieldName":"value",
                  "fieldFieldType":"text",
                  "fieldRegexCheck":null,
                  "fieldRelationType":null,
                  "fieldVelocityVarName":"value",
                  "defaultValue":null,
                  "fieldFixed":false,
                  "fieldIndexed":false,
                  "fieldSearchable":false,
                  "fieldValues":"",
                  "fieldListed":false,
                  "fieldContentlet":"text2",
                  "inode":"4dcba7be-ab71-4ab3-a971-3694624d0cb5",
                  "fieldStructureVarName":"TheContentType1",
                  "fieldRequired":false,
                  "fieldReadOnly":false,
                  "fieldUnique":false,
                  "fieldStructureInode":"671b2dbe-4bae-40ae-8f0a-da998248ebf1"
               },
               "dataType":"text",
               "live":false,
               "new":false,
               "title":"",
               "categoryId":"4dcba7be-ab71-4ab3-a971-3694624d0cb5",
               "archived":false,
               "versionId":"4dcba7be-ab71-4ab3-a971-3694624d0cb5",
               "versionType":"field",
               "modUser":"",
               "working":false,
               "permissionId":"4dcba7be-ab71-4ab3-a971-3694624d0cb5",
               "parentPermissionable":null,
               "permissionType":"com.dotmarketing.portlets.structure.model.Field",
               "idate":1549264952000,
               "locked":false
            }
         ],
         "htmlpageAsset":false,
         "content":true,
         "permissionId":"671b2dbe-4bae-40ae-8f0a-da998248ebf1",
         "permissionType":"com.dotmarketing.portlets.structure.model.Structure",
         "live":false,
         "new":false,
         "title":"",
         "categoryId":"671b2dbe-4bae-40ae-8f0a-da998248ebf1",
         "archived":false,
         "versionId":"671b2dbe-4bae-40ae-8f0a-da998248ebf1",
         "versionType":"structure",
         "modUser":"",
         "working":false,
         "idate":1549264661000,
         "locked":false
      },
      "permissionType":"com.dotmarketing.portlets.contentlet.model.Contentlet",
      "htmlpage":false,
      "fileAsset":false,
      "systemHost":false,
      "vanityUrl":false,
      "keyValue":false,
      "locked":false,
      "contentType":{
         "owner":null,
         "parentPermissionable":{
            "Inode":"48190c8c-42c4-46af-8d1a-0cd5db894797",
            "Identifier":"48190c8c-42c4-46af-8d1a-0cd5db894797",
            "permissionByIdentifier":true,
            "type":"com.dotmarketing.beans.Host",
            "owner":null,
            "inode":"48190c8c-42c4-46af-8d1a-0cd5db894797",
            "identifier":"48190c8c-42c4-46af-8d1a-0cd5db894797",
            "permissionId":"48190c8c-42c4-46af-8d1a-0cd5db894797",
            "parentPermissionable":null,
            "permissionType":"com.dotmarketing.beans.Host",
            "childrenPermissionable":null
         },
         "permissionId":"671b2dbe-4bae-40ae-8f0a-da998248ebf1",
         "permissionType":"com.dotmarketing.portlets.structure.model.Structure"
      }
   },
   "messages":[

   ],
   "i18nMessagesMap":{

   },
   "permissions":[

   ]
}

As you can see the contentlet has been created with the values sent, it is unpublish and the step is the same (Unpublish), let’s publish it.

curl -u admin@dotcms.com:admin -X PUT https://demo.dotcms.com/api/v1/workflow/actions/f1e2a5bf-fc84-4061-9e79-18e053b45675/fire?inode=1a104580-f88e-4368-9ae5-1b14f4a65e8e -H "Content-Type:application/json"

As you can see the content is published and the step now is publish, let’s unpublish it and them archive it

Fire Unpublish

curl -u admin@dotcms.com:admin -X PUT https://demo.dotcms.com/api/v1/workflow/actions/75f216ff14/fire?inode=1a104580-f88e-4368-9ae5-1b14f4a65e8e -H "Content-Type:application/json"

Fire Archive

curl -u admin@dotcms.com:admin -X PUT https://demo.dotcms.com/api/v1/workflow/actions/ad517cde2a/fire?inode=1a104580-f88e-4368-9ae5-1b14f4a65e8e -H "Content-Type:application/json"

Finally you can continue playing with your contentlet, adding new ones, moving between steps, etc.

On this page

×

We Dig Feedback

Selected excerpt:

×