Field editable is required when getting items on the REST api

Tags: #<Tag:0x00007f51db86a180> #<Tag:0x00007f51db869eb0>

(Andreas Viborg) #1

Just updated from 2.2.0 to 2.4.0 and a REST call I make from started spamming lots of warning messages:

2019-01-21 21:56:06.328 [WARN ] [] - Field 'editable' could not be eliminated: Can not set boolean field to null value

The call causing this is:

curl -X GET --header "Accept: application/json" "http://hab:8080/rest/items?tags=RoomThermostats&recursive=false&fields=name%2C%20state"

Simply adding field editable (even though I don’t need it) fixes it, but this seems to be a bug in the REST api?

Note the end of the string:

curl -X GET --header "Accept: application/json" "http://hab:8080/rest/items?tags=RoomThermostats&recursive=false&fields=name%2C%20state%2C%20editable"

(Scott Rushworth) #2

What are you attempting to do through the REST API, as it looks the call you’re making is outdated? You can install the REST API Docs, try what you are going for, and it will provide the call used.

(Sebastian) #3

I stumbled on this, too while creating HABApp:

Field 'editable' could not be eliminated: Can not set boolean field to null value

Can easily be reproduced through the rest-api interface.
Just make a GET request for items with the fields “state,type,name” or use this link

(namraccr) #4

Here’s the culprit

Not sure what the fix would have to be… Perhaps @sjka could intervene, as he wrote the DTOMapperImpl.

(Scott Rushworth) #5

Ah… I didn’t recognize the filtering… makes sense now!

(Andreas Viborg) #6

Good to confirm that someone else also have experienced this issue.
As mentioned the workaround is to request the editable field, it will cause some overhead, but it should be acceptable. I guess it is a simple fix?