This website uses cookies to ensure you get the best experience on our website.

Skip to content
LOGO
  • Company

    About IGNEK

    Learn about our story and our mission.

    Careers

    We're hiring!

    We always looking for talented peoples. Join our team!

    Blogs

    The latest industry news, updates and info.

    Case Studies

    Take a closer look at the projects we've delivered

    Webinar

    Watch our latest organized webinar

    Get in touch with our HR team

    • hr@ignek.com
    • +91 93284 95160
    • Ahmedabad, Gujarat, India – 382470
  • Services

    Enterprise Portal Development

    Custom Enterprise Portal Development for flawless Solutions

    Dedicated Development Team

    Expand Teams, Optimize Development with Our Expertise

    Back-end Development

    Empowering your digital presence with robust backend development expertise

    Front-end Development

    Crafting engaging user experiences through expert frontend development

    Digital Transformation

    Embrace digital transformation by modernizing process

    SaaS Development

    Transform your business with SaaS Innovative Solutions

    Technologies

    Liferay Services

    Development & Customization

    Theme

    Upgradation

    Migration

    Proof of Concept

    Performance Tunning

    Architecture

    Support & Maintenance

    E-commerce

    Expert Advice

    React Services

    Enterprise Development

    Custom Application

    Single Page Application

    Architecture

    API Integration

    Migration

    Consulting

    Maintenance & Support

    Spring Boot Services

    Web Service

    MVC Web Development

    API Integration

    Security

    Migration

    Microservices

    Support & Maintenance

    AEM Services

    Consulting Service

    Site Development

    Migration & Upgradation

    Integration

    Maintenance & Support

    Custom Solutions

    Content Management

    Team Augementation

  • Solution

    Ready for digital excellence

    In our rapidly evolving world, businesses are always on the lookout for fresh ways to improve their operations and connect with their audiences.

    Contact US

    Solutions

    SaaS : Software As A Service

    Transforming industries through cutting edge SaaS solutions.

    Customer Portal : Boost Business Productivity

    Streamline operations and enhance productivity with our Customer Portal solution.

    Liferay Based Intranet Portal

    Internal portal for company communication, collaboration and resources

    Integration

    Matomo Integration with Liferay

    Integrate Matomo to enable user interactions seamlessly.

    Microsoft Teams integration with Liferay

    Integrate to enable seamless collaboration, messaging within your portal.

    Jira Integration With Liferay

    Optimizes business operations by integrating with Jira.

  • Hire Us

    Liferay

    Get expert Liferay developers for seamless portal solutions.

    React JS

    Get expert ReactJS developers for dynamic web solutions.

    Web Developer

    Get custom web solutions from IGNEK's expert developers.

    Spring Boot

    Get top-notch Spring Boot developers for your project success!

    Healthcare

    Get top Healthcare Developers for cutting-edge medical software.

    MERN Stack

    Get expert MERN developers from IGNEK for custom, innovative project solutions.

    Why Hire Developers From IGNEK ?

    • Certified Developer
    • Transparent Communication
    • Flexible Hiring Modals
    • Fully Signed NDA
    • Cost Effective
    • Easy Exit Policy

    Get in touch with our Sales team

    • sales@ignek.com
    • +91 6351576580
    • info@ignek.com
    • Ahmedabad, Gujarat, India – 382470
