Curl post on debian fail with error code 400

If I enter this from the CLI on my RPI (debian stretch)

   curl -v -d '{"d":"20190521","t":"11:01","v1":2065,"v5":13.3,"v6":241.2}' \
   -H "Content-Type: application/json"  \
   -H "X-Pvoutput-Apikey: validcode" \
   -H "X-Pvoutput-SystemId: validid" \
   -X POST \
   https://pvoutput.org/service/r2/addstatus.jsp

The return I got is:

*   Trying 45.56.66.169...
* TCP_NODELAY set
* Connected to pvoutput.org (45.56.66.169) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* Cipher selection: ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:@STRENGTH
* successfully set certificate verify locations:
*   CAfile: /etc/ssl/certs/ca-certificates.crt
  CApath: /etc/ssl/certs
* TLSv1.2 (OUT), TLS header, Certificate Status (22):
* TLSv1.2 (OUT), TLS handshake, Client hello (1):
* TLSv1.2 (IN), TLS handshake, Server hello (2):
* TLSv1.2 (IN), TLS handshake, Certificate (11):
* TLSv1.2 (IN), TLS handshake, Server key exchange (12):
* TLSv1.2 (IN), TLS handshake, Server finished (14):
* TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
* TLSv1.2 (OUT), TLS change cipher, Client hello (1):
* TLSv1.2 (OUT), TLS handshake, Finished (20):
* TLSv1.2 (IN), TLS change cipher, Client hello (1):
* TLSv1.2 (IN), TLS handshake, Finished (20):
* SSL connection using TLSv1.2 / ECDHE-RSA-AES256-GCM-SHA384
* ALPN, server did not agree to a protocol
* Server certificate:
*  subject: OU=Domain Control Validated; OU=PositiveSSL; CN=pvoutput.org
*  start date: Dec 21 00:00:00 2017 GMT
*  expire date: Feb  4 23:59:59 2021 GMT
*  subjectAltName: host "pvoutput.org" matched cert's "pvoutput.org"
*  issuer: C=GB; ST=Greater Manchester; L=Salford; O=COMODO CA Limited; CN=COMODO RSA Domain Validation Secure Server CA
*  SSL certificate verify ok.
> POST /service/r2/addstatus.jsp HTTP/1.1
> Host: pvoutput.org
> User-Agent: curl/7.52.1
> Accept: */*
> Content-Type: application/json
> X-Pvoutput-Apikey: valid Apikey
> X-Pvoutput-SystemId: validID
> Content-Length: 59
>
* upload completely sent off: 59 out of 59 bytes
< HTTP/1.1 400 Bad Request
< Date: Tue, 21 May 2019 12:01:54 GMT
< Set-Cookie: JSESSIONID=validkey;Path=/
< Expires: Thu, 01 Jan 1970 00:00:00 GMT
< Content-Type: text/plain;charset=ISO-8859-1
< Connection: close
< Server: Jetty(7.6.17.v20150415)
< Strict-Transport-Security: max-age=15768000
<
* TLSv1.2 (IN), TLS alert, Client hello (1):
* Curl_http_done: called premature == 0
* Closing connection 0
* TLSv1.2 (OUT), TLS alert, Client hello (1):
Bad request 400: Invalid Time [null]

My understanding is that pvoutput does no longer accept calls to http set by Strict-Transport-Security: max-age=15768000 but I do not understand why I receive this message as I clearly (try to) call https

Sending the same data via GET does work but I want to understand what is going wrong here.
Hopefully someone can help

The service does not accept JSON

1 Like

Thanks, converted the postdata to a formatted string and that did the trick !