Legacy Knowledge Base
Published Sep. 10, 2025

Updating Web Content's Custom Integer Field Using Headless API

Written By

Apsara Raheja

How To articles are not official guidelines or officially supported documentation. They are community-contributed content and may not always reflect the latest updates to Liferay DXP. We welcome your feedback to improve How To articles!

While we make every effort to ensure this Knowledge Base is accurate, it may not always reflect the most recent updates or official guidelines.We appreciate your understanding and encourage you to reach out with any feedback or concerns.

Legacy Article

You are viewing an article from our legacy "FastTrack" publication program, made available for informational purposes. Articles in this program were published without a requirement for independent editing or verification and are provided"as is" without guarantee.

Before using any information from this article, independently verify its suitability for your situation and project.

Issue

  • When trying to update the web content's custom field value of type Integer with API, an errorClassCastException occurs.

Steps to reproduce:

  1. Create a custom field of integer in the web content article.
  2. Create a structure having 2 fields.
  3. Create web content using that structure.
  4. Call the following API to update the web content's custom field:
curl -X 'PUT' \
'http://localhost:8080/o/headless-delivery/v1.0/sites/<siteId>/structured-contents/by-external-reference-code/<externalReferenceCode>' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-H 'x-csrf-token: <token>' \
-d '{ "contentStructureId": <contentStructureId>, "customFields": [{ "customValue": { "data": 2 }, "dataType": "Integer", "name": "<customFieldName>" }], "title": "Title changes" }'

Pass the below in the request body:

 { "contentStructureId": 31543, "customFields": [   {    "customValue": {     "data": 2    },    "dataType": "Integer",    "name": "Prio"   }  ],  "title": "Clarity x Warby Parker1" }

The following error appears in the console log:

ERROR [http-nio-8080-exec-6][ExceptionMapper:59] null
java.lang.ClassCastException: class java.lang.Integer cannot be cast to class java.lang.Long

Environment

  • DXP Quarterly Release

Resolution

  • The observed behavior is a known concern that has been addressed by LPD-54757.
  • If a hotfix is required for this issue, please create a support ticket requesting a hotfix by attaching the patch details.
  • Installing Fix Packs and Hotfixes on Liferay DXP will guide you to install this hotfix in the respective environment.

 

Did this article resolve your issue ?

Legacy Knowledge Base