SCHEDULE CALL
  • COMPANY
    • About
    • Case Studies
    • Blogs
    • Career
    • Webinar
  • SERVICES
    • Enterprise Portal Development
    • Dedicated Development Team
    • Back-end Development
    • Front-end Development
    • Digital Transformation
    • SaaS Development
  • SOLUTION
    • Customer Portal:  Boost Business Productivity
    • SaaS : Software as a Service
    • Liferay Based Employee Intranet Portal
  • TECHNOLOGY
    • Liferay Services
      • Liferay Development and Customization
      • Liferay Theme Development Service
      • Liferay DXP 7.4 Upgrade
      • Liferay Migration
      • Liferay Proof Of Concept
      • Liferay Performance Tuning
      • Liferay Architecture Design Service
      • Liferay Support And Maintenance Service
      • Liferay Ecommerce Development
      • Liferay Expert Advice
    • ReactJS Services
      • ReactJS Enterprise Application Development
      • ReactJS Custom Application Development
      • ReactJS Single Page Application Development (SPA)
      • ReactJS Applications Architecture
      • ReactJS API Integration
      • ReactJS Migration
      • ReactJS Consulting
      • ReactJS Maintenance and Support
    • Spring Boot Services
      • Spring Boot Web Development Service
      • Spring MVC Web Development
      • Spring Boot API Integration Service
      • Spring Boot Security
      • Spring Boot Migration Service
      • Spring Boot Microservices
      • Spring Boot Support & Maintenance Service
    • AEM Development Services
      • AEM Consulting Services
      • AEM Site Development
      • AEM Migration & Upgradation
      • AEM Integration Services
      • AEM Maintenance & Support
      • AEM Content Management
      • Custom AEM Solutions
      • AEM Team Augmentation
  • INTEGRATION
  • HIRE US
    • Hire Liferay Developer
    • Hire ReactJS Developer
    • Hire Spring Boot Developer
    • Hire Healthcare Developer
    • Hire Web Developer
    • Hire MERN Stack Developer
  • CONTACT US
  • Company

    About IGNEK

    Careers

    We're hiring!

    Blogs

    Case Studies

    Webinar

    Get in touch with our HR team

    • hr@ignek.com
    • +91 93284 95160
    • Ahmedabad, Gujarat, India – 382470
  • Services

    Enterprise Portal Development

    Dedicated Development Team

    Back-end Development

    Front-end Development

    Digital Transformation

    SaaS Development

    Technologies

    Liferay Liferay Services
    • Development & Customization
    • Theme
    • Upgradation
    • Migration
    • Proof of Concept
    • Performance Tuning
    • Architecture
    • Support & Maintenance
    • E-commerce
    • Expert Advice
    React React Services
    • Enterprise Development
    • Custom Application
    • Single Page Application
    • Architecture
    • API Integration
    • Migration
    • Consulting
    • Maintenance & Support
    Spring Boot Spring Boot Services
    • Web Service
    • MVC Web Development
    • API Integration
    • Security
    • Migration
    • Microservices
    • Support & Maintenance
    AEM AEM Services
    • Consulting Service
    • Site Development
    • Migration & Upgradation
    • Integration
    • Maintenance & Support
    • Custom Solutions
    • Content Management
    • Team Augmentation
  • Solution

    Ready for digital excellence

    In our rapidly evolving world, businesses are always on the lookout for fresh ways to improve their operations and connect with their audiences.

    Contact US

    Solutions

    SaaS : Software As A Service

    Customer Portal : Boost Business Productivity

    Liferay Based Intranet Portal

    Integration

    Matomo Integration with Liferay

    Microsoft Teams integration with Liferay

    Jira Integration With Liferay

  • Hire Us

    Liferay

    React JS

    Web Developer

    Spring Boot

    Healthcare

    MERN Stack

    Why Hire Developers From IGNEK ?

    • Certified Developer
    • Transparent Communication
    • Flexible Hiring Modals
    • Fully Signed NDA
    • Cost Effective
    • Easy Exit Policy

    Get in touch with our Sales team

    • sales@ignek.com
    • +91 6351576580
    • IGNEK
    • Ahmedabad, Gujarat, India – 382470
  • SCHEDULE CALL

Create Localization Web Content Using Liferay’s Headless API

  • Liferay
  • August 25, 2022

Share On :

Problem

Creating web content with the help of the rest api.

Solution 

We can use the Liferay Rest API, which creates the web content programmatically. 

Benefits  
  • Liferay provides the REST API for the creation of web content with localization.
  • With this API, we are able to create our own custom implementation to create the web content as per our needs.
