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

Attach categories and fill data in custom fields of webcontent with the Liferay Headless API

  • Liferay
  • November 8, 2022

Share On :

Problem 

Attach categories and custom values to the webcontent with the help of the rest api.

Solution 

We can use Lifeay’s headless API, which creates the webconetnt programmatically. And attach the categories and fill in the values of custom fields.

Benefits  
  • We can use this api to add and update the webcontent to attach the categories and access custom fields from the Rest API.
Prerequisites 
  • Java 
  • Liferay  portal 7.2 +
  • Basic knowledge of Liferay
Environment Requirements 
  • JDK 11
  • Liferay Portal
  • Postman
Follow the following steps to post a webcontent on the Liferay Site

We have two ways to post a webcontent in liferay which are as follows.

  1. From a 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 Basic Auth authorization credentials
  1. Select Body from the Navigation on the postman.
  2. Select “raw” from the first username and select “JSON” from the second drop-down menu.
Navigate Postman Body and choose raw JSON
  1. Enter the following Json Object.
				
					{
 "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,
 "customFields": [
   {
     "customValue": {
       "data": 2021
     },
     "dataType": "Integer",
     "name": "ReferencePeriodYear"
   },
   {
     "customValue": {
       "data": "Quarterly"
     },
     "dataType": "Text",
     "name": "Periodicity"
   },
   {
     "customValue": {
       "data": "2022-01-17T15:27:58Z"
     },
     "dataType": "",
     "name": "IssueDate"
   },
   {
     "customValue": {
       "data": "Producer Price Index, Third quarter 2021"
     },
     "dataType": "Text",
     "name": "PublicationName"
   },
   {
     "customValue": {
       "data": 11581
     },
     "dataType": "Integer",
     "name": "ReleaseID"
   },
   {
     "customValue": {
       "data": "Both"
     },
     "dataType": "Text",
     "name": "Language"
   },
   {
     "customValue": {
       "data": "ربع سنوي"
     },
     "dataType": "Text",
     "name": "PeriodicityAr"
   },
   {
     "customValue": {
       "data": "الرقم القياسي لأسعار المنتجين الصناعيين الربع الثالث 2021"
     },
     "dataType": "Text",
     "name": "PublicationNameAr"
   },
   {
     "customValue": {
       "data": "الربع الثالث"
     },
     "dataType": "Text",
     "name": "IntervalAr"
   },
   {
     "customValue": {
       "data": "2022-01-17T00:00:00Z"
     },
     "dataType": "",
     "name": "UIIssueDate"
   }
 ],
 "datePublished": "2021-08-30T02:14:00Z",
 "siteId": 39628,
 "taxonomyCategoryIds": [3066,3073,3067,3082],
 "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”. 
    4. 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 provide the document details in this language to attach the document to the Arabic version of the web content. 
        1. en-US : 
        • We have to provide the document details in this language to attach the document to the English version of the web content. 
    5. document :  
      • Document will be responsible for attaching the document file to the webcontent. 
    6. Id :  
      • In this ID key, we have to provide the document ID of the document that we have to attach. 
    7. dataType : 
      • This will be the data type of the structured content field. 
    8. label : 
      • Enter the languages that the web contents will support the localization.
    9. label_i18n :  
      • label_i18n will be responsible for the localization as per “contentFieldValue_i18n”. 
    10.  name :  
      • Enter the languages that the web contents will support the localization.
    11.  contentStructureId :
      • This will be the structure ID of the web content that will be created. 
    12. customFields :
      • This field is responsible for the custom fields that are created for the web content article.
    13. customValue :
      • This json will be responsible for the value assignment of the custom fields.
    14. Data :
      • This data will be the value of a particular custom field defined in the json of customFields “name” attribute.
    15. Name : 
      • This name will represent the name of the custom fields that are created for the web content. 
    16. dataType :
      • This dataType represents the data type of the custom field of the webcontent.
    17. datePublished :
      • This will set the “Display Date” over the Web content fields.  
    18.  siteId :
      • Site ID: Specify the site id in which we are going to create web content.
    19.  taxonomyCategoryIds :
      • We have to assign the category ID array to attach the different categories to the Web content. 
      • For example:
				
					"taxonomyCategoryIds": [3066,3077,3082],

				
			
    1.  title :
      • Title of the Webcontent We have to enter the title of the default language IDtitles of the Liferay . 
    2.  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 : 
  1. After adding the json object to the post Body.
  2. Post the request and if you get 200 response codes, then webcontent has been added to the Liferay site.
API request and response in JSON format
  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.

2) 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”.
StructuredContent accordion
  1. Enter the site ID that you want to create the webcontent.
Opned StructuredContent accordion
  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,
 "customFields": [
   {
     "customValue": {
       "data": 2021
     },
     "dataType": "Integer",
     "name": "ReferencePeriodYear"
   },
   {
     "customValue": {
       "data": "Quarterly"
     },
     "dataType": "Text",
     "name": "Periodicity"
   },
   {
     "customValue": {
       "data": "2022-01-17T15:27:58Z"
     },
     "dataType": "",
     "name": "IssueDate"
   },
   {
     "customValue": {
       "data": "Producer Price Index Third quarter 2021"
     },
     "dataType": "Text",
     "name": "PublicationName"
   },
   {
     "customValue": {
       "data": 11581
     },
     "dataType": "Integer",
     "name": "ReleaseID"
   },
   {
     "customValue": {
       "data": "Both"
     },
     "dataType": "Text",
     "name": "Language"
   },
   {
     "customValue": {
       "data": "ربع سنوي"
     },
     "dataType": "Text",
     "name": "PeriodicityAr"
   },
   {
     "customValue": {
       "data": "الرقم القياسي لأسعار المنتجين الصناعيين الربع الثالث 2021"
     },
     "dataType": "Text",
     "name": "PublicationNameAr"
   },
   {
     "customValue": {
       "data": "الربع الثالث"
     },
     "dataType": "Text",
     "name": "IntervalAr"
   },
   {
     "customValue": {
       "data": "2022-01-17T00:00:00Z"
     },
     "dataType": "",
     "name": "UIIssueDate"
   }
 ],
 "datePublished": "2021-08-30T02:14:00Z",
 "siteId": 39628,
 "taxonomyCategoryIds": [3066,3073,3067,3082],
 "title": "Webcontent created for the testing",
 "title_i18n": {
   "ar-SA": "تم إنشاء نص ملف جديد آخر",
   "en-US": "Webcontent created for the testing"
 }
}


				
			
  1. For the explanation of JSON objects, their keys are written in the Postman way. Please go through with that.
  2. Execute the Rest API.
  3. Make sure you get the success code 200 and you will get the response.
API request and response in Liferay's openAPI
  1. Your webcontent 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
August 25, 2022
Create a web content with localization using Liferay’s Headless API cover Image
Create Localization Web Content Using Liferay's 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