I am trying to hit a REST API through curl on windows cmd and curl.exe on powershell
Below is how my curl command looks:
curl --insecure -g -v -o -X POST --header 'content-type:application/json' --header 'accept:application/json' --header 'Cookie:CTSESSION=<my ctsession>' --data
"[{"id":"90344","alertId":"xxxx","action":"CLOSE","assignee":"xxxx"}]" https://<web-sso url>
also tried using single quotes for request body as shown below
curl --insecure -g -v -o -X POST --header 'content-type:application/json' --header 'accept:application/json' --header 'Cookie:CTSESSION=<my ctsession>' --data '[{"id":"90344","alertId":"xxxx","action":"CLOSE","assignee":"xxxx"}]' https://<web-sso url>
but I get "status":400,"error":"Bad Request".
I think I am making some syntax error around the array [] in request payload. Have also tried using """ in request payload and also \ "" but nothing worked.
Please help me in figuring out my mistake
UPDATE:
Tried with below curl command
curl --insecure -g -v -o -X POST --header "content-type:application/json" --header "accept:application/json" --header "Cookie:CTSESSION=<my ctsession>" --data "[{\"id\":\"90344\",\"alertId\":\"afas\",\"action\":\"CLOSE\",\"assignee\":\"akash@ab.com\"}]" https://<websso url>
but getting following error
org.springframework.http.converter.HttpMessageNotReadableException: JSON parse error: Unexpected character ('\' (code 92)): was expecting double-quote to start field name; nested exception is com.fasterxml.jackson.databind.JsonMappingException: Unexpected character ('\' (code 92)): was expecting double-quote to start field name