Z-Way 2.2.4 not supporting HTTP POST requests -> Resolved

Discussions about Z-Way software and Z-Wave technology in general
Post Reply
droll
Posts: 48
Joined: 20 Dec 2013 01:37

Z-Way 2.2.4 not supporting HTTP POST requests -> Resolved

Post by droll »

From an third party application I am using the Z-Way JS API to access my Razberry device ($Url/JS/Run/...). More precisely, until revision 2.2.0 of the Z-Way server I was using HTTP POST requests, which worked fine. After upgrading to the Z-Way server version 2.2.4 the HTTP POST requests were not accepted anymore, I had to switch to HTTP GET requests. Only for the login I could continue using the POST request ($Url/ZAutomation/api/v1/login), but not for all the JS API commands to access the devices ($Url/JS/Run/...).

The Z-Way development document tells: "JSON API allows to execute commands on server side using HTTP POST requests (currently GET requests are also allowed, but this might be deprecated in future)."

Well, to me it seems that the opposite of this statement has been implemented: GET requests are still supported, but not anymore POST requests.

I would like to understand if it is intentional that the JS API is not supporting anymore the HTTP POST requests, or if this is a bug that will be corrected again.
Last edited by droll on 05 Jun 2017 21:41, edited 2 times in total.
droll
Posts: 48
Joined: 20 Dec 2013 01:37

Re: Z-Way 2.2.4 not supporting HTTP POST requests

Post by droll »

I would appreciate to have some feedback on this bug from the z-wave.me team.

I have just double checked the issue on the newest z-way release (2.3.4). The issue is not resolved: The JSON API does not work with HTTP POST requests. All requests timed out. Using HTTP GET requests the JSON API works well.

As previously stated this is in contradiction to the documentation (zwayDev.pdf). The latest document that is currently available clearly says: "JSON API allows to execute commands on server side using HTTP POST requests (currently GET requests are also allowed, but this might be deprecated in future)."

So either the documentation should be corrected, or the z-Way JSON API. To remember, on the z-Way server version 2.2.0 both GET and POST requests were correctly working.
droll
Posts: 48
Joined: 20 Dec 2013 01:37

Re: Z-Way 2.2.4 not supporting HTTP POST requests

Post by droll »

No reply? Is it the wrong forum for this post?
User avatar
PoltoS
Posts: 7565
Joined: 26 Jan 2011 19:36

Re: Z-Way 2.2.4 not supporting HTTP POST requests

Post by PoltoS »

Can you give more info? POST request works for me for /JS/Run. See the image attached.
post.png
post.png (131.07 KiB) Viewed 9225 times
droll
Posts: 48
Joined: 20 Dec 2013 01:37

Re: Z-Way 2.2.4 not supporting HTTP POST requests

Post by droll »

I have rechecked the behavior of zWay 2.3.4 and 2.2.0. Here is what I see using my HTTP logger:

Using a GET request I see the following LOG with zWay version v2.3.4:

Code: Select all

Request:
  GET /JS/Run/zway.controller.data.softwareRevisionVersion.value HTTP/1.1
  Accept: */*
  Host: 192.168.1.21:8083
  User-Agent: Tcl http client package 2.7.10
  Connection: close
  Cookie: ZWAYSession=695b0f68-7ecc-27ca-4114-e2d144899974
  Accept-Encoding: gzip, identity, *;q=0.1
Response:
  HTTP/1.1 200 OK
  Server: Mongoose/6.4
  Content-Type: application/json
  Connection: keep-alive
  Content-Length: 8
  
  "v2.3.4"
Using a POST request I see the following LOG with zWay version v2.3.4::

Code: Select all

Request:
  POST /JS/Run/zway.controller.data.softwareRevisionVersion.value HTTP/1.1
  Accept: */*
  Host: 192.168.1.21:8083
  User-Agent: Tcl http client package 2.7.10
  Connection: close
  Cookie: ZWAYSession=695b0f68-7ecc-27ca-4114-e2d144899974
  Accept-Encoding: gzip, identity, *;q=0.1
There is no response received back!
However using zWay version v2.2.0 I get the following response:

Code: Select all

Request:
  POST /JS/Run/zway.controller.data.softwareRevisionVersion.value HTTP/1.1
  Accept: */*
  Host: 192.168.1.21:8083
  User-Agent: Tcl http client package 2.7.10
  Connection: close
  Cookie: ZWAYSession=c774f1a2-93a8-ecdc-4783-f5eb25cdbd10
  Accept-Encoding: gzip, identity, *;q=0.1
Response:
  HTTP/1.1 200 OK
  Content-Type: application/json
  Connection: keep-alive
  Access-Control-Allow-Origin: *
  Access-Control-Allow-Credentials: true
  Content-Length: 8
  Transfer-Encoding: chunked
  
  8
  "v2.2.0"
PoltoS, what tool are you using to run the HTTP requests?
User avatar
PoltoS
Posts: 7565
Joined: 26 Jan 2011 19:36

Re: Z-Way 2.2.4 not supporting HTTP POST requests

Post by PoltoS »

POSTman - a plugin in Chrome
droll
Posts: 48
Joined: 20 Dec 2013 01:37

Re: Z-Way 2.2.4 not supporting HTTP POST requests

Post by droll »

The source of the problem is not the side of the z-Way web server, but on the side of my HTTP client.
For HTTP POST requests the header 'Content-Length' should be provided if no chunked encoding is used, even if the body (query string) is empty (length=0). However my HTTP client is omitting this header if the body is empty. By adding the Content-Length header the POST request works indeed as expected:

Code: Select all

Request:
  POST /JS/Run/zway.controller.data.softwareRevisionVersion.value HTTP/1.0
  Accept: */*
  Host: 192.168.1.21:8083
  User-Agent: Tcl http client package 2.7.10
  Cookie: ZWAYSession=398a016e-a480-4dc3-703e-b8a79a925363
  Content-Length: 0
Response:
  HTTP/1.1 200 OK
  Server: Mongoose/6.4
  Content-Type: application/json
  Connection: keep-alive
  Content-Length: 8
  
  "v2.3.4"
It would be beneficial if the web server reject the request with a meaningful message (e.g. HTTP code 411 - length required).
I consider this issue as resolved.
User avatar
PoltoS
Posts: 7565
Joined: 26 Jan 2011 19:36

Re: Z-Way 2.2.4 not supporting HTTP POST requests -> Resolved

Post by PoltoS »

thanks for the info
Post Reply