cancel
Showing results for 
Search instead for 
Did you mean: 

Custom field validation on REST apis

ranjeetsi
Star Contributor
Star Contributor

Hi 

Alfresco provides a rich set of REST apis(ACS REST api and CMIS REST apis(OASIS specification implementation) for external integration .

But for custom type upload of document - the mandatory field validation is not done . And content is uploaded -> node created in alfresco. However showing warning sign on the mandatory custom properties.

Ideally  - it should give a bad request (400) , OR is there any way /configuration to have the mandatory fields(custom type , aspects) applied in REST calls?

Kindly note: I understand that - 

a) We can create webscripts for upload of specific type and validation done.(extending)

b) UI can do validation on form .

Ranjeet

Alfresco Content Services Certified Engineer (ACSCE)
1 ACCEPTED ANSWER

afaust
Legendary Innovator
Legendary Innovator

You should maybe check with the documentation on Alfresco data models about the "mandatory" vs. "enforced mandatory" configuration for model properties. Any property that is set as "mandatory" without having the "enforced" flag as "true" is not "hard mandatory" - meaning it is perfectly valid to create a node without the property being set and the expected result would indeed be that Alfresco flags the node as incomplete (with warning flags in the UI). Only if you have an "enforced mandatory" property not set during creation should you expect a failure - and I can say that the validation for that is completely independent of which API is used to create the node, so will definitely occur and fail even for the ReST API.

View answer in original post

2 REPLIES 2

afaust
Legendary Innovator
Legendary Innovator

You should maybe check with the documentation on Alfresco data models about the "mandatory" vs. "enforced mandatory" configuration for model properties. Any property that is set as "mandatory" without having the "enforced" flag as "true" is not "hard mandatory" - meaning it is perfectly valid to create a node without the property being set and the expected result would indeed be that Alfresco flags the node as incomplete (with warning flags in the UI). Only if you have an "enforced mandatory" property not set during creation should you expect a failure - and I can say that the validation for that is completely independent of which API is used to create the node, so will definitely occur and fail even for the ReST API.

ranjeetsi
Star Contributor
Star Contributor

Many thanks Alex!!

That really helps!

Alfresco Content Services Certified Engineer (ACSCE)