Rest-API support for Java 8 Time module (java.time)


We have created services to be open for the rest API. Many of these services have methods that take in java.time objects, primarly LocalDate, I have tried to implement this in the following way:


public interface MyService {
    String NAME = "app_MyService";
    void method(LocalDate date);


public class MyServiceBean implements MyService {

    public void method(LocalDate date) {


<service name="app_MyService">
    <method name="method">
        <param name="date" />

When I try to call this service with payload:

     "date": "2020-10-01"

It doesn’t work. I get a 400 back with message Invalid parameter value for date.

The logs show a java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 1 column 1 path $

I have also tried to specify the param name in rest-services.xml with:

<param name="date"  type="java.time.LocalDate" />

But still no success.

If I simply change java.time.LocalDate to java.util.Date everything works as expected. Is Java 8 Time Module supported in the rest-api addon?

Hello @bartekspitza!

Java 8 Date/Time API isn’t currently supported in the rest-api addon requests.
I’ve created an issue for this improvement.


1 Like