<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <title>Adding multi-language structured webcontents through headless API</title>
  <link rel="self" href="https://liferay.dev/c/message_boards/find_thread?p_l_id=119785294&amp;threadId=120422270" />
  <subtitle>Adding multi-language structured webcontents through headless API</subtitle>
  <id>https://liferay.dev/c/message_boards/find_thread?p_l_id=119785294&amp;threadId=120422270</id>
  <updated>2026-04-04T03:14:06Z</updated>
  <dc:date>2026-04-04T03:14:06Z</dc:date>
  <entry>
    <title>RE: Adding multi-language structured webcontents through headless API</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=120427361" />
    <author>
      <name>Fernando Fernandez</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=120427361</id>
    <updated>2020-11-12T11:31:01Z</updated>
    <published>2020-11-12T11:31:01Z</published>
    <summary type="html">&lt;html&gt;&lt;head&gt;&lt;/head&gt;&lt;body&gt;&lt;p&gt;Thanks Javier, that did it! :-)&lt;/p&gt;
&lt;p&gt;I think I'm still sending too much data but this POST works:&lt;/p&gt;
&lt;pre&gt;&lt;code class="language-javascript"&gt;{
    "contentStructureId": 38734,
    "siteId": 20124,
	
	
    "title": "Investimento de 900 mil euros",
    "title_i18n": {
        "pt-PT": "Investimento de 900 mil euros",
        "en-US": "Investimento de 900 mil euros"
    },
	
    "description": "Enim sapiente integer exercitation beatae ab platea eos.",
    "description_i18n": {
        "pt-PT": "Enim sapiente integer exercitation beatae ab platea eos.",
        "en-US": "Enim sapiente integer exercitation beatae ab platea eos."
    },
	
    "contentFields": [
        {
            "dataType": "string",
            "inputControl": "textarea",
            "label": "PageContent",
            "label_i18n": {
                "en-US": "PageContent"
            },
            "name": "PageContent",
            "nestedContentFields": [],
            "repeatable": false,
            "value": {
                "data": "Com o intuito de promover a manutenção, cerca de 900 mil euros."
            },
            "value_i18n": {
                "pt-PT": {
                    "data": "Com o intuito de promover a manutenção, cerca de 900 mil euros."
                },
                "en-US": {
                    "data": "Com o intuito de promover a manutenção, cerca de 900 mil euros."
                }
            }
        },
        {
            "dataType": "image",
            "label": "PageImage",
            "label_i18n": {
                "en-US": "PageImage"
            },
            "name": "PageImage",
            "nestedContentFields": [],
            "repeatable": false,
            "value": {
                "image": {
                        "contentType": "Document",
                        "contentUrl": "/documents/20124/38878/cm187383b.jpg/a94237dd-7e2b-a555-bae2-a76a386ab289?t=1605130977583",
                        "description": "",
                        "encodingFormat": "image/jpeg",
                        "fileExtension": "jpg",
                        "id": 39158,
                        "sizeInBytes": 8411159,
                        "title": "cm187383b.jpg"
                }
            },
            "value_i18n": {
                "pt-PT": {
                    "image": {
                        "contentType": "Document",
                        "contentUrl": "/documents/20124/38878/cm187383b.jpg/a94237dd-7e2b-a555-bae2-a76a386ab289?t=1605130977583",
                        "description": "",
                        "encodingFormat": "image/jpeg",
                        "fileExtension": "jpg",
                        "id": 39158,
                        "sizeInBytes": 8411159,
                        "title": "cm187383b.jpg"
                    }
                },
                "en-US": {
                    "image": {
                        "contentType": "Document",
                        "contentUrl": "/documents/20124/38878/cm187383b.jpg/a94237dd-7e2b-a555-bae2-a76a386ab289?t=1605130977583",
                        "description": "",
                        "encodingFormat": "image/jpeg",
                        "fileExtension": "jpg",
                        "id": 39158,
                        "sizeInBytes": 8411159,
                        "title": "cm187383b.jpg"
                    }
				}
            }
        }
    ],
    "taxonomyCategoryIds":[38762]


}&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</summary>
    <dc:creator>Fernando Fernandez</dc:creator>
    <dc:date>2020-11-12T11:31:01Z</dc:date>
  </entry>
  <entry>
    <title>RE: RE: Adding multi-language structured webcontents through headless API</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=120426880" />
    <author>
      <name>Javier De Arcos</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=120426880</id>
    <updated>2020-11-12T09:30:44Z</updated>
    <published>2020-11-12T09:30:44Z</published>
    <summary type="html">&lt;html&gt;&lt;head&gt;&lt;/head&gt;&lt;body&gt;&lt;p&gt;To provide the Taxonomy Categories you should add them as an array of
  their ids. If you take a look to the StructuredContent schema you will
  find it in the property taxonomyCategoryIds&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;StructuredContent:
            description:
                Represents content that has fields and is rendered by a template backed by a `ContentStructure`. This is
                modeled internally as a `JournalArticle`.
            properties:
                ...
                taxonomyCategoryIds:
                    description:
                        A write-only field to add a category to this structured content.
                    items:
                        format: int64
                        type: integer
                    type: array
                    writeOnly: true
                ...
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;So you have to add them in your request like&lt;/p&gt;
&lt;pre&gt;&lt;code class="language-javascript"&gt;"taxonomyCategoryIds":[38762]&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;In the case of the images, I guess the problem is you are not
  providing any value to the default language in the "value"
  property, like you are doing with the text area field. You should
  provide the english value in the "value" property and any
  other value in the "value_i18n" property. Try this and let
  me know&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</summary>
    <dc:creator>Javier De Arcos</dc:creator>
    <dc:date>2020-11-12T09:30:44Z</dc:date>
  </entry>
  <entry>
    <title>RE: RE: Adding multi-language structured webcontents through headless API</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=120426251" />
    <author>
      <name>Fernando Fernandez</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=120426251</id>
    <updated>2020-11-12T00:24:56Z</updated>
    <published>2020-11-12T00:24:56Z</published>
    <summary type="html">&lt;html&gt;&lt;head&gt;&lt;/head&gt;&lt;body&gt;&lt;p&gt;Hi Luis Miguel,&lt;/p&gt;
