I cannot use the PUT method of the Object API's Batch endpoint with External Reference Codes (ERC)
written-by
Orsolya Hegedus
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
learn-legacy-article-disclaimer-text
Issue
- It is not possible to mass update a custom object's entries if:
- using the PUT method of the object's batch API endpoint
- and the External Reference Code (ERC) is given instead of the object entry's ID.
- The operation fails with
NullPointerException: Cannot invoke "java.lang.Long.LongValue()" because "objectEntryId" is null
Resolution
- This is the expected behavior. This endpoint identifies which object entries to update via their IDs.
- A possible workaround:
- Use this endpoint with the POST method
- Add the
createStrategy=UPSERT parameter to your request URL
- So, a request URL for this operation will look something like this:
http://your_domain/o/c/your_objects/batch?createStrategy=UPSERT
did-this-article-resolve-your-issue