0

In dotCMS,
1) I Created a content type with name product with 3 fields (name, id, description). Name and id fields created by selecting unique option. Name and Id fields combination should give uniqueness. But in dotCMS there is individual field unique option. When I try to add new content with below data it is failing to insert .
a) name: prod1, id : 1, description: phone.
b) name: prod2, id: 1, description: tablet.

2) While calling REST api to save/publish a content, is there any way to pass multiple input instead of single PUT or POST. https://dotcms.com/docs/latest/rest-api-end-points#ContentResource

Is there any solution for above two problems?

Mahesh G
  • 51
  • 1
  • 12

1 Answers1

0
  1. The Unique option applies only to a single field, and ensures each content item has a Unique value for that field only. There's no built-in way to check for uniqueness on multiple fields.

However one relatively simple way to do what you want is to create a separate custom field that automatically fills with the value of the name and ID fields (just append the value of the two fields), and then just set the Unique flag on the custom field. For more information on custom fields, see https://auth.dotcms.com/docs/latest/custom-field. Note that the dotCMS starter site includes many custom fields you can use as examples as well.

  1. I'm not sure what you mean. If you mean can you make a single REST call to create or update multiple individual content items, then the answer is no - you need to do a separate REST call for each item you want to create or update. (So you'd either need to code a loop to create each piece of content, or use another method such as importing content using a CSV file).

If that's not what you mean, can you please clarify your question?

  • I will try custom field for point 1. For point 2, Yes I mean the same thing, calling REST API with multiple inputs, We can import multiple content through CSV file, Is there any REST API end point to call CSV import functionality instead of using UI? – Mahesh G Jun 19 '17 at 14:59