IBM Support

json format error at curl command from Windows when attempt to get an online report from a Guardium collector

Troubleshooting


Problem

To get a report output from a Guardium collector by using the REST API, executed a curl command like: curl -k --header "Authorization: Bearer 17161940-3af8-430c-935f-53d0ba21124e" -i -H "Content-Type: application/json" -X POST -d '{"quey":"parameters"}' https://.:8443/restAPI/online_report But it results the following error on Winodws. {"ErrorCode":1,"ErrorMessage":"return data is not encoded in json format correctly"}

Symptom

json format error at curl command

Cause

There is a specific problem between an interaction of Windows
Command Prompt and curl regarding the handling of quotes.

Environment

Curl version curl 7.37.0 (x86_64-pc-win32)
libcurl/7.37.0

Diagnosing The Problem

The curl command with the following format works well on Linux platform but it fails on Windows

curl . . . -d '{"your":"query"}'

Resolving The Problem

From the Windows we have to use the following format:
curl ... -d "{'your':'query'}"

[{"Product":{"code":"SSMPHH","label":"IBM Security Guardium"},"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Component":"Guardium Database Activity Monitor","Platform":[{"code":"PF033","label":"Windows"}],"Version":"9.1","Edition":"","Line of Business":{"code":"LOB24","label":"Security Software"}}]

Document Information

Modified date:
16 June 2018

UID

swg21691351