I am not sure what I am missing here, but I have followed some examples on how to get a JSON object from a request. Unfortunately, I have not been able to get it to work.
here is the error I get: java.lang.IllegalStateException: getReader() has already been called for this request
I am testing this in the simulator, which I am not sure if that could be the issue or not, but either way it is frustrating. I feel like I am missing something obvious, but at this point I am beating my head against a wall and thought I’d see if someone else can see something I’m not seeing.
So there shouldn’t to my knowledge be anything executing on the PUT request path before my method. The log.info goes through (showing for example physicalgraph.api.FilteredHttpServletRequestWrapper@1a4a771d), but any attempt to access request.JSON results in something like java.lang.IllegalStateException: getReader() has already been called for this request @ line 192
I assume some type of invisible Groovy magic is calling getReader earlier. But for the life of me I can’t see what it is. Very frustrating. Even more frustrating that of course this must work fine for other people.
I’m having the exact same problem. I found a way around it, but the problem is still annoying. I fixed it (on accident) by specifying the access_token in the URL instead of as a header.
curl -X PUT -H "Authorization: Bearer <access_token>" -d {"POST_OR_PUT":"data"} https://graph.api.smartthings.com/api/smartapps/installations/appidThing/Phone/endpoint