Prerequisites 
  • Java 
  • Liferay  portal 7.2 +
  • Basic knowledge of Liferay
Environment Requirements 
  • Liferay Portal
  • Postman
Follow the following steps to post a web content on the Liferay Site.
  • We have two ways to post a web content in liferay which are as follows.
    1. From the postman.
    2. From the Liferay Rest API editor
  1. From the postman
    1. Add a new request and make the request type “post“.
    2. Enter the following URL in the “Enter Requested URL”.

http://localhost:8080/o/headless-delivery/v1.0/sites/${siteId}/structured-contents

  • You have to enter the site Id in the url in which site you have to create the webcontent.
    1.  Now we have to assign the authorization. 
      • Select the type as Basic Auth.
      • Enter the username and password of the admin user.
Assign authorization with Basic Auth type
    1. Select Body from the Navigation on the postman.
    2. Select “raw” from the first drop down and select “JSON” from the second drop down menu.
Choosing Body as Raw JSON
    1. Enter the Json Object in following format.
				
					
{
  "actions": {},
  "availableLanguages": [
    "en-US",
    "ar-SA"
  ],
  "contentFields": [
    {
      "contentFieldValue": {
        "document": {
          "id": 113029
        }
      },
      "contentFieldValue_i18n": {
        "ar-SA": {
          "document": {
            "id": 113019
          }
        },
        "en-US": {
          "document": {
            "id": 113029
          }
        }
      },
      "dataType": "document",
      "label": "File Upload",
      "label_i18n": {
        "en-US": "File Upload"
      },
      "name": "file_upload"
    }
  ],
  "contentStructureId": 50803,
  "datePublished": "2021-08-30T02:14:00Z",
  "siteId": 39628,
  "title": "Webcontent created for the testing",
  "title_i18n": {
    "ar-SA": "تم إنشاء نص ملف جديد آخر",
    "en-US": "Webcontent created for the testing"
  }
}

				
			

 › Brief description of the JSON keys are following.

    1. availableLanguages: –
      • Enter the languages that the web contents will support the localization.
    2. ContentFields :-
      • Content Fields will be responsible for giving the data to the structured input that we have used for web content creation.
      • In our case, we have a repeatable field in the structure of Web content
    3. ContentFieldValue : –
      • Content Field Value will fill in the data in the structure of Web content.
      • In our case, we have the repeatable file upload field. That’s why we are providing the document details under the content field value.
      • In the “contentFieldValue”  key only, it will contain the data of the default-language set on the liferay.
      • If we want to localize it. This means if we want to add a document to the language ID, Then we have to use “contentFieldValue_i18n”.
    1. contentFieldValue_i18n : –
      •  This Content Field Value will be responsible for the localization of the Webcontent.
      • Webcontent Data Will Be Different According to Their Locale (Example :- “en-Us” and “ar-SA”).
      • As per the localization, we have to provide the document ID for the different language support.
      1. ar-SA :-
        • We have to localize the document details under this language to attach the document to the Arabic version of web content.
      2. en-US :-
        • We have to provide the document details in this language to attach the document to the English version of the web content.
    2. document : –
      • Document will be responsible for attaching the document file to the webcontent.
    3. Id : –
      • In this ID key, we have to provide the document ID of the document that we have to attach.
    4. dataType : –
      • This will be the data type of the structured content field.
    5. label : –
      • Enter the languages that the web contents will support the localization.
    6. label_i18n : –
      • label_i18n will be responsible for the localization as per the “contentFieldValue_i18n”.
    7.  name : –
      • Enter the languages that the web contents will support the localization.
    1.  contentStructureId :-
      • This will be the structure ID of the web content that will be created.
    2.  datePublished :-
      • This will set the “Display Date” over the Web content fields.
    3.  siteId :-
      • Site ID: Which site do we have to create the Webcontent.
    4.  title :-
      • Title of the Webcontent We have to enter the title of the default language IDtitles of the Liferay .
    5.  title_i18n :-
      • This title_i18n will be responsible for the localization.
      • We have to enter the titles of different languages that we have allowed in the “availableLanguages”.
      • Like the following.
        1. ar-SA :-
          • We want titles in Arabic, so we will put the Arabic conversion or the Arabic version title of webcontent.
    1. After adding the json object to the post Body.
    2. Post the request and if you get 200 response codes, then Web Content has been added to the Liferay site.
