Problem med REST

Functionality and usage of the OpenNethome Server
Post Reply
TotalPE
Posts: 19
Joined: Mon Dec 15, 2014 9:08 am

Problem med REST

Post by TotalPE »

Har haft funtion i REST funtionen i min installation, men nu fungerar inte POST, GET fungerar dock. Tror att det slutade fungera i senaste uppdateringen (nightly)

/c
TotalPE
Posts: 19
Joined: Mon Dec 15, 2014 9:08 am

Re: Problem med REST

Post by TotalPE »

Kan tillägga att jag kör RaspberryPI versionen
TotalPE
Posts: 19
Joined: Mon Dec 15, 2014 9:08 am

Re: Problem med REST

Post by TotalPE »

Den säger så här i loggarna när jag skickar /rest/items/72/actions/off/invoke mot min Pi via en webbrowser.

14.12.17 19:26:47 ExceptionHandler failed to execute
14.12.17 19:26:47 SynchronousDispatcher PathInfo: /rest/items/72/actions/off/invoke
stefangsbb
Site Admin
Posts: 313
Joined: Sun Nov 30, 2014 2:16 pm

Re: Problem med REST

Post by stefangsbb »

I am not sure how you are invoking the REST call, but the reason may be that you are trying to call the service by putting the URL of the call in the address field of the browser and fetching it that way? This will result in the browser issuing a GET-request and there is no GET request defined for that path, which will result in a return code 405 (Method not allowed) and the log you described. To invoke the method you have to issue the POST method with the URL as specified in the documentation.

I downloaded the 2014-09-09-wheezy-raspbian, and installed the latest nightly build on that and issued a POST with the Postman-plugin from Chrome on http://192.168.1.110:8020/rest/items/56 ... gle/invoke. This worked fine and toggled the lamp. I then changed the invoke method to GET with the same URL and got the error logs you describe. I can really recommend the Postman Chrome plugin for experimenting with REST services.

Hope this helps
Post Reply