Custom field validation on REST apis

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

Custom field validation on REST apis

Jump to solution

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 Solution

Accepted Solutions
afaust
Master

Re: Custom field validation on REST apis

Jump to solution

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 solution in original post

2 Replies
afaust
Master

Re: Custom field validation on REST apis

Jump to solution

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
Established Member II

Re: Custom field validation on REST apis

Jump to solution

Many thanks Alex!!

 

That really helps!

Alfresco Content Services Certified Engineer (ACSCE)