&lt;p&gt;WIth your help and a suggestion I also got from Javier Arcos on slack
  I managed to POST a multi-language web content. I'm currently trying
  to add an image and some categories but I'm getting nowhere.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I have a structure in place and I follow the JSON I get from a
  content inputed by hand, but it seems the images and categories are
  just being ignored, althoug the web content is being stored.&lt;/p&gt;
&lt;p&gt;I'm POSTing
  to&amp;nbsp;http://localhost:8080/o/headless-delivery/v1.0/sites/20124/structured-contents/
  with a request body like:&lt;/p&gt;
&lt;pre&gt;&lt;code class="language-javascript"&gt;{
	"contentStructureId": 38734,
	"dateCreated": "2020-11-01T06:00:00Z",
    "dateModified": "2020-11-01T06:00:00Z",
    "datePublished": "2020-11-01T06:00:00Z",
    "siteId": 20124,
	
	
    "title": "Investimento de 900 mil euros",
    "title_i18n": {
        "pt-PT": "Investimento de 900 mil euros",
        "en-US": "Investimento de 900 mil euros"
    },
	
	"description": "Enim sapiente integer exercitation beatae ab platea eos.",
    "description_i18n": {
        "pt-PT": "Enim sapiente integer exercitation beatae ab platea eos.",
        "en-US": "Enim sapiente integer exercitation beatae ab platea eos."
    },
	
    "contentFields": [
        {
            "dataType": "string",
            "inputControl": "textarea",
            "label": "PageContent",
            "label_i18n": {
                "en-US": "PageContent"
            },
            "name": "PageContent",
            "nestedContentFields": [],
            "repeatable": false,
            "value": {
                "data": "Com o intuito de promover a manutenção, cerca de 900 mil euros."
            },
            "value_i18n": {
                "pt-PT": {
                    "data": "Com o intuito de promover a manutenção, cerca de 900 mil euros."
                },
                "en-US": {
                    "data": "Com o intuito de promover a manutenção, cerca de 900 mil euros."
                }
            }
        },
        {
            "dataType": "image",
            "label": "PageImage",
            "label_i18n": {
                "en-US": "PageImage"
            },
            "name": "PageImage",
            "nestedContentFields": [],
            "repeatable": false,
            "value": {},
            "value_i18n": {
                "pt-PT": {
                    "image": {
                        "contentType": "Document",
                        "contentUrl": "/documents/20124/38878/cm187383b.jpg/a94237dd-7e2b-a555-bae2-a76a386ab289?t=1605130977583",
                        "description": "",
                        "encodingFormat": "image/jpeg",
                        "fileExtension": "jpg",
                        "id": 39158,
                        "sizeInBytes": 8411159,
                        "title": "cm187383b.jpg"
                    }
                },
                "en-US": {
                    "image": {
                        "contentType": "Document",
                        "contentUrl": "/documents/20124/38878/cm187383b.jpg/a94237dd-7e2b-a555-bae2-a76a386ab289?t=1605130977583",
                        "description": "",
                        "encodingFormat": "image/jpeg",
                        "fileExtension": "jpg",
                        "id": 39158,
                        "sizeInBytes": 8411159,
                        "title": "cm187383b.jpg"
                    }
				}
            }
        }
    ],

    "taxonomyCategories": [
        {
            "taxonomyCategoryId": 38762,
            "taxonomyCategoryName": "Urbanismo",
            "taxonomyCategoryName_i18n": {
                "pt-PT": "Urbanismo",
                "en-US": "Urbanismo"
            }
        }
    ]

}&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;The response I get from the server doesn't include neither the
  images nor the categories:&lt;/p&gt;
