Issue
- When attempting to create web content that includes nested fields using the Headless API, the user encounters a 400 Bad Request error. The response message states:
"Value should not be set for transient field 'name" - Steps to reproduce:
1. Create a structure having 1 nested field (2 text and 1 upload field) or 1 text field
2. Add a JPG document in the document and media section.
3. Navigate to localhost:8080/o/api, request URL: (POST) http://localhost:8080/o/headless-delivery/v1.0/sites/20119/structured-contents
4. Pass the below in the request body:{ "contentFields": [ { "contentFieldValue": { "data": "title before change" }, "dataType": "string", "inputControl": "text", "label": "Title head", "name": "Text58075704", "nestedContentFields": [], "repeatable": false }, { "contentFieldValue": {}, "dataType": "", "label": "nested field", "name": "Fieldset02998378", "nestedContentFields": [ { "contentFieldValue": { "data": "field 1 after change" }, "dataType": "string", "inputControl": "text", "label": "feild q", "name": "Text11418434", "nestedContentFields": [], "repeatable": false }, { "contentFieldValue": { "document": { "contentType": "Document", "contentUrl": "/documents/d/guest/90mb", "description": "Get customized package andman nikobar", "encodingFormat": "image/jpeg", "fileExtension": "jpg", "id": 33155, "sizeInBytes": 138780, "title": "119000/-INR per person" } }, "dataType": "document", "label": "Select photo", "name": "DocumentLibrary78180319", "nestedContentFields": [], "repeatable": false }, { "contentFieldValue": { "data": "fieldfield 2 after change" }, "dataType": "string", "inputControl": "text", "label": "field 2", "name": "Text72087547", "nestedContentFields": [], "repeatable": false } ], "repeatable": false } ], "contentStructureId": 33116, "title": "nested field structire contents after update" }
Environment
- DXP 7.4
- 2023.Q4 Quarterly Release
Resolution
- Remove the
"contentFieldValue": {}
line for the fieldset field from the request body. For example:{ "contentFields": [ { "contentFieldValue": { "data": "title before change" }, "dataType": "string", "inputControl": "text", "label": "Title head", "name": "Text58075704", "nestedContentFields": [], "repeatable": false }, { "dataType": "", "label": "nested field", "name": "Fieldset02998378", "nestedContentFields": [ { "contentFieldValue": { "data": "field 1 after change" }, "dataType": "string", "inputControl": "text", "label": "feild q", "name": "Text11418434", "nestedContentFields": [], "repeatable": false }, { "contentFieldValue": { "document": { "contentType": "Document", "contentUrl": "/documents/d/guest/90mb", "description": "Get customized package andaman nicobar", "encodingFormat": "image/jpeg", "fileExtension": "jpg", "id": 33155, "sizeInBytes": 138780, "title": "119000/-INR per person" } }, "dataType": "document", "label": "Select photo", "name": "DocumentLibrary78180319", "nestedContentFields": [], "repeatable": false }, { "contentFieldValue": { "data": "fieldfield 2 after change" }, "dataType": "string", "inputControl": "text", "label": "field 2", "name": "Text72087547", "nestedContentFields": [], "repeatable": false } ], "repeatable": false } ], "contentStructureId": 33116, "title": "nested field structure contents after update" }