Headless Delivery API - Create Structure Content in a Folder
Headless Delivery API - Create Structure Content in a Folder
https://liferay.dev/en/c/message_boards/find_thread?p_l_id=119785333&threadId=120561577
2024-03-29T13:20:59Z
2024-03-29T13:20:59Z
RE: RE: Headless Delivery API - Create Structure Content in a Folder
Javier Gamarra
https://liferay.dev/en/c/message_boards/find_message?p_l_id=119785333&messageId=120688787
2021-03-19T10:40:45Z
2021-03-19T10:40:45Z
<p>Ok, I've backported the fix so it'll be available in the next fixpacks</p>
Javier Gamarra
2021-03-19T10:40:45Z
RE: RE: Headless Delivery API - Create Structure Content in a Folder
Daniel Merchan Garcia
https://liferay.dev/en/c/message_boards/find_message?p_l_id=119785333&messageId=120685089
2021-03-17T10:39:35Z
2021-03-16T09:07:18Z
<p>Thanks Javier for the answer</p>
<p>It is Liferay 7.3.5 CE Edition</p>
<p>Kind regards.</p>
Daniel Merchan Garcia
2021-03-16T09:07:18Z
RE: Headless Delivery API - Create Structure Content in a Folder
Javier Gamarra
https://liferay.dev/en/c/message_boards/find_message?p_l_id=119785333&messageId=120684509
2021-03-14T17:40:49Z
2021-03-14T17:40:49Z
<p>The issue is the extra fields group, if you just use the default one
(and separators, those should be supported) it should work fine. So
it's a bug with the management of several field groups, I've created a
ticket here: https://issues.liferay.com/browse/LPS-129105 and sent a fix.</p>
<p>Which version are you using?</p>
<p>PD: Sorry for the delay, the message slipped through the cracks.</p>
Javier Gamarra
2021-03-14T17:40:49Z
RE: Headless Delivery API - Create Structure Content in a Folder
Daniel Merchan Garcia
https://liferay.dev/en/c/message_boards/find_message?p_l_id=119785333&messageId=120561627
2021-01-26T18:35:37Z
2021-01-26T18:24:37Z
<p>This is the Structure Content definition:</p>
<pre><code class="language-javascript">{
"availableLanguages": [
"ar-SA",
"en-US"
],
"contentStructureFields": [
{
"dataType": "",
"label": "Content Information",
"localizable": true,
"multiple": false,
"name": "ContentInformation",
"nestedContentStructureFields": [
{
"dataType": "string",
"inputControl": "text",
"label": "Content Code",
"localizable": false,
"multiple": false,
"name": "ContentCode",
"nestedContentStructureFields": [],
"options": [],
"predefinedValue": "",
"repeatable": false,
"required": false,
"showLabel": true
},
{
"dataType": "string",
"inputControl": "text",
"label": "Content Description",
"localizable": true,
"multiple": false,
"name": "ContentDescription",
"nestedContentStructureFields": [],
"options": [],
"predefinedValue": "",
"repeatable": false,
"required": false,
"showLabel": true
},
{
"dataType": "string",
"inputControl": "select",
"label": "Content Type",
"localizable": false,
"multiple": false,
"name": "ContentType",
"nestedContentStructureFields": [],
"options": [
{
"label": "Offer",
"value": "offer"
},
{
"label": "Sales Catalog",
"value": "sales-catalog"
},
{
"label": "FAQ",
"value": "FAQ"
},
{
"label": "Agreement",
"value": "agreement"
}
],
"predefinedValue": "[\"\"]",
"repeatable": false,
"required": false,
"showLabel": true
}
],
"options": [],
"predefinedValue": "",
"repeatable": false,
"required": false,
"showLabel": true
},
{
"dataType": "",
"label": "Resource",
"localizable": true,
"multiple": false,
"name": "Resource",
"nestedContentStructureFields": [
{
"dataType": "document",
"label": "Huawei Resource",
"localizable": true,
"multiple": false,
"name": "HuaweiResource",
"nestedContentStructureFields": [
{
"dataType": "string",
"inputControl": "select",
"label": "Channel",
"localizable": false,
"multiple": false,
"name": "Channel",
"nestedContentStructureFields": [],
"options": [
{
"label": "Mobile",
"value": "mobile"
},
{
"label": "Web",
"value": "web"
}
],
"predefinedValue": "[\"\"]",
"repeatable": false,
"required": false,
"showLabel": true
},
{
"dataType": "string",
"inputControl": "select",
"label": "Located",
"localizable": false,
"multiple": false,
"name": "Located",
"nestedContentStructureFields": [],
"options": [
{
"label": "List",
"value": "list"
},
{
"label": "Detail",
"value": "detail"
},
{
"label": "Home",
"value": "home"
}
],
"predefinedValue": "[\"home\"]",
"repeatable": false,
"required": false,
"showLabel": true
}
],
"options": [],
"predefinedValue": "",
"repeatable": false,
"required": false,
"showLabel": true
}
],
"options": [],
"predefinedValue": "",
"repeatable": true,
"required": false,
"showLabel": true
}
],
"creator": {
"additionalName": "",
"contentType": "UserAccount",
"familyName": "Test",
"givenName": "Test",
"id": 20125,
"name": "Test Test"
},
"dateCreated": "2021-01-13T13:06:41Z",
"dateModified": "2021-01-21T14:05:52Z",
"description": "Huawei Content along with Huawei Resources",
"id": 38361,
"name": "Huawei Content",
"siteId": 20121
}</code></pre>
<p>And this is a Screenshot of the Structure rendered in Edit Mode</p>
<p>
<img src="/documents/14/0/Structure.png/68a7b6d8-bc38-8872-bfa4-b3cf46b986bd?t=1611685472200&imagePreview=1" /></p>
<p> </p>
Daniel Merchan Garcia
2021-01-26T18:24:37Z
Headless Delivery API - Create Structure Content in a Folder
Daniel Merchan Garcia
https://liferay.dev/en/c/message_boards/find_message?p_l_id=119785333&messageId=120561576
2021-01-26T18:35:38Z
2021-01-26T17:22:48Z
<p>Hello,</p>
<p>I am trying to use the Headless Delivery API 1.0 for creating
Structure Content in a specific Folder.</p>
<p>Here is a GET response:</p>
<pre><code class="language-javascript">{
"actions": {
"get": {
"method": "GET",
"href": "http://localhost:8080/o/headless-delivery/v1.0/structured-content-folders/{structuredContentFolderId}/structured-contents"
},
"create": {
"method": "POST",
"href": "http://localhost:8080/o/headless-delivery/v1.0/structured-content-folders/{structuredContentFolderId}/structured-contents"
}
},
"facets": [],
"items": [
{
"actions": {
"get-rendered-content": {
"method": "GET",
"href": "http://localhost:8080/o/headless-delivery/v1.0/structured-contents/{structuredContentId}/rendered-content/{contentTemplateId}"
},
"subscribe": {
"method": "PUT",
"href": "http://localhost:8080/o/headless-delivery/v1.0/structured-contents/{structuredContentId}/subscribe"
},
"unsubscribe": {
"method": "PUT",
"href": "http://localhost:8080/o/headless-delivery/v1.0/structured-contents/{structuredContentId}/unsubscribe"
},
"get": {
"method": "GET",
"href": "http://localhost:8080/o/headless-delivery/v1.0/structured-contents/{structuredContentId}"
},
"replace": {
"method": "PUT",
"href": "http://localhost:8080/o/headless-delivery/v1.0/structured-contents/{structuredContentId}"
},
"update": {
"method": "PATCH",
"href": "http://localhost:8080/o/headless-delivery/v1.0/structured-contents/{structuredContentId}"
},
"delete": {
"method": "DELETE",
"href": "http://localhost:8080/o/headless-delivery/v1.0/structured-contents/{structuredContentId}"
}
},
"availableLanguages": [
"en-US"
],
"contentFields": [
{
"contentFieldValue": {},
"dataType": "",
"label": "Content Information",
"name": "ContentInformation",
"nestedContentFields": [
{
"contentFieldValue": {
"data": "OFF001"
},
"dataType": "string",
"inputControl": "text",
"label": "Content Code",
"name": "ContentCode",
"nestedContentFields": [],
"repeatable": false
},
{
"contentFieldValue": {
"data": "Offer 1 for Huawei"
},
"dataType": "string",
"inputControl": "text",
"label": "Content Description",
"name": "ContentDescription",
"nestedContentFields": [],
"repeatable": false
},
{
"contentFieldValue": {
"data": "[\"offer\"]"
},
"dataType": "string",
"inputControl": "select",
"label": "Content Type",
"name": "ContentType",
"nestedContentFields": [],
"repeatable": false
}
],
"repeatable": false
},
{
"contentFieldValue": {},
"dataType": "",
"label": "Resource",
"name": "Resource",
"nestedContentFields": [
{
"contentFieldValue": {
"document": {
"contentType": "Document",
"contentUrl": "/documents/20121/38282/Test+Huawei+Cover.jpg/1802157f-e6fa-02db-4473-1ed962e65be3?t=1611052861115",
"description": "Test",
"encodingFormat": "image/jpeg",
"fileExtension": "jpg",
"id": 38293,
"sizeInBytes": 51726,
"title": "Test Huawei Cover"
}
},
"dataType": "document",
"label": "Huawei Resource",
"name": "HuaweiResource",
"nestedContentFields": [
{
"contentFieldValue": {
"data": "[\"web\"]"
},
"dataType": "string",
"inputControl": "select",
"label": "Channel",
"name": "Channel",
"nestedContentFields": [],
"repeatable": false
},
{
"contentFieldValue": {
"data": "[\"list\"]"
},
"dataType": "string",
"inputControl": "select",
"label": "Located",
"name": "Located",
"nestedContentFields": [],
"repeatable": false
}
],
"repeatable": false
}
],
"repeatable": true
},
{
"contentFieldValue": {},
"dataType": "",
"label": "Resource",
"name": "Resource",
"nestedContentFields": [
{
"contentFieldValue": {
"document": {
"contentType": "Document",
"contentUrl": "/documents/20121/38282/Test+Huawei+P30+Lite.jpg/eac3c035-0cbf-1135-c2ee-9c65746e02ae?t=1611052802311",
"description": "Test",
"encodingFormat": "image/jpeg",
"fileExtension": "jpg",
"id": 38303,
"sizeInBytes": 20747,
"title": "Test Huawei P30 Lite"
}
},
"dataType": "document",
"label": "Huawei Resource",
"name": "HuaweiResource",
"nestedContentFields": [
{
"contentFieldValue": {
"data": "[\"mobile\"]"
},
"dataType": "string",
"inputControl": "select",
"label": "Channel",
"name": "Channel",
"nestedContentFields": [],
"repeatable": false
},
{
"contentFieldValue": {
"data": "[\"list\"]"
},
"dataType": "string",
"inputControl": "select",
"label": "Located",
"name": "Located",
"nestedContentFields": [],
"repeatable": false
}
],
"repeatable": false
}
],
"repeatable": true
},
{
"contentFieldValue": {},
"dataType": "",
"label": "Resource",
"name": "Resource",
"nestedContentFields": [
{
"contentFieldValue": {
"document": {
"contentType": "Document",
"contentUrl": "/documents/20121/38279/HTML+for+P20/cbf5efc8-ee11-c23a-b3a4-0a0884a9476b?t=1611669428021",
"description": "P20",
"encodingFormat": "application/octet-stream",
"fileExtension": "",
"id": 38323,
"sizeInBytes": 0,
"title": "HTML for P20"
}
},
"dataType": "document",
"label": "Huawei Resource",
"name": "HuaweiResource",
"nestedContentFields": [
{
"contentFieldValue": {
"data": "[\"web\"]"
},
"dataType": "string",
"inputControl": "select",
"label": "Channel",
"name": "Channel",
"nestedContentFields": [],
"repeatable": false
},
{
"contentFieldValue": {
"data": "[\"detail\"]"
},
"dataType": "string",
"inputControl": "select",
"label": "Located",
"name": "Located",
"nestedContentFields": [],
"repeatable": false
}
],
"repeatable": false
}
],
"repeatable": true
}
],
"contentStructureId": 38361,
"creator": {
"additionalName": "",
"contentType": "UserAccount",
"familyName": "Test",
"givenName": "Test",
"id": 20125,
"name": "Test Test"
},
"customFields": [],
"dateCreated": "2021-01-18T16:37:17Z",
"dateModified": "2021-01-21T16:09:22Z",
"datePublished": "2021-01-18T16:36:00Z",
"description": "",
"friendlyUrlPath": "offer-001-test",
"id": 38837,
"key": "38835",
"keywords": [],
"numberOfComments": 0,
"relatedContents": [],
"renderedContents": [],
"siteId": 20121,
"subscribed": false,
"taxonomyCategoryBriefs": [],
"title": "Offer 001 Test",
"uuid": "a2e99c53-3a9b-3c79-994b-2b55b2cf54f1"
}
],
"lastPage": 1,
"page": 1,
"pageSize": 20,
"totalCount": 1
}</code></pre>
<p>Here is a POST request (Body) I am trying to use:</p>
<pre><code class="language-javascript">{
"contentFields":[
{
"name":"ContentInformation",
"nestedContentFields":[
{
"contentFieldValue":{
"data":"OFF001"
},
"name":"ContentCode"
},
{
"contentFieldValue":{
"data":"Offer 1 for Huawei"
},
"name":"ContentDescription"
},
{
"contentFieldValue":{
"data":"offer"
},
"name":"ContentType"
}
]
},
{
"name":"Resource",
"nestedContentFields":[
{
"contentFieldValue":{
"document":{
"id":38293
}
},
"name":"HuaweiResource",
"nestedContentFields":[
{
"contentFieldValue":{
"data":"web"
},
"name":"Channel"
},
{
"contentFieldValue":{
"data":"list"
},
"name":"Located"
}
]
}
]
},
{
"name":"Resource",
"nestedContentFields":[
{
"contentFieldValue":{
"document":{
"id":38303
}
},
"name":"HuaweiResource",
"nestedContentFields":[
{
"contentFieldValue":{
"data":"mobile"
},
"name":"Channel"
},
{
"contentFieldValue":{
"data":"list"
},
"name":"Located"
}
]
}
]
},
{
"contentFieldValue":{
},
"name":"Resource",
"nestedContentFields":[
{
"contentFieldValue":{
"document":{
"id":38323
}
},
"name":"HuaweiResource",
"nestedContentFields":[
{
"contentFieldValue":{
"data":"web"
},
"name":"Channel"
},
{
"contentFieldValue":{
"data":"detail"
},
"name":"Located"
}
]
}
]
}
],
"contentStructureId": 38361,
"title":"Offer 001 Test API"
}</code></pre>
<p>I am facing an infinite loop between:</p>
<p>- <strong>No value is specified for field ContentInformation</strong></p>
<p>- <strong>Value should not be set for transient field name ContentInformation</strong></p>
<p>ContentInformation is just a