Add web content using Postman
    1. Make sure you get the success code 200 and you will get the response.
    2. If you get a success code 200, but if you do not get the response, then there is some issue with the authentication.

Note:- Make sure you enter the URL and do not have a blank space after the URL completion.

  1. From the Liferay Rest API Editor :
    1. Login as an admin on the Liferay Portal.
    2. Access the following URL to access the Liferay Swagger editor.

http://localhost:8080/o/api

    1. Access the accordion called “StructuredContent”.
Access Structured Content accordion with ease
    1. Enter the site ID that you want to create the webcontent.
Hitting Structured Content with primary key
    1. Enter the Json Object in  the Request body.
				
					
{
  "actions": {},
  "availableLanguages": [
    "en-US",
    "ar-SA"
  ],
  "contentFields": [
    {
      "contentFieldValue": {
        "document": {
          "id": 113029
        }
      },
      "contentFieldValue_i18n": {
        "ar-SA": {
          "document": {
            "id": 113019
          }
        },
        "en-US": {
          "document": {
            "id": 113029
          }
        }
      },
      "dataType": "document",
      "label": "File Upload",
      "label_i18n": {
        "en-US": "File Upload"
      },
      "name": "file_upload"
    }
  ],
  "contentStructureId": 50803,
  "datePublished": "2021-08-30T02:14:00Z",
  "siteId": 39628,
  "title": "Webcontent created for the testing",
  "title_i18n": {
    "ar-SA": "تم إنشاء نص ملف جديد آخر",
    "en-US": "Webcontent created for the testing"
  }
}

				
			
    1. Please consider the postman method “Json Object” key’s explanation.
    2. Execute the Rest API.
    3. Make sure you get the success code 200 and you will get the response as well.
Create localized web content with Liferay
    1. Your web content has been created successfully.

Explore Our Services

Discover how we can help your business thrive, whether you’re running a small startup, an SME, or a large enterprise. We’re here to understand your unique needs and goals, offering the expertise and resources to support your journey to success.

Stay informed about our Liferay services and updates by subscribing to our newsletter—just fill in the details below to subscribe.

Loading
Loading...

Related Blogs

January 3, 2020
How to write ADT with structure and template in Liferay Cover Image
How to write ADT with structure and template in Liferay
October 31, 2022
Get, update, and delete the web content using the Postman and Liferay’s Headless API Cover Image
Manage Web Content with Postman and Liferay's Headless API
November 8, 2022
Attach categories and fill data in custom fields of webcontent with the Liferay Headless API Cover Image
Attach categories and fill data in custom fields of webcontent with the Liferay Headless API
Loading...

Digital Solutions for Your Business with IGNEK

4.9

5.0

5.0

5.0

LOGO

Making the world a better place through constructing elegant hierarchies

COMPANY

  • About
  • Career
  • Case Study
  • Blogs

SERVICES

  • Enterprise Portal Development
  • Dedicated Development Team
  • Back-end Development
  • Front-end Development
  • Digital Transformation
  • SaaS Development

HIRE US

  • Liferay
  • Spring Boot
  • ReactJS
  • Healthcare
  • MERN Stack
  • AEM

CONTACT

  • info@ignek.com
  • info@ignek.com
SALES
  • sales@ignek.com
  • (+91) 635 157 6580
CAREER
  • hr@ignek.com
  • (+91) 932 849 5160
  • E 910-912, Ganesh Glory 11, Jagatpur Road, SG Highway, Ahmedabad, Gujarat - 382470

© 2018-2025 IGNEK, Inc. All rights reserved

Linkedin Facebook X-twitter Instagram