&lt;pre&gt;&lt;code class="language-javascript"&gt;{
    "actions": {
        "subscribe": {
            "method": "PUT",
            "href": "http://localhost:8080/o/headless-delivery/v1.0/structured-content/{structuredContentId}/subscribe"
        },
        "unsubscribe": {
            "method": "PUT",
            "href": "http://localhost:8080/o/headless-delivery/v1.0/structured-content/{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}"
        },
        "get-template": {
            "method": "GET",
            "href": "http://localhost:8080/o/headless-delivery/v1.0/structured-contents/{structuredContentId}/rendered-content/{templateId}"
        },
        "delete": {
            "method": "DELETE",
            "href": "http://localhost:8080/o/headless-delivery/v1.0/structured-contents/{structuredContentId}"
        }
    },
    "availableLanguages": [
        "en-US",
        "pt-PT"
    ],
    "contentFields": [
        {
            "dataType": "string",
            "inputControl": "textarea",
            "label": "PageContent",
            "name": "PageContent",
            "nestedContentFields": [],
            "repeatable": false,
            "value": {
                "data": "Com o intuito de promover a manutenção, cerca de 900 mil euros."
            }
        },
        {
            "dataType": "image",
            "label": "PageImage",
            "name": "PageImage",
            "nestedContentFields": [],
            "repeatable": false,
            "value": {}
        }
    ],
    "contentStructureId": 38734,
    "creator": {
        "additionalName": "",
        "contentType": "UserAccount",
        "familyName": "Test",
        "givenName": "Test",
        "id": 20130,
        "name": "Test Test",
        "profileURL": "/web/test"
    },
    "customFields": [],
    "dateCreated": "2020-11-12T00:14:49Z",
    "dateModified": "2020-11-12T00:14:49Z",
    "datePublished": "2020-11-01T06:00:00Z",
    "description": "Enim sapiente integer exercitation beatae ab platea eos.",
    "friendlyUrlPath": "investimento-de-900-mil-euros",
    "id": 39285,
    "key": "39283",
    "keywords": [],
    "numberOfComments": 0,
    "relatedContents": [],
    "renderedContents": [
        {
            "renderedContentURL": "http://localhost:8080/o/headless-delivery/v1.0/structured-contents/39285/rendered-content/39249",
            "templateName": "NewsStory basic template"
        }
    ],
    "siteId": 20124,
    "subscribed": false,
    "taxonomyCategories": [],
    "title": "Investimento de 900 mil euros",
    "uuid": "e85f7271-c645-690c-35a7-00de30dff8af"
}&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Any ideas?&lt;/p&gt;
&lt;p&gt;I'm using DXP 7.2 SP2.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;TIA&lt;/p&gt;
&lt;p&gt;Fernando&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</summary>
    <dc:creator>Fernando Fernandez</dc:creator>
    <dc:date>2020-11-12T00:24:56Z</dc:date>
  </entry>
  <entry>
    <title>RE: Adding multi-language structured webcontents through headless API</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=120425489" />
    <author>
      <name>Luis Miguel Barcos</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=120425489</id>
    <updated>2020-11-11T10:46:18Z</updated>
    <published>2020-11-11T10:46:18Z</published>
    <summary type="html">&lt;html&gt;&lt;head&gt;&lt;/head&gt;&lt;body&gt;&lt;p&gt;Hello Fernando,&lt;/p&gt;
