Invalid json when using curl to update - Windows

I'm running on Windows and when I use the api example to update a ticket I get an invalid_json message.


My command is as follows:


curl -v -u xxx:yyy -H "Content-Type: application/json" -X PUT -d '{ "priority":2, "status":3 }' https://demosolutions.freshdesk.com/api/v2/tickets/154


The url needs to be in double quotes otherwise I get an error stating that https is not supported.


The output from the curl command is as follows:



* Rebuilt URL to: priority:2,/
* Could not resolve host: priority
* Closing connection 0
curl: (6) Could not resolve host: priority
* Rebuilt URL to: status:3/
* Could not resolve host: status
* Closing connection 1
curl: (6) Could not resolve host: status
curl: (3) [globbing] unmatched close brace/bracket in column 1
*  Trying 52.72.32.65...  * TCP_NODELAY set
* Connected to demosolutions.freshdesk.com (52.72.32.65) port 443 (#2)
* ALPN, offering h2
* ALPN, offering http/1.1
* Cipher selection: ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:@STRENGTH
* successfully set certificate verify locations:
*  CAfile: C:\Program Files\cURL\bin\curl-ca-bundle.crt
  CApath: none
* 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 handshake, Finished (20):
* SSL connection using TLSv1.2 / ECDHE-RSA-AES128-GCM-SHA256
* ALPN, server did not agree to a protocol
* Server certificate:
*  subject: C=US; ST=California; L=San Bruno; O=Freshworks Inc; OU=Freshworks; CN=*.freshdesk.com
*  start date: Jul  4 00:00:00 2017 GMT
*  expire date: Jul 14 12:00:00 2020 GMT
*  subjectAltName: host "demosolutions.freshdesk.com" matched cert's "*.freshdesk.com"
*  issuer: C=US; O=DigiCert Inc; OU=www.digicert.com; CN=DigiCert SHA2 High Assurance Server CA
*  SSL certificate verify ok.
* Server auth using Basic with user 'Sv6IsLa70yRVcCSiic'
> PUT /api/v2/tickets/154 HTTP/1.1
> Host: demosolutions.freshdesk.com
> Authorization: Basic U3Y2SXNMYTcweVJWY0NTaWljOng=
> User-Agent: curl/7.53.1
> Accept: */*
> Content-Type: application/json
> Content-Length: 2
>
* upload completely sent off: 2 out of 2 bytes
< HTTP/1.1 400 Bad Request
< Content-Type: application/json
< Date: Fri, 10 Nov 2017 10:42:58 GMT
< Status: 400 Bad Request
< X-Rack-Cache: invalidate, pass
< X-RateLimit-Remaining: 991
< X-RateLimit-Total: 1000
< X-RateLimit-Used-CurrentRequest: 1
< X-Request-Id: 53a75dda2a057b7e198e729e20a62f84
< X-XSS-Protection: 1; mode=block
< Content-Length: 72
< Connection: keep-alive
<
{"code":"invalid_json","message":"Request body has invalid json format"}* Connection #2 to host demosolutions.freshdesk.com left intact



2 people have this question
1 Comment

Hello Railton,


Quickly skimming through the logs, I found that one of the requests with the X-request ID -  4d0a13034e281a65f89f635abc93e01b, made around 11:00:00 GMT worked as expected. The previous request failed with the field validation error. 


Please let us know if you're still facing issues with the API request. We shall connect over a private support ticket to troubleshoot this further.


Cheers!

Login or Signup to post a comment