&lt;p&gt;To add multilingual fields it is necessary to use the &lt;em&gt;i18n&lt;/em&gt;
  &lt;em&gt;properties&lt;/em&gt;. For example, if you have a localized title you
  should use &lt;em&gt;title&lt;/em&gt; with the default language (or the one using
  in the accept-language header) and the rest you add it in the
  &lt;em&gt;title_i18n&lt;/em&gt; like&lt;/p&gt;
&lt;pre&gt;&lt;code class="language-html"&gt;{
  ...
  "title": "The notebook"
  "title_i18n": {
	"es_ES": "El diario",
	"fr_FR": "Le notebook"
  },
  ...
}&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;If the multilingual content is inside a contentField you should use
  the data_i18n or similiar properties to add the localized values.&lt;/p&gt;
&lt;p&gt;Hope this helps you and kudos to Javier de Arcos for the response.&lt;/p&gt;
&lt;p&gt;Luismi&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</summary>
    <dc:creator>Luis Miguel Barcos</dc:creator>
    <dc:date>2020-11-11T10:46:18Z</dc:date>
  </entry>
  <entry>
    <title>Adding multi-language structured webcontents through headless API</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=120422269" />
    <author>
      <name>Fernando Fernandez</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=120422269</id>
    <updated>2020-11-09T21:50:20Z</updated>
    <published>2020-11-09T21:50:20Z</published>
    <summary type="html">&lt;html&gt;&lt;head&gt;&lt;/head&gt;&lt;body&gt;&lt;p&gt;Hi guys,&lt;/p&gt;
&lt;p&gt;On 7.2 I'm trying to add structured content with headless api. I
  created a structure "Client" with two text fields (Name and Surname).&lt;/p&gt;
&lt;p&gt;I'm already able to insert new webcontents with:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;POST&amp;amp;nbsp; http://localhost:8080/o/headless-delivery/v1.0/sites/20124/structured-contents/&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Where the request body is:&lt;/p&gt;
&lt;pre&gt;&lt;code class="language-javascript"&gt;{
    "title": "Mary Shelley",
    "contentStructureId": 38610,
    "contentFields": [
        {
            "name": "Name",
            "value": {
                "data": "Mary"
            }
        },
        {
            "name": "Surname",
            "value": {
                "data": "Shelley"
            }
        }
    ]
}&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Now I need to add multi-lingual content but I'm at a loss on how to
  do it, even if it seems to be &lt;a href="https://app.swaggerhub.com/apis/liferayinc/headless-delivery/v1.0#/StructuredContent/postSiteStructuredContent" target="_blank"&gt;supported by the API&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;I've tried some variants like:&lt;/p&gt;
&lt;pre&gt;&lt;code class="language-javascript"&gt;{
    "title": "Joanne d'Arc",
    "contentStructureId": 38610,
    "contentFields": [
        {
            "name": "Name",
            "value": {
                "data": "Joanne"
            },
            "name": "Name_pt_PT",
            "value": {
                "data": "Joana"
            }
        },
        {
            "name": "Surname",
            "value": {
                "data": "d'Arc"
            },
            "name": "Surname_pt_PT",
            "value": {
                "data": "de Arc"
            }
        }
    ]
}&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;but the result is "&lt;strong&gt;Unable&amp;nbsp;to&amp;nbsp;get&amp;nbsp;content&amp;nbsp;field&amp;nbsp;value&amp;nbsp;for&amp;nbsp;\"Name_pt_PT\"&amp;nbsp;for&amp;nbsp;content&amp;nbsp;structure&amp;nbsp;38610&lt;/strong&gt;".&lt;/p&gt;
&lt;p&gt;Anybody out there has a cheat sheet for this? I couldn't find many examples...&lt;/p&gt;
&lt;p&gt;TIA&lt;/p&gt;
&lt;p&gt;Fernando&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</summary>
    <dc:creator>Fernando Fernandez</dc:creator>
    <dc:date>2020-11-09T21:50:20Z</dc:date>
  </entry>